##// END OF EJS Templates
Returns lines changed for paths specified as arguments correctly....
madhu@madhu -
r7870:7bcce39e default
parent child Browse files
Show More
@@ -21,9 +21,10 b' def maketemplater(ui, repo, tmpl):'
21 t.use_template(tmpl)
21 t.use_template(tmpl)
22 return t
22 return t
23
23
24 def changedlines(ui, repo, ctx1, ctx2):
24 def changedlines(ui, repo, ctx1, ctx2, fns):
25 lines = 0
25 lines = 0
26 diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node()))
26 fmatch = cmdutil.match(repo, pats=fns)
27 diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch))
27 for l in diff.split('\n'):
28 for l in diff.split('\n'):
28 if (l.startswith("+") and not l.startswith("+++ ") or
29 if (l.startswith("+") and not l.startswith("+++ ") or
29 l.startswith("-") and not l.startswith("--- ")):
30 l.startswith("-") and not l.startswith("--- ")):
@@ -71,7 +72,7 b' def countrate(ui, repo, amap, *pats, **o'
71 continue
72 continue
72
73
73 ctx1 = parents[0]
74 ctx1 = parents[0]
74 lines = changedlines(ui, repo, ctx1, ctx)
75 lines = changedlines(ui, repo, ctx1, ctx, fns)
75 rate[key] = rate.get(key, 0) + lines
76 rate[key] = rate.get(key, 0) + lines
76
77
77 if opts.get('progress'):
78 if opts.get('progress'):
@@ -20,7 +20,15 b' echo c > c'
20 hg ci -m changeca -u user3 -d 12:00 a
20 hg ci -m changeca -u user3 -d 12:00 a
21 hg ci -m changecb -u user3 -d 12:15 b
21 hg ci -m changecb -u user3 -d 12:15 b
22 hg ci -Am addc -u user3 -d 12:30
22 hg ci -Am addc -u user3 -d 12:30
23 mkdir -p d/e
24 echo abc > d/e/f1.txt
25 hg ci -Am "add d/e/f1.txt" -u user1 -d 12:45 d/e/f1.txt
26 mkdir -p d/g
27 echo def > d/g/f2.txt
28 hg ci -Am "add d/g/f2.txt" -u user1 -d 13:00 d/g/f2.txt
23
29
30 echo % churn separate directories
31 hg churn d/e
24 echo % churn all
32 echo % churn all
25 hg churn
33 hg churn
26 echo % churn up to rev 2
34 echo % churn up to rev 2
@@ -2,22 +2,25 b''
2 adding a
2 adding a
3 adding b
3 adding b
4 adding c
4 adding c
5 % churn separate directories
6 user1 1 ***************************************************************
5 % churn all
7 % churn all
6 user3 3 ***************************************************************
8 user3 3 ***************************************************************
9 user1 3 ***************************************************************
7 user2 2 ******************************************
10 user2 2 ******************************************
8 user1 1 *********************
9 % churn up to rev 2
11 % churn up to rev 2
10 user2 2 ***************************************************************
12 user2 2 ***************************************************************
11 user1 1 *******************************
13 user1 1 *******************************
12 % churn with aliases
14 % churn with aliases
13 alias3 3 **************************************************************
15 alias3 3 **************************************************************
16 alias1 3 **************************************************************
14 user2 2 *****************************************
17 user2 2 *****************************************
15 alias1 1 ********************
16 % churn with column specifier
18 % churn with column specifier
17 user3 3 ***********************
19 user3 3 ***********************
20 user1 3 ***********************
18 user2 2 ***************
21 user2 2 ***************
19 user1 1 *******
20 % churn by hour
22 % churn by hour
21 06 1 **********************
23 06 1 ****************
22 09 2 ********************************************
24 09 2 *********************************
23 12 3 ******************************************************************
25 12 4 ******************************************************************
26 13 1 ****************
General Comments 0
You need to be logged in to leave comments. Login now