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

Side by Side Diff: gclient_scm.py

Issue 587253005: Use CheckCallAndFilterAndHeader for git commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: update test expectations Created 6 years, 2 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
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | 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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 config_cmd = ['config', 'remote.%s.fetch' % self.remote, 1118 config_cmd = ['config', 'remote.%s.fetch' % self.remote,
1119 '+refs/tags/*:refs/tags/*', 1119 '+refs/tags/*:refs/tags/*',
1120 '^\\+refs/tags/\\*:.*$'] 1120 '^\\+refs/tags/\\*:.*$']
1121 self._Run(config_cmd, options) 1121 self._Run(config_cmd, options)
1122 need_fetch = True 1122 need_fetch = True
1123 if fetch and need_fetch: 1123 if fetch and need_fetch:
1124 self._Fetch(options) 1124 self._Fetch(options)
1125 1125
1126 def _Run(self, args, options, show_header=True, **kwargs): 1126 def _Run(self, args, options, show_header=True, **kwargs):
1127 # Disable 'unused options' warning | pylint: disable=W0613 1127 # Disable 'unused options' warning | pylint: disable=W0613
1128 cwd = kwargs.setdefault('cwd', self.checkout_path) 1128 kwargs.setdefault('cwd', self.checkout_path)
1129 kwargs.setdefault('stdout', self.out_fh) 1129 kwargs.setdefault('stdout', self.out_fh)
1130 kwargs['filter_fn'] = self.filter 1130 kwargs['filter_fn'] = self.filter
1131 kwargs.setdefault('print_stdout', False) 1131 kwargs.setdefault('print_stdout', False)
1132 env = scm.GIT.ApplyEnvVars(kwargs) 1132 env = scm.GIT.ApplyEnvVars(kwargs)
1133 cmd = ['git'] + args 1133 cmd = ['git'] + args
1134 if show_header: 1134 if show_header:
1135 header = "running '%s' in '%s'" % (' '.join(cmd), cwd) 1135 gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs)
1136 self.filter(header) 1136 else:
1137 return gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs) 1137 gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs)
1138 1138
1139 1139
1140 class SVNWrapper(SCMWrapper): 1140 class SVNWrapper(SCMWrapper):
1141 """ Wrapper for SVN """ 1141 """ Wrapper for SVN """
1142 name = 'svn' 1142 name = 'svn'
1143 1143
1144 @staticmethod 1144 @staticmethod
1145 def BinaryExists(): 1145 def BinaryExists():
1146 """Returns true if the command exists.""" 1146 """Returns true if the command exists."""
1147 try: 1147 try:
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 new_command.append('--force') 1599 new_command.append('--force')
1600 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1600 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1601 new_command.extend(('--accept', 'theirs-conflict')) 1601 new_command.extend(('--accept', 'theirs-conflict'))
1602 elif options.manually_grab_svn_rev: 1602 elif options.manually_grab_svn_rev:
1603 new_command.append('--force') 1603 new_command.append('--force')
1604 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1604 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1605 new_command.extend(('--accept', 'postpone')) 1605 new_command.extend(('--accept', 'postpone'))
1606 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1606 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1607 new_command.extend(('--accept', 'postpone')) 1607 new_command.extend(('--accept', 'postpone'))
1608 return new_command 1608 return new_command
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698