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

Side by Side Diff: gclient_scm.py

Issue 647063: Add --reset option to gclient sync for git (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 10 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 | « gclient.py ('k') | 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) 2009 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2009 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 '\tFix the conflict and run gclient again.\n' 224 '\tFix the conflict and run gclient again.\n'
225 '\tOr to abort run:\n\t\tgit-rebase --abort\n' 225 '\tOr to abort run:\n\t\tgit-rebase --abort\n'
226 '\tSee man git-rebase for details.\n' 226 '\tSee man git-rebase for details.\n'
227 % (self.relpath, rev_str)) 227 % (self.relpath, rev_str))
228 228
229 # TODO(maruel): Do we need to do an automatic retry here? Probably overkill 229 # TODO(maruel): Do we need to do an automatic retry here? Probably overkill
230 merge_base = self._Run(['merge-base', 'HEAD', new_base]) 230 merge_base = self._Run(['merge-base', 'HEAD', new_base])
231 self._Run(['remote', 'update'], redirect_stdout=False) 231 self._Run(['remote', 'update'], redirect_stdout=False)
232 files = self._Run(['diff', new_base, '--name-only']).split() 232 files = self._Run(['diff', new_base, '--name-only']).split()
233 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 233 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
234 if options.force: 234 if options.force or options.reset:
235 self._Run(['reset', '--hard', merge_base], redirect_stdout=False) 235 self._Run(['reset', '--hard', merge_base], redirect_stdout=False)
236 try: 236 try:
237 self._Run(['rebase', '-v', '--onto', new_base, merge_base, cur_branch], 237 self._Run(['rebase', '-v', '--onto', new_base, merge_base, cur_branch],
238 redirect_stdout=False) 238 redirect_stdout=False)
239 except gclient_utils.Error: 239 except gclient_utils.Error:
240 pass 240 pass
241 241
242 # If the rebase generated a conflict, abort and ask user to fix 242 # If the rebase generated a conflict, abort and ask user to fix
243 if self._GetCurrentBranch() is None: 243 if self._GetCurrentBranch() is None:
244 raise gclient_utils.Error('\n____ %s%s\n' 244 raise gclient_utils.Error('\n____ %s%s\n'
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " 570 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory "
571 "does not exist." 571 "does not exist."
572 % (' '.join(command), path)) 572 % (' '.join(command), path))
573 # There's no file list to retrieve. 573 # There's no file list to retrieve.
574 else: 574 else:
575 self.RunAndGetFileList(options, command, path, file_list) 575 self.RunAndGetFileList(options, command, path, file_list)
576 576
577 def FullUrlForRelativeUrl(self, url): 577 def FullUrlForRelativeUrl(self, url):
578 # Find the forth '/' and strip from there. A bit hackish. 578 # Find the forth '/' and strip from there. A bit hackish.
579 return '/'.join(self.url.split('/')[:4]) + url 579 return '/'.join(self.url.split('/')[:4]) + url
OLDNEW
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698