mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
Returns lines changed for paths specified as arguments correctly.
This fixes issue 1569. hg churn <path> now returns only the number of lines changed in the path, if the path is specified by filtering files through a match filter at the changeset level. test-churn has been updated to take care of this issue.
This commit is contained in:
parent
fe39d83f68
commit
d6166450e5
@ -21,9 +21,10 @@ def maketemplater(ui, repo, tmpl):
|
||||
t.use_template(tmpl)
|
||||
return t
|
||||
|
||||
def changedlines(ui, repo, ctx1, ctx2):
|
||||
def changedlines(ui, repo, ctx1, ctx2, fns):
|
||||
lines = 0
|
||||
diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node()))
|
||||
fmatch = cmdutil.match(repo, pats=fns)
|
||||
diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch))
|
||||
for l in diff.split('\n'):
|
||||
if (l.startswith("+") and not l.startswith("+++ ") or
|
||||
l.startswith("-") and not l.startswith("--- ")):
|
||||
@ -71,7 +72,7 @@ def countrate(ui, repo, amap, *pats, **opts):
|
||||
continue
|
||||
|
||||
ctx1 = parents[0]
|
||||
lines = changedlines(ui, repo, ctx1, ctx)
|
||||
lines = changedlines(ui, repo, ctx1, ctx, fns)
|
||||
rate[key] = rate.get(key, 0) + lines
|
||||
|
||||
if opts.get('progress'):
|
||||
|
@ -20,7 +20,15 @@ echo c > c
|
||||
hg ci -m changeca -u user3 -d 12:00 a
|
||||
hg ci -m changecb -u user3 -d 12:15 b
|
||||
hg ci -Am addc -u user3 -d 12:30
|
||||
mkdir -p d/e
|
||||
echo abc > d/e/f1.txt
|
||||
hg ci -Am "add d/e/f1.txt" -u user1 -d 12:45 d/e/f1.txt
|
||||
mkdir -p d/g
|
||||
echo def > d/g/f2.txt
|
||||
hg ci -Am "add d/g/f2.txt" -u user1 -d 13:00 d/g/f2.txt
|
||||
|
||||
echo % churn separate directories
|
||||
hg churn d/e
|
||||
echo % churn all
|
||||
hg churn
|
||||
echo % churn up to rev 2
|
||||
|
@ -2,22 +2,25 @@
|
||||
adding a
|
||||
adding b
|
||||
adding c
|
||||
% churn separate directories
|
||||
user1 1 ***************************************************************
|
||||
% churn all
|
||||
user3 3 ***************************************************************
|
||||
user1 3 ***************************************************************
|
||||
user2 2 ******************************************
|
||||
user1 1 *********************
|
||||
% churn up to rev 2
|
||||
user2 2 ***************************************************************
|
||||
user1 1 *******************************
|
||||
% churn with aliases
|
||||
alias3 3 **************************************************************
|
||||
alias1 3 **************************************************************
|
||||
user2 2 *****************************************
|
||||
alias1 1 ********************
|
||||
% churn with column specifier
|
||||
user3 3 ***********************
|
||||
user1 3 ***********************
|
||||
user2 2 ***************
|
||||
user1 1 *******
|
||||
% churn by hour
|
||||
06 1 **********************
|
||||
09 2 ********************************************
|
||||
12 3 ******************************************************************
|
||||
06 1 ****************
|
||||
09 2 *********************************
|
||||
12 4 ******************************************************************
|
||||
13 1 ****************
|
||||
|
Loading…
Reference in New Issue
Block a user