Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: scm.py

Issue 133073015: Re-reland r245404 ("If the destination directory doesn't contain the desired repo, delete it") (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Clean up check_output call, print hostname on bots Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
diff --git a/scm.py b/scm.py
index 30bb3d17ea49bd74c0a83af490bbc486d60e3f41..60ba80000990b50615c366d543bfab2c547b5ac2 100644
--- a/scm.py
+++ b/scm.py
@@ -166,12 +166,15 @@ class GIT(object):
return GIT.ShortBranchName(GIT.GetBranchRef(cwd))
@staticmethod
- def IsGitSvn(cwd):
+ def IsGitSvn(checkout_root):
"""Returns true if this repo looks like it's using git-svn."""
+ # A git-svn checkout has a .git directory.
+ if not os.path.isdir(os.path.join(checkout_root, '.git')):
+ return False
# If you have any "svn-remote.*" config keys, we think you're using svn.
try:
GIT.Capture(['config', '--local', '--get-regexp', r'^svn-remote\.'],
- cwd=cwd)
+ cwd=checkout_root)
return True
except subprocess2.CalledProcessError:
return False
@@ -408,7 +411,7 @@ class GIT(object):
@staticmethod
def GetSha1ForSvnRev(cwd, rev):
"""Returns a corresponding git sha1 for a SVN revision."""
- if not GIT.IsGitSvn(cwd=cwd):
+ if not GIT.IsGitSvn(cwd):
return None
try:
output = GIT.Capture(['svn', 'find-rev', 'r' + str(rev)], cwd=cwd)
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698