diff mercurial/patch.py @ 14382:2d16f15da7bd

patch: remove patch.patch() cwd argument
author Patrick Mezard <pmezard@gmail.com>
date Thu, 19 May 2011 22:44:01 +0200
parents d4192500586a
children 1bd52cb12a55
line wrap: on
line diff
--- a/mercurial/patch.py	Thu May 19 22:44:01 2011 +0200
+++ b/mercurial/patch.py	Thu May 19 22:44:01 2011 +0200
@@ -1281,13 +1281,14 @@
         return -1
     return err
 
-def _externalpatch(ui, repo, patcher, patchname, strip, cwd, files,
+def _externalpatch(ui, repo, patcher, patchname, strip, files,
                    similarity):
     """use <patcher> to apply <patchname> to the working directory.
     returns whether patch was applied with fuzz factor."""
 
     fuzz = False
     args = []
+    cwd = repo.root
     if cwd:
         args.append('-d %s' % util.shellquote(cwd))
     fp = util.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip,
@@ -1355,7 +1356,7 @@
         raise PatchError(_('patch failed to apply'))
     return ret > 0
 
-def patch(ui, repo, patchname, strip=1, cwd=None, files=None, eolmode='strict',
+def patch(ui, repo, patchname, strip=1, files=None, eolmode='strict',
           similarity=0):
     """Apply <patchname> to the working directory.
 
@@ -1374,7 +1375,7 @@
     try:
         if patcher:
             return _externalpatch(ui, repo, patcher, patchname, strip,
-                                  cwd, files, similarity)
+                                  files, similarity)
         return internalpatch(ui, repo, patchname, strip, files, eolmode,
                              similarity)
     except PatchError, err: