changeset 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
files hgext/mq.py hgext/transplant.py mercurial/commands.py mercurial/patch.py
diffstat 4 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Thu May 19 22:44:01 2011 +0200
+++ b/hgext/mq.py	Thu May 19 22:44:01 2011 +0200
@@ -620,7 +620,7 @@
         files = {}
         try:
             fuzz = patchmod.patch(self.ui, repo, patchfile, strip=1,
-                                  cwd=repo.root, files=files, eolmode=None)
+                                  files=files, eolmode=None)
             return (True, list(files), fuzz)
         except Exception, inst:
             self.ui.note(str(inst) + '\n')
--- a/hgext/transplant.py	Thu May 19 22:44:01 2011 +0200
+++ b/hgext/transplant.py	Thu May 19 22:44:01 2011 +0200
@@ -227,8 +227,7 @@
         if patchfile:
             try:
                 files = {}
-                patch.patch(self.ui, repo, patchfile, cwd=repo.root,
-                            files=files, eolmode=None)
+                patch.patch(self.ui, repo, patchfile, files=files, eolmode=None)
                 files = list(files)
                 if not files:
                     self.ui.warn(_('%s: empty changeset') % revlog.hex(node))
--- a/mercurial/commands.py	Thu May 19 22:44:01 2011 +0200
+++ b/mercurial/commands.py	Thu May 19 22:44:01 2011 +0200
@@ -3105,8 +3105,8 @@
                 repo.dirstate.setbranch(branch or 'default')
 
             files = {}
-            patch.patch(ui, repo, tmpname, strip=strip, cwd=repo.root,
-                        files=files, eolmode=None, similarity=sim / 100.0)
+            patch.patch(ui, repo, tmpname, strip=strip, files=files,
+                        eolmode=None, similarity=sim / 100.0)
             files = list(files)
             if opts.get('no_commit'):
                 if message:
--- 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: