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
diff --git a/git_cl.py b/git_cl.py
index 72770a1..3c51377 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -327,9 +327,13 @@
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):