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

Side by Side Diff: gclient_scm.py

Issue 11417059: Reset to correct version when switching upstream repository for a git dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 1 month 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 import logging 7 import logging
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 if current_url != url and url != 'git://foo': 307 if current_url != url and url != 'git://foo':
308 print('_____ switching %s to a new upstream' % self.relpath) 308 print('_____ switching %s to a new upstream' % self.relpath)
309 # Make sure it's clean 309 # Make sure it's clean
310 self._CheckClean(rev_str) 310 self._CheckClean(rev_str)
311 # Switch over to the new upstream 311 # Switch over to the new upstream
312 self._Run(['remote', 'set-url', 'origin', url], options) 312 self._Run(['remote', 'set-url', 'origin', url], options)
313 quiet = [] 313 quiet = []
314 if not options.verbose: 314 if not options.verbose:
315 quiet = ['--quiet'] 315 quiet = ['--quiet']
316 self._Run(['fetch', 'origin', '--prune'] + quiet, options) 316 self._Run(['fetch', 'origin', '--prune'] + quiet, options)
317 self._Run(['reset', '--hard', 'origin/master'] + quiet, options) 317 self._Run(['reset', '--hard', revision] + quiet, options)
318 self.UpdateSubmoduleConfig() 318 self.UpdateSubmoduleConfig()
319 files = self._Capture(['ls-files']).splitlines() 319 files = self._Capture(['ls-files']).splitlines()
320 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 320 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
321 return 321 return
322 322
323 cur_branch = self._GetCurrentBranch() 323 cur_branch = self._GetCurrentBranch()
324 324
325 # Cases: 325 # Cases:
326 # 0) HEAD is detached. Probably from our initial clone. 326 # 0) HEAD is detached. Probably from our initial clone.
327 # - make sure HEAD is contained by a named ref, then update. 327 # - make sure HEAD is contained by a named ref, then update.
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 new_command.append('--force') 1215 new_command.append('--force')
1216 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1216 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1217 new_command.extend(('--accept', 'theirs-conflict')) 1217 new_command.extend(('--accept', 'theirs-conflict'))
1218 elif options.manually_grab_svn_rev: 1218 elif options.manually_grab_svn_rev:
1219 new_command.append('--force') 1219 new_command.append('--force')
1220 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1220 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1221 new_command.extend(('--accept', 'postpone')) 1221 new_command.extend(('--accept', 'postpone'))
1222 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1222 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1223 new_command.extend(('--accept', 'postpone')) 1223 new_command.extend(('--accept', 'postpone'))
1224 return new_command 1224 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