Commit b92e4804 authored by maruel@chromium.org's avatar maruel@chromium.org

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
parent 0c4a6a3a
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment