From b92e4804a84da80c2664eafecee739513f54213d Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Thu, 3 Mar 2011 20:22:00 +0000 Subject: [PATCH] Set cwd to the root of the git checkout when running git svn info. URL value is dependent on the local directory. The current directory would affect Base URL on Rietveld otherwise. Do not use Repository Root instead of URL since git svn clone foo -T bar wouldn't be correctly based. Update RunCommand() to be able to pass cwd argument. TEST=git cl upload is broken if I break this code. BUG=none Review URL: http://codereview.chromium.org/6591093 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@76791 0039d316-1c4b-4281-b951-d872f2087c98 --- git_cl/git_cl.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git_cl/git_cl.py b/git_cl/git_cl.py index 4e282c132..a89b1e7e3 100644 --- a/git_cl/git_cl.py +++ b/git_cl/git_cl.py @@ -54,7 +54,7 @@ def Popen(cmd, **kwargs): def RunCommand(cmd, error_ok=False, error_message=None, - redirect_stdout=True, swallow_stderr=False): + redirect_stdout=True, swallow_stderr=False, **kwargs): if redirect_stdout: stdout = subprocess.PIPE else: @@ -63,7 +63,7 @@ def RunCommand(cmd, error_ok=False, error_message=None, stderr = subprocess.PIPE else: stderr = None - proc = Popen(cmd, stdout=stdout, stderr=stderr) + proc = Popen(cmd, stdout=stdout, stderr=stderr, **kwargs) output = proc.communicate()[0] if not error_ok and proc.returncode != 0: DieWithError('Command "%s" failed.\n' % (' '.join(cmd)) + @@ -808,7 +808,8 @@ def CMDupload(parser, args): # projects that have their source spread across multiple repos. remote_url = None if settings.GetIsGitSvn(): - data = RunGit(['svn', 'info']) + # URL is dependent on the current directory. + data = RunGit(['svn', 'info'], cwd=settings.GetRoot()) if data: keys = dict(line.split(': ', 1) for line in data.splitlines() if ': ' in line)