Patchwork [7,of,9] patch.trydiff: add support for noprefix

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 13, 2014, 8:22 a.m.
Message ID <39b43cb28effba4c6efc.1415866935@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6706/
State Superseded
Commit f8b5c3e77d4b8d92d6085d45d7193433c85cc0ee
Headers show

Comments

Siddharth Agarwal - Nov. 13, 2014, 8:22 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1415865021 28800
#      Wed Nov 12 23:50:21 2014 -0800
# Node ID 39b43cb28effba4c6efc35b8b98827cd93b74f50
# Parent  07385509855f30ca164dac7a351bf8b36aa80a7c
patch.trydiff: add support for noprefix

Patch

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1737,9 +1737,15 @@ 
         s.update(text)
         return s.hexdigest()
 
+    if opts.noprefix:
+        aprefix = bprefix = ''
+    else:
+        aprefix = 'a/'
+        bprefix = 'b/'
+
     def diffline(a, b, revs):
         if opts.git:
-            line = 'diff --git a/%s b/%s\n' % (a, b)
+            line = 'diff --git %s%s %s%s\n' % (aprefix, a, bprefix, b)
         elif not repo.ui.quiet:
             if revs:
                 revinfo = ' '.join(["-r %s" % rev for rev in revs])