diff mercurial/patch.py @ 24259:5ac8ce04baa2

cmdutil.tryimportone: allow importing relative patches into the working dir This makes hg import --prefix dir/ (without bypass) work.
author Siddharth Agarwal <sid0@fb.com>
date Mon, 09 Mar 2015 18:22:24 -0700
parents 60c279ab7bd3
children 76225ab5a5da
line wrap: on
line diff
--- a/mercurial/patch.py	Fri Mar 06 22:56:19 2015 -0800
+++ b/mercurial/patch.py	Mon Mar 09 18:22:24 2015 -0700
@@ -1533,7 +1533,7 @@
     backend = repobackend(ui, repo, ctx, store)
     return patchbackend(ui, backend, patchobj, strip, '', files, eolmode)
 
-def patch(ui, repo, patchname, strip=1, files=None, eolmode='strict',
+def patch(ui, repo, patchname, strip=1, prefix='', files=None, eolmode='strict',
           similarity=0):
     """Apply <patchname> to the working directory.
 
@@ -1552,7 +1552,7 @@
     if patcher:
         return _externalpatch(ui, repo, patcher, patchname, strip,
                               files, similarity)
-    return internalpatch(ui, repo, patchname, strip, '', files, eolmode,
+    return internalpatch(ui, repo, patchname, strip, prefix, files, eolmode,
                          similarity)
 
 def changedfiles(ui, repo, patchpath, strip=1):