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

Side by Side Diff: gclient_scm.py

Issue 307223006: Call _UpdateBranchHeads within _Clone. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Gclient-specific SCM-specific operations.""" 5 """Gclient-specific SCM-specific operations."""
6 6
7 from __future__ import print_function 7 from __future__ import print_function
8 8
9 import errno 9 import errno
10 import logging 10 import logging
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 rev_type = "hash" 369 rev_type = "hash"
370 370
371 if (not os.path.exists(self.checkout_path) or 371 if (not os.path.exists(self.checkout_path) or
372 (os.path.isdir(self.checkout_path) and 372 (os.path.isdir(self.checkout_path) and
373 not os.path.exists(os.path.join(self.checkout_path, '.git')))): 373 not os.path.exists(os.path.join(self.checkout_path, '.git')))):
374 try: 374 try:
375 self._Clone(revision, url, options) 375 self._Clone(revision, url, options)
376 except subprocess2.CalledProcessError: 376 except subprocess2.CalledProcessError:
377 self._DeleteOrMove(options.force) 377 self._DeleteOrMove(options.force)
378 self._Clone(revision, url, options) 378 self._Clone(revision, url, options)
379 self._UpdateBranchHeads(options, fetch=True)
380 if deps_revision and deps_revision.startswith('branch-heads/'): 379 if deps_revision and deps_revision.startswith('branch-heads/'):
381 deps_branch = deps_revision.replace('branch-heads/', '') 380 deps_branch = deps_revision.replace('branch-heads/', '')
382 self._Capture(['branch', deps_branch, deps_revision]) 381 self._Capture(['branch', deps_branch, deps_revision])
383 self._Capture(['checkout', '--quiet', deps_branch]) 382 self._Capture(['checkout', '--quiet', deps_branch])
384 if file_list is not None: 383 if file_list is not None:
385 files = self._Capture(['ls-files']).splitlines() 384 files = self._Capture(['ls-files']).splitlines()
386 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 385 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
387 if not verbose: 386 if not verbose:
388 # Make the output a little prettier. It's nice to have some whitespace 387 # Make the output a little prettier. It's nice to have some whitespace
389 # between projects when cloning. 388 # between projects when cloning.
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 gclient_utils.safe_makedirs(self.checkout_path) 813 gclient_utils.safe_makedirs(self.checkout_path)
815 gclient_utils.safe_rename(os.path.join(tmp_dir, '.git'), 814 gclient_utils.safe_rename(os.path.join(tmp_dir, '.git'),
816 os.path.join(self.checkout_path, '.git')) 815 os.path.join(self.checkout_path, '.git'))
817 except: 816 except:
818 traceback.print_exc(file=self.out_fh) 817 traceback.print_exc(file=self.out_fh)
819 raise 818 raise
820 finally: 819 finally:
821 if os.listdir(tmp_dir): 820 if os.listdir(tmp_dir):
822 self.Print('_____ removing non-empty tmp dir %s' % tmp_dir) 821 self.Print('_____ removing non-empty tmp dir %s' % tmp_dir)
823 gclient_utils.rmtree(tmp_dir) 822 gclient_utils.rmtree(tmp_dir)
823 self._UpdateBranchHeads(options, fetch=True)
824 self._Run(['checkout', '--quiet', revision.replace('refs/heads/', '')], 824 self._Run(['checkout', '--quiet', revision.replace('refs/heads/', '')],
825 options) 825 options)
826 if self._GetCurrentBranch() is None: 826 if self._GetCurrentBranch() is None:
827 # Squelch git's very verbose detached HEAD warning and use our own 827 # Squelch git's very verbose detached HEAD warning and use our own
828 self.Print( 828 self.Print(
829 ('Checked out %s to a detached HEAD. Before making any commits\n' 829 ('Checked out %s to a detached HEAD. Before making any commits\n'
830 'in this repo, you should use \'git checkout <branch>\' to switch to\n' 830 'in this repo, you should use \'git checkout <branch>\' to switch to\n'
831 'an existing branch or use \'git checkout %s -b <branch>\' to\n' 831 'an existing branch or use \'git checkout %s -b <branch>\' to\n'
832 'create a new branch for your work.') % (revision, self.remote)) 832 'create a new branch for your work.') % (revision, self.remote))
833 833
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 new_command.append('--force') 1483 new_command.append('--force')
1484 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1484 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1485 new_command.extend(('--accept', 'theirs-conflict')) 1485 new_command.extend(('--accept', 'theirs-conflict'))
1486 elif options.manually_grab_svn_rev: 1486 elif options.manually_grab_svn_rev:
1487 new_command.append('--force') 1487 new_command.append('--force')
1488 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1488 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1489 new_command.extend(('--accept', 'postpone')) 1489 new_command.extend(('--accept', 'postpone'))
1490 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1490 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1491 new_command.extend(('--accept', 'postpone')) 1491 new_command.extend(('--accept', 'postpone'))
1492 return new_command 1492 return new_command
OLDNEW
« 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