# HG changeset patch # User Martin von Zweigbergk # Date 2015-01-16 23:19:57 # Node ID da63f557d0dc957f7142818b8e272b2baa9250d3 # Parent f51a822dcf3ba427ededbf3510d0a7e030399f5e trydiff: make 'revs' ignored if opts.git is set Instead of setting revs=None to prevent the call to diffline() when opts.git is set, explicitly do not call the function in the git case. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1772,9 +1772,6 @@ def trydiff(repo, revs, ctx1, ctx2, modi copyto = dict([(v, k) for k, v in copy.items()]) - if opts.git: - revs = None - addedset, removedset = set(added), set(removed) # Fix up added, since merged-in additions appear as # modifications during merges @@ -1845,9 +1842,7 @@ def trydiff(repo, revs, ctx1, ctx2, modi path1 = posixpath.join(prefix, f1) path2 = posixpath.join(prefix, f2) header = [] - if revs: - header.append(diffline(path1, revs)) - elif opts.git: + if opts.git: header.append('diff --git %s%s %s%s\n' % (aprefix, path1, bprefix, path2)) if content1 is None: # added @@ -1862,6 +1857,8 @@ def trydiff(repo, revs, ctx1, ctx2, modi if op is not None: header.append('%s from %s\n' % (op, path1)) header.append('%s to %s\n' % (op, path2)) + elif revs: + header.append(diffline(path1, revs)) if binarydiff and not opts.nobinary: text = mdiff.b85diff(content1, content2)