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

Unified Diff: gclient_scm.py

Issue 289863012: Handle branch or commit refs in the url for unmanaged git solutions (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: split long line, reuse deps_revision Created 6 years, 7 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 | « no previous file | tests/gclient_scm_test.py » ('j') | tests/gclient_scm_test.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 594515dc16879c9014cd007a11754b6f86f6028e..12a428c1baaab622bdb7c533bf3603e4b1ec6f6f 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -331,7 +331,9 @@ class GitWrapper(SCMWrapper):
# Override the revision number.
revision = str(options.revision)
if revision == 'unmanaged':
- revision = None
+ # Check again for a revision in case an initial ref was specified
+ # in the url, for example bla.git@refs/heads/custombranch
+ revision = deps_revision
managed = False
if not revision:
revision = default_rev
@@ -819,12 +821,10 @@ class GitWrapper(SCMWrapper):
if os.listdir(tmp_dir):
self.Print('_____ removing non-empty tmp dir %s' % tmp_dir)
gclient_utils.rmtree(tmp_dir)
- if revision.startswith('refs/heads/'):
- self._Run(
- ['checkout', '--quiet', revision.replace('refs/heads/', '')], options)
- else:
+ self._Run(['checkout', '--quiet', revision.replace('refs/heads/', '')],
+ options)
+ if self._GetCurrentBranch() is None:
# Squelch git's very verbose detached HEAD warning and use our own
- self._Run(['checkout', '--quiet', revision], options)
self.Print(
('Checked out %s to a detached HEAD. Before making any commits\n'
'in this repo, you should use \'git checkout <branch>\' to switch to\n'
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | tests/gclient_scm_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698