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

Unified Diff: gclient_scm.py

Issue 12553006: Reapply r186598 with fix for 'gclient revert'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 7 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
===================================================================
--- gclient_scm.py (revision 186973)
+++ gclient_scm.py (working copy)
@@ -655,6 +655,11 @@
detach_head = True
if options.verbose:
clone_cmd.append('--verbose')
+ # Don't assume 'with_branch_heads' is added by 'gclient sync' setup, since
+ # _Clone() can by reached in roundabout ways (e.g. 'gclient revert').
+ if hasattr(options, 'with_branch_heads') and options.with_branch_heads:
+ clone_cmd.extend(['--config', 'remote.origin.fetch=+refs/branch-heads/*:'
+ 'refs/remotes/branch-heads/*'])
clone_cmd.extend([url, self.checkout_path])
# If the parent directory does not exist, Git clone on Windows will not
@@ -677,6 +682,15 @@
try:
self._Run(clone_cmd, options, cwd=self._root_dir, filter_fn=_GitFilter,
print_stdout=False)
+ # Update the "branch-heads" remote-tracking branches, since clone
+ # doesn't automatically fetch those, and we might need it to checkout a
+ # specific revision below.
+ if (hasattr(options, 'with_branch_heads') and
+ options.with_branch_heads):
+ fetch_cmd = ['fetch', 'origin']
+ if options.verbose:
+ fetch_cmd.append('--verbose')
+ self._Run(fetch_cmd, options)
break
except subprocess2.CalledProcessError, e:
# Too bad we don't have access to the actual output yet.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698