trydiff: replace 'dodiff = False' by 'continue'
The 'dodiff' variable is initialized to True and may later be set to
either False or "binary". When it's set to False, we skip everything
after that point, so we can simplify by instead continue-ing (the
loop). We can then also drop the 'if dodiff', since it will always be
true.
--- a/mercurial/patch.py Wed Jan 07 08:54:26 2015 -0800
+++ b/mercurial/patch.py Wed Jan 07 10:59:40 2015 -0800
@@ -1849,7 +1849,7 @@
and copyto[copy[f]] == f) or
(f in copyto and copyto[f] in addedset
and copy[copyto[f]] == f)):
- dodiff = False
+ continue
else:
header.append('deleted file mode %s\n' %
gitmode[ctx1.flags(f)])
@@ -1869,21 +1869,20 @@
elif binary or nflag != oflag:
losedatafn(f)
- if dodiff:
- if opts.git or revs:
- header.insert(0, diffline(join(a), join(b), revs))
- if dodiff == 'binary' and not opts.nobinary:
- text = mdiff.b85diff(to, tn)
- if text and opts.git:
- addindexmeta(header, gitindex(to), gitindex(tn))
- else:
- text = mdiff.unidiff(to, date1,
- tn, date2,
- join(a), join(b), opts=opts)
- if header and (text or len(header) > 1):
- yield ''.join(header)
- if text:
- yield text
+ if opts.git or revs:
+ header.insert(0, diffline(join(a), join(b), revs))
+ if dodiff == 'binary' and not opts.nobinary:
+ text = mdiff.b85diff(to, tn)
+ if text and opts.git:
+ addindexmeta(header, gitindex(to), gitindex(tn))
+ else:
+ text = mdiff.unidiff(to, date1,
+ tn, date2,
+ join(a), join(b), opts=opts)
+ if header and (text or len(header) > 1):
+ yield ''.join(header)
+ if text:
+ yield text
def diffstatsum(stats):
maxfile, maxtotal, addtotal, removetotal, binary = 0, 0, 0, 0, False