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
diff --git a/git_cl/git_cl.py b/git_cl/git_cl.py
index 4e282c1..a89b1e7 100644
--- a/git_cl/git_cl.py
+++ b/git_cl/git_cl.py
@@ -54,7 +54,7 @@
 
 
 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 @@
     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 @@
   # 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)