Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index fbe52afe0c6293fc0634a26e086d6ec143f4a659..2b0162932e4a7f45821ff97411bc19276fa38130 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -674,6 +674,19 @@ or verify this branch is set up to track another (via the --track argument to |
| return RunGit(['config', 'branch.%s.base-url' % self.GetBranch()], |
| error_ok=True).strip() |
| + def GetGitSvnRemoteUrl(self): |
| + """Return the configured git-svn remote URL parsed from git svn info. |
| + |
| + Returns None if it is not set. |
| + """ |
| + # 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) |
| + return keys.get('URL', None) |
| + return None |
| + |
| def GetRemoteUrl(self): |
| """Return the configured remote URL, e.g. 'git://example.org/foo.git/'. |
| @@ -1718,12 +1731,7 @@ def RietveldUpload(options, args, cl, change): |
| remote_url = cl.GetGitBaseUrlFromConfig() |
| if not remote_url: |
| if settings.GetIsGitSvn(): |
| - # 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) |
| - remote_url = keys.get('URL', None) |
| + remote_url = cl.GetGitSvnRemoteUrl() |
| else: |
| if cl.GetRemoteUrl() and '/' in cl.GetUpstreamBranch(): |
| remote_url = (cl.GetRemoteUrl() + '@' |
| @@ -2097,9 +2105,16 @@ def SendUpstream(parser, args, cmd): |
| if retcode == 0: |
| revision = RunGit(['rev-parse', 'HEAD']).strip() |
| else: |
| - # dcommit the merge branch. |
| + # dcommit the merge branch. Rewrite http URLs for Google code with https |
| + # since it's not allowed to commit to a http URL. |
| + remote_url = cl.GetGitSvnRemoteUrl() |
| + parsed_url = urlparse.urlparse(remote_url) |
| + if (parsed_url.scheme == 'http' and |
| + parsed_url.hostname.endswith('googlecode.com')): |
| + remote_url = remote_url.replace('http://', 'https://') |
| _, output = RunGitWithCode(['svn', 'dcommit', |
|
Michael Achenbach
2014/11/30 14:32:29
You could make this even less intrusive by structu
kjellander_chromium
2014/12/01 09:11:51
Great suggestion. I did this in PS#2.
|
| '-C%s' % options.similarity, |
| + '--commit-url=%s' % remote_url, |
| '--no-rebase', '--rmdir']) |
| if 'Committed r' in output: |
| revision = re.match( |