Mercurial > hg-stable
changeset 24105:0f8baebcdbea
trydiff: read file data in only one place
This moves getfilectx() out of the initial block in the loop, leaving
that block to be only about finding pairs of filenames in ctx1 and
ctx2 to diff.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 22 Jan 2015 23:18:43 -0800 |
parents | b6f434729b97 |
children | 9cf9432a505b |
files | mercurial/patch.py |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Thu Jan 22 23:13:48 2015 -0800 +++ b/mercurial/patch.py Thu Jan 22 23:18:43 2015 -0800 @@ -1772,13 +1772,7 @@ if f not in ctx1: addedset.add(f) for f in sorted(modified + added + removed): - content1 = None - content2 = None copyop = None - if f not in addedset: - content1 = getfilectx(f, ctx1).data() - if f not in removedset: - content2 = getfilectx(f, ctx2).data() f1, f2 = f, f if f in addedset: f1 = None @@ -1790,7 +1784,6 @@ gone.add(f1) else: copyop = 'copy' - content1 = getfilectx(f1, ctx1).data() elif f in removedset: f2 = None if opts.git: @@ -1799,6 +1792,12 @@ and copy[copyto[f]] == f): continue + content1 = None + content2 = None + if f1: + content1 = getfilectx(f1, ctx1).data() + if f2: + content2 = getfilectx(f2, ctx2).data() flag1 = None flag2 = None binary = False