# HG changeset patch # User Eric Eisner # Date 1291688247 18000 # Node ID d0cbddfe3f4cd7c00da3d314f3dd36bb808b9bc0 # Parent 83986af605e5b3f756fdd6eecfe185574119f400 subrepo: use subprocess's cwd instead of git's --work-tree Some older git commands (e.g. git merge) do not properly recognize the --work-tree argument, so abstract that away from git. diff -r 83986af605e5 -r d0cbddfe3f4c mercurial/subrepo.py --- a/mercurial/subrepo.py Mon Dec 06 21:17:27 2010 -0500 +++ b/mercurial/subrepo.py Mon Dec 06 21:17:27 2010 -0500 @@ -617,11 +617,10 @@ return self._gitdir(commands, stream=stream)[0] def _gitdir(self, commands, stream=False): - commands = ['--no-pager', '--git-dir=%s/.git' % self._path, - '--work-tree=%s' % self._path] + commands - return self._gitnodir(commands, stream=stream) + commands = ['--no-pager'] + commands + return self._gitnodir(commands, stream=stream, cwd=self._path) - def _gitnodir(self, commands, stream=False): + def _gitnodir(self, commands, stream=False, cwd=None): """Calls the git command The methods tries to call the git command. versions previor to 1.6.0 @@ -632,7 +631,7 @@ cmd = util.quotecommand(' '.join(cmd)) # print git's stderr, which is mostly progress and useful info - p = subprocess.Popen(cmd, shell=True, bufsize=-1, + p = subprocess.Popen(cmd, shell=True, bufsize=-1, cwd=cwd, close_fds=util.closefds, stdout=subprocess.PIPE) if stream: