Patchwork [3,of,6,for-clowncopter] trydiff: make 'revs' ignored if opts.git is set

login
register
mail settings
Submitter Martin von Zweigbergk
Date Feb. 3, 2015, 4:58 p.m.
Message ID <5449a60f29e4b8012fb8.1422982709@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/7633/
State Accepted
Commit da63f557d0dc957f7142818b8e272b2baa9250d3
Headers show

Comments

Martin von Zweigbergk - Feb. 3, 2015, 4:58 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1421450397 28800
#      Fri Jan 16 15:19:57 2015 -0800
# Node ID 5449a60f29e4b8012fb8754a117876530547d138
# Parent  9fb8badbdb4ba556d8f45b927d7c43efda495da0
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.

Patch

diff -r 9fb8badbdb4b -r 5449a60f29e4 mercurial/patch.py
--- 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)