##// END OF EJS Templates
Change wording in example hook
Benoit Boissinot -
r7918:62f11ef0 default
parent child Browse files
Show More
@@ -1,24 +1,22 b''
1 '''
1 '''
2 These are examples of useful hooks in Python for Mercurial.
2 Examples of useful python hooks for Mercurial.
3 '''
3 '''
4
5 from mercurial import patch, util
4 from mercurial import patch, util
6
5
7
8 def diffstat(ui, repo, **kwargs):
6 def diffstat(ui, repo, **kwargs):
9 '''Use it like:
7 '''Example usage:
10
8
11 [hooks]
9 [hooks]
12 commit.diffstat = python:/path/to/this/file.py:diffstat
10 commit.diffstat = python:/path/to/this/file.py:diffstat
13 changegroup.diffstat = python:/path/to/this/file.py:diffstat
11 changegroup.diffstat = python:/path/to/this/file.py:diffstat
14 '''
12 '''
15 if kwargs.get('parent2'):
13 if kwargs.get('parent2'):
16 return
14 return
17 node = kwargs['node']
15 node = kwargs['node']
18 first = repo[node].parents()[0].node()
16 first = repo[node].parents()[0].node()
19 if 'url' in kwargs:
17 if 'url' in kwargs:
20 last = repo['tip'].node()
18 last = repo['tip'].node()
21 else:
19 else:
22 last = node
20 last = node
23 diff = patch.diff(repo, first, last)
21 diff = patch.diff(repo, first, last)
24 ui.write(patch.diffstat(util.iterlines(diff)))
22 ui.write(patch.diffstat(util.iterlines(diff)))
General Comments 0
You need to be logged in to leave comments. Login now