hgext/mq.py
changeset 2713 35caf437a201
parent 2712 8e5cd8d11b51
child 2720 c91ca61c8953
--- a/hgext/mq.py	Thu Jul 27 16:41:59 2006 -0700
+++ b/hgext/mq.py	Thu Jul 27 18:24:59 2006 -0700
@@ -276,8 +276,6 @@
         # TODO unify with commands.py
         if not patchdir:
             patchdir = self.path
-        pwd = os.getcwd()
-        os.chdir(repo.root)
         err = 0
         if not wlock:
             wlock = repo.wlock()
@@ -304,7 +302,8 @@
 
             try:
                 pp = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch')
-                f = os.popen("%s -p1 --no-backup-if-mismatch < '%s'" % (pp, pf))
+                f = os.popen("%s -d '%s' -p1 --no-backup-if-mismatch < '%s'" %
+                             (pp, repo.root, pf))
             except:
                 self.ui.warn("patch failed, unable to continue (try -v)\n")
                 err = 1
@@ -371,7 +370,6 @@
                 err = 1
                 break
         tr.close()
-        os.chdir(pwd)
         return (err, n)
 
     def delete(self, repo, patch):