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.
--- a/mercurial/patch.py Fri Jan 16 14:58:51 2015 -0800
+++ b/mercurial/patch.py Fri Jan 16 15:19:57 2015 -0800
@@ -1772,9 +1772,6 @@
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 @@
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 @@
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)