changeset 2713:35caf437a201

mq: fix queue.apply to not call os.chdir() call to os.chdir broke "hg -R dirname qpush". instead pass -d (change directory) option to patch command.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 27 Jul 2006 18:24:59 -0700
parents 8e5cd8d11b51
children 85070b784896
files hgext/mq.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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):