Mercurial > hg
comparison hgext/churn.py @ 7308:b6f5490effbf
patch: turn patch.diff() into a generator
This should even be a little faster than passing in an fp argument.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 03 Nov 2008 16:48:23 +0100 |
parents | 7e6a3bae0e8e |
children | 87158be081b8 |
comparison
equal
deleted
inserted
replaced
7307:56380212d630 | 7308:b6f5490effbf |
---|---|
42 t.use_template(tmpl) | 42 t.use_template(tmpl) |
43 return t | 43 return t |
44 | 44 |
45 def changedlines(ui, repo, ctx1, ctx2): | 45 def changedlines(ui, repo, ctx1, ctx2): |
46 lines = 0 | 46 lines = 0 |
47 ui.pushbuffer() | 47 diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node())) |
48 patch.diff(repo, ctx1.node(), ctx2.node()) | |
49 diff = ui.popbuffer() | |
50 for l in diff.split('\n'): | 48 for l in diff.split('\n'): |
51 if (l.startswith("+") and not l.startswith("+++ ") or | 49 if (l.startswith("+") and not l.startswith("+++ ") or |
52 l.startswith("-") and not l.startswith("--- ")): | 50 l.startswith("-") and not l.startswith("--- ")): |
53 lines += 1 | 51 lines += 1 |
54 return lines | 52 return lines |