patch.patchbackend: accept a prefix parameter
authorSiddharth Agarwal <sid0@fb.com>
Fri, 06 Mar 2015 22:27:41 -0800
changeset 24253 26fa5ff9e660
parent 24252 f962692853c0
child 24254 60c279ab7bd3
patch.patchbackend: accept a prefix parameter
mercurial/patch.py
--- a/mercurial/patch.py	Tue Mar 10 16:25:10 2015 -0400
+++ b/mercurial/patch.py	Fri Mar 06 22:27:41 2015 -0800
@@ -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):