##// END OF EJS Templates
revlog: make sure we never use sparserevlog without general delta (issue6056)...
revlog: make sure we never use sparserevlog without general delta (issue6056) We are getting user report where the delta code tries to use `sparse-revlog` logic on repository where `generaldelta` is disabled. This can't work so we ensure the two booleans have a consistent value. Creating this kind of repository is not expected to be possible the current bug report point at a clonebundle related bug that is still to be properly isolated (Yuya Nishihara seems to a have done it). Corrupting a repository to reproduce the issue is possible. A test using this method is included in this fix.

File last commit:

r28562:2b585677 default
r41525:189e06b2 stable
Show More
python-hook-examples.py
26 lines | 632 B | text/x-python | PythonLexer
/ contrib / python-hook-examples.py
Alexander Solovyov
diffstat hook example
r7917 '''
Benoit Boissinot
Change wording in example hook
r7918 Examples of useful python hooks for Mercurial.
Alexander Solovyov
diffstat hook example
r7917 '''
Pulkit Goyal
contrib: python-hook-examples use absolute_import
r28562 from __future__ import absolute_import
from mercurial import (
patch,
util,
)
Alexander Solovyov
diffstat hook example
r7917
def diffstat(ui, repo, **kwargs):
Benoit Boissinot
Change wording in example hook
r7918 '''Example usage:
Alexander Solovyov
diffstat hook example
r7917
[hooks]
commit.diffstat = python:/path/to/this/file.py:diffstat
changegroup.diffstat = python:/path/to/this/file.py:diffstat
'''
if kwargs.get('parent2'):
return
node = kwargs['node']
Matt Mackall
misc: replace .parents()[0] with p1()
r13878 first = repo[node].p1().node()
Alexander Solovyov
diffstat hook example
r7917 if 'url' in kwargs:
Martin von Zweigbergk
repo: don't look up context for tip node if it's not needed...
r39931 last = repo.changelog.tip()
Alexander Solovyov
diffstat hook example
r7917 else:
last = node
diff = patch.diff(repo, first, last)
ui.write(patch.diffstat(util.iterlines(diff)))