Commit 8e05af10 authored by bratell@opera.com's avatar bratell@opera.com

Allow git cl also in repos with read-only git-svn.

If you have read-only git-svn git cl would still try
to use svn commands, which would then fail. This
changes git cl to only use git-svn if the remote
svn repository use the svn:// protocol. It matches
how chromium works and it allowed me to upload a patch.

BUG=391430

R=iannucci

Review URL: https://codereview.chromium.org/344013005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@281500 0039d316-1c4b-4281-b951-d872f2087c98
parent c401ad1c
......@@ -327,9 +327,13 @@ class Settings(object):
def GetIsGitSvn(self):
"""Return true if this repo looks like it's using git-svn."""
if self.is_git_svn is None:
# If you have any "svn-remote.*" config keys, we think you're using svn.
self.is_git_svn = RunGitWithCode(
['config', '--local', '--get-regexp', r'^svn-remote\.'])[0] == 0
# The presence of a svn-remote using the svn:// (or file://)
# protocol suggests that you're using svn. Remotes with the
# http* protocols suggest read-only svn access and are ignored.
code, result = RunGitWithCode(
['config', '--local', '--get-regexp', r'^svn-remote\..*\.url'])
self.is_git_svn = (code == 0 and ("svn://" in result or
"file://" in result))
return self.is_git_svn
def GetSVNBranch(self):
......
......@@ -207,8 +207,8 @@ class TestGitCl(TestCase):
] + cc_call + private_call + [
((['git', 'config', 'branch.master.base-url'],), ''),
((['git',
'config', '--local', '--get-regexp', '^svn-remote\\.'],),
(('', None), 0)),
'config', '--local', '--get-regexp', '^svn-remote\\..*\\.url'],),
(('svn-remote.mybranch.url svn://svn.chromium.org/chrome', None), 0)),
((['git', 'rev-parse', '--show-cdup'],), ''),
((['git', 'svn', 'info'],), ''),
((['git', 'config', 'rietveld.project'],), ''),
......@@ -253,7 +253,7 @@ class TestGitCl(TestCase):
def _dcommit_calls_1(cls):
return [
((['git',
'config', '--local', '--get-regexp', '^svn-remote\\.'],),
'config', '--local', '--get-regexp', '^svn-remote\\..*\\.url'],),
((('svn-remote.svn.url svn://svn.chromium.org/chrome\n'
'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'),
None),
......@@ -775,7 +775,8 @@ class TestGitCl(TestCase):
''),
((['git', 'config', 'rietveld.private',],),
''),
((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],),
((['git', 'config', '--local', '--get-regexp',
'^svn-remote\\..*\\.url',],),
''),
((['git', 'config', 'rietveld.project',],),
''),
......
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