[PATCH 1 of 2] patch.patchbackend: accept a prefix parameter

Siddharth Agarwal sid0 at fb.com
Mon Mar 9 11:59:43 CDT 2015


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1425709661 28800
#      Fri Mar 06 22:27:41 2015 -0800
# Node ID f4f59f9484d44f3941b13b76d168f50e91c3cbb3
# Parent  8f72509cd5be9c0e91954a415de4022b082720c9
patch.patchbackend: accept a prefix parameter

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1494,7 +1494,8 @@
                          util.explainexit(code)[0])
     return fuzz
 
-def patchbackend(ui, backend, patchobj, strip, files=None, eolmode='strict'):
+def patchbackend(ui, backend, patchobj, strip, prefix, files=None,
+                 eolmode='strict'):
     if files is None:
         files = set()
     if eolmode is None:
@@ -1509,7 +1510,7 @@
     except TypeError:
         fp = patchobj
     try:
-        ret = applydiff(ui, fp, backend, store, strip=strip,
+        ret = applydiff(ui, fp, backend, store, strip=strip, prefix=prefix,
                         eolmode=eolmode)
     finally:
         if fp != patchobj:
@@ -1525,12 +1526,12 @@
     """use builtin patch to apply <patchobj> to the working directory.
     returns whether patch was applied with fuzz factor."""
     backend = workingbackend(ui, repo, similarity)
-    return patchbackend(ui, backend, patchobj, strip, files, eolmode)
+    return patchbackend(ui, backend, patchobj, strip, '', files, eolmode)
 
 def patchrepo(ui, repo, ctx, store, patchobj, strip, files=None,
               eolmode='strict'):
     backend = repobackend(ui, repo, ctx, store)
-    return patchbackend(ui, backend, patchobj, strip, files, eolmode)
+    return patchbackend(ui, backend, patchobj, strip, '', files, eolmode)
 
 def patch(ui, repo, patchname, strip=1, files=None, eolmode='strict',
           similarity=0):


More information about the Mercurial-devel mailing list