Mercurial > public > mercurial-scm > hg-stable
diff hgext/churn.py @ 7870:7bcce39e8f07
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.
author | madhu@madhu |
---|---|
date | Wed, 25 Mar 2009 01:49:03 +0530 |
parents | fece056bf240 |
children | 206334f8aa0b |
line wrap: on
line diff
--- a/hgext/churn.py Mon Mar 23 13:11:11 2009 +0100 +++ b/hgext/churn.py Wed Mar 25 01:49:03 2009 +0530 @@ -21,9 +21,10 @@ 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 @@ 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'):