##// END OF EJS Templates
amend: add tests for amending only some files from commit to be amended...
amend: add tests for amending only some files from commit to be amended We do not have robust enough tests for scenarios where only some files in a changeset are amended. This presents an interesting scenario because the working copy could have modified versions of the remaining files in the pre-amend changeset. Therefore, I have added some tests to ensure that amend behaves as expected in these scenarios. Test Plan: Ensured that the test "test-commit-amend.t" passes. Differential Revision: https://phab.mercurial-scm.org/D596

File last commit:

r28562:2b585677 default
r34061:6fb5a06b default
Show More
python-hook-examples.py
26 lines | 630 B | text/x-python | PythonLexer
/ contrib / python-hook-examples.py
'''
Examples of useful python hooks for Mercurial.
'''
from __future__ import absolute_import
from mercurial import (
patch,
util,
)
def diffstat(ui, repo, **kwargs):
'''Example usage:
[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']
first = repo[node].p1().node()
if 'url' in kwargs:
last = repo['tip'].node()
else:
last = node
diff = patch.diff(repo, first, last)
ui.write(patch.diffstat(util.iterlines(diff)))