mercurial/patch.py
changeset 24020 cc81e6da0757
parent 24005 2c166f6b5d10
child 24021 f51a822dcf3b
--- a/mercurial/patch.py	Tue Jan 27 09:22:59 2015 -0500
+++ b/mercurial/patch.py	Fri Jan 16 14:58:06 2015 -0800
@@ -1754,9 +1754,7 @@
         bprefix = 'b/'
 
     def diffline(a, b, revs):
-        if opts.git:
-            line = 'diff --git %s%s %s%s\n' % (aprefix, a, bprefix, b)
-        elif not repo.ui.quiet:
+        if not repo.ui.quiet:
             if revs:
                 revinfo = ' '.join(["-r %s" % rev for rev in revs])
                 line = 'diff %s %s\n' % (revinfo, a)
@@ -1847,9 +1845,11 @@
         path1 = posixpath.join(prefix, f1)
         path2 = posixpath.join(prefix, f2)
         header = []
-        if opts.git or revs:
+        if revs:
             header.append(diffline(path1, path2, revs))
-        if opts.git:
+        elif opts.git:
+            header.append('diff --git %s%s %s%s\n' %
+                          (aprefix, path1, bprefix, path2))
             if content1 is None: # added
                 header.append('new file mode %s\n' % gitmode[flag2])
             elif content2 is None: # removed