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

Side by Side Diff: gclient_scm.py

Issue 6976050: Fix the call to "git checkout" on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 9 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) 2010 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2010 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 import logging 7 import logging
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 print(remote_output.strip()) 306 print(remote_output.strip())
307 307
308 # This is a big hammer, debatable if it should even be here... 308 # This is a big hammer, debatable if it should even be here...
309 if options.force or options.reset: 309 if options.force or options.reset:
310 self._Run(['reset', '--hard', 'HEAD'], options) 310 self._Run(['reset', '--hard', 'HEAD'], options)
311 311
312 if current_type == 'detached': 312 if current_type == 'detached':
313 # case 0 313 # case 0
314 self._CheckClean(rev_str) 314 self._CheckClean(rev_str)
315 self._CheckDetachedHead(rev_str, options) 315 self._CheckDetachedHead(rev_str, options)
316 self._Capture(['checkout', '--quiet', '%s^0' % revision]) 316 self._Capture(['checkout', '--quiet', '%s' % revision])
317 if not printed_path: 317 if not printed_path:
318 print('\n_____ %s%s' % (self.relpath, rev_str)) 318 print('\n_____ %s%s' % (self.relpath, rev_str))
319 elif current_type == 'hash': 319 elif current_type == 'hash':
320 # case 1 320 # case 1
321 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None: 321 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None:
322 # Our git-svn branch (upstream_branch) is our upstream 322 # Our git-svn branch (upstream_branch) is our upstream
323 self._AttemptRebase(upstream_branch, files, options, 323 self._AttemptRebase(upstream_branch, files, options,
324 newbase=revision, printed_path=printed_path) 324 newbase=revision, printed_path=printed_path)
325 printed_path = True 325 printed_path = True
326 else: 326 else:
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 # read". In the meantime, just make sure .git exists. 511 # read". In the meantime, just make sure .git exists.
512 if (e.args[0] == 'git command clone returned 128' and 512 if (e.args[0] == 'git command clone returned 128' and
513 os.path.exists(os.path.join(self.checkout_path, '.git'))): 513 os.path.exists(os.path.join(self.checkout_path, '.git'))):
514 print(str(e)) 514 print(str(e))
515 print('Retrying...') 515 print('Retrying...')
516 continue 516 continue
517 raise e 517 raise e
518 518
519 if detach_head: 519 if detach_head:
520 # Squelch git's very verbose detached HEAD warning and use our own 520 # Squelch git's very verbose detached HEAD warning and use our own
521 self._Capture(['checkout', '--quiet', '%s^0' % revision]) 521 self._Capture(['checkout', '--quiet', '%s' % revision])
522 print( 522 print(
523 ('Checked out %s to a detached HEAD. Before making any commits\n' 523 ('Checked out %s to a detached HEAD. Before making any commits\n'
524 'in this repo, you should use \'git checkout <branch>\' to switch to\n' 524 'in this repo, you should use \'git checkout <branch>\' to switch to\n'
525 'an existing branch or use \'git checkout origin -b <branch>\' to\n' 525 'an existing branch or use \'git checkout origin -b <branch>\' to\n'
526 'create a new branch for your work.') % revision) 526 'create a new branch for your work.') % revision)
527 527
528 def _AttemptRebase(self, upstream, files, options, newbase=None, 528 def _AttemptRebase(self, upstream, files, options, newbase=None,
529 branch=None, printed_path=False): 529 branch=None, printed_path=False):
530 """Attempt to rebase onto either upstream or, if specified, newbase.""" 530 """Attempt to rebase onto either upstream or, if specified, newbase."""
531 files.extend(self._Capture(['diff', upstream, '--name-only']).split()) 531 files.extend(self._Capture(['diff', upstream, '--name-only']).split())
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 937
938 This method returns a new list to be used as a command.""" 938 This method returns a new list to be used as a command."""
939 new_command = command[:] 939 new_command = command[:]
940 if revision: 940 if revision:
941 new_command.extend(['--revision', str(revision).strip()]) 941 new_command.extend(['--revision', str(revision).strip()])
942 # --force was added to 'svn update' in svn 1.5. 942 # --force was added to 'svn update' in svn 1.5.
943 if ((options.force or options.manually_grab_svn_rev) and 943 if ((options.force or options.manually_grab_svn_rev) and
944 scm.SVN.AssertVersion("1.5")[0]): 944 scm.SVN.AssertVersion("1.5")[0]):
945 new_command.append('--force') 945 new_command.append('--force')
946 return new_command 946 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