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

Side by Side Diff: gclient_scm.py

Issue 2447813003: Call status before reset in gclient sync. (Closed)
Patch Set: Add comment Created 4 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
« 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 if verbose: 527 if verbose:
528 self.Print(remote_output) 528 self.Print(remote_output)
529 529
530 self._UpdateBranchHeads(options, fetch=True) 530 self._UpdateBranchHeads(options, fetch=True)
531 531
532 # This is a big hammer, debatable if it should even be here... 532 # This is a big hammer, debatable if it should even be here...
533 if options.force or options.reset: 533 if options.force or options.reset:
534 target = 'HEAD' 534 target = 'HEAD'
535 if options.upstream and upstream_branch: 535 if options.upstream and upstream_branch:
536 target = upstream_branch 536 target = upstream_branch
537
538 # Builds can create hard links which update source files' ctimes, causing
539 # git to become confused over what files are out-of-date. Calling
540 # `git status` resynchronizes git and allows `git reset --hard` to not
541 # re-checkout files (and thus forcing unnecessary rebuilds)".
542 self._Run(['status'], options)
543
537 self._Run(['reset', '--hard', target], options) 544 self._Run(['reset', '--hard', target], options)
538 545
539 if current_type == 'detached': 546 if current_type == 'detached':
540 # case 0 547 # case 0
541 self._CheckClean(revision) 548 self._CheckClean(revision)
542 self._CheckDetachedHead(revision, options) 549 self._CheckDetachedHead(revision, options)
543 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision: 550 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision:
544 self.Print('Up-to-date; skipping checkout.') 551 self.Print('Up-to-date; skipping checkout.')
545 else: 552 else:
546 # 'git checkout' may need to overwrite existing untracked files. Allow 553 # 'git checkout' may need to overwrite existing untracked files. Allow
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 kwargs.setdefault('cwd', self.checkout_path) 1182 kwargs.setdefault('cwd', self.checkout_path)
1176 kwargs.setdefault('stdout', self.out_fh) 1183 kwargs.setdefault('stdout', self.out_fh)
1177 kwargs['filter_fn'] = self.filter 1184 kwargs['filter_fn'] = self.filter
1178 kwargs.setdefault('print_stdout', False) 1185 kwargs.setdefault('print_stdout', False)
1179 env = scm.GIT.ApplyEnvVars(kwargs) 1186 env = scm.GIT.ApplyEnvVars(kwargs)
1180 cmd = ['git'] + args 1187 cmd = ['git'] + args
1181 if show_header: 1188 if show_header:
1182 gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs) 1189 gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs)
1183 else: 1190 else:
1184 gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs) 1191 gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs)
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