# HG changeset patch # User Martin von Zweigbergk # Date 1420657180 28800 # Node ID e30c6aa6f2a22f965ce62870610f3a9079a68466 # Parent 70d8be6299ab5eba50fb8a05b3dc3a2a9440256b 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. diff -r 70d8be6299ab -r e30c6aa6f2a2 mercurial/patch.py --- 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