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

Side by Side Diff: gclient_scm.py

Issue 2401483002: Remove gclient cleanup command (Closed)
Patch Set: rebase Created 4 years 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 | « gclient.py ('k') | tests/gclient_smoketest.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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 self.out_fh = out_fh 136 self.out_fh = out_fh
137 self.out_cb = out_cb 137 self.out_cb = out_cb
138 138
139 def Print(self, *args, **kwargs): 139 def Print(self, *args, **kwargs):
140 kwargs.setdefault('file', self.out_fh) 140 kwargs.setdefault('file', self.out_fh)
141 if kwargs.pop('timestamp', True): 141 if kwargs.pop('timestamp', True):
142 self.out_fh.write('[%s] ' % gclient_utils.Elapsed()) 142 self.out_fh.write('[%s] ' % gclient_utils.Elapsed())
143 print(*args, **kwargs) 143 print(*args, **kwargs)
144 144
145 def RunCommand(self, command, options, args, file_list=None): 145 def RunCommand(self, command, options, args, file_list=None):
146 commands = ['cleanup', 'update', 'updatesingle', 'revert', 146 commands = ['update', 'updatesingle', 'revert',
147 'revinfo', 'status', 'diff', 'pack', 'runhooks'] 147 'revinfo', 'status', 'diff', 'pack', 'runhooks']
148 148
149 if not command in commands: 149 if not command in commands:
150 raise gclient_utils.Error('Unknown command %s' % command) 150 raise gclient_utils.Error('Unknown command %s' % command)
151 151
152 if not command in dir(self): 152 if not command in dir(self):
153 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % ( 153 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % (
154 command, self.__class__.__name__)) 154 command, self.__class__.__name__))
155 155
156 return getattr(self, command)(options, args, file_list) 156 return getattr(self, command)(options, args, file_list)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 def GetCheckoutRoot(self): 263 def GetCheckoutRoot(self):
264 return scm.GIT.GetCheckoutRoot(self.checkout_path) 264 return scm.GIT.GetCheckoutRoot(self.checkout_path)
265 265
266 def GetRevisionDate(self, _revision): 266 def GetRevisionDate(self, _revision):
267 """Returns the given revision's date in ISO-8601 format (which contains the 267 """Returns the given revision's date in ISO-8601 format (which contains the
268 time zone).""" 268 time zone)."""
269 # TODO(floitsch): get the time-stamp of the given revision and not just the 269 # TODO(floitsch): get the time-stamp of the given revision and not just the
270 # time-stamp of the currently checked out revision. 270 # time-stamp of the currently checked out revision.
271 return self._Capture(['log', '-n', '1', '--format=%ai']) 271 return self._Capture(['log', '-n', '1', '--format=%ai'])
272 272
273 @staticmethod
274 def cleanup(options, args, file_list):
275 """'Cleanup' the repo.
276
277 There's no real git equivalent for the svn cleanup command, do a no-op.
278 """
279
280 def diff(self, options, _args, _file_list): 273 def diff(self, options, _args, _file_list):
281 try: 274 try:
282 merge_base = [self._Capture(['merge-base', 'HEAD', self.remote])] 275 merge_base = [self._Capture(['merge-base', 'HEAD', self.remote])]
283 except subprocess2.CalledProcessError: 276 except subprocess2.CalledProcessError:
284 merge_base = [] 277 merge_base = []
285 self._Run(['diff'] + merge_base, options) 278 self._Run(['diff'] + merge_base, options)
286 279
287 def pack(self, _options, _args, _file_list): 280 def pack(self, _options, _args, _file_list):
288 """Generates a patch file which can be applied to the root of the 281 """Generates a patch file which can be applied to the root of the
289 repository. 282 repository.
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 kwargs.setdefault('cwd', self.checkout_path) 1159 kwargs.setdefault('cwd', self.checkout_path)
1167 kwargs.setdefault('stdout', self.out_fh) 1160 kwargs.setdefault('stdout', self.out_fh)
1168 kwargs['filter_fn'] = self.filter 1161 kwargs['filter_fn'] = self.filter
1169 kwargs.setdefault('print_stdout', False) 1162 kwargs.setdefault('print_stdout', False)
1170 env = scm.GIT.ApplyEnvVars(kwargs) 1163 env = scm.GIT.ApplyEnvVars(kwargs)
1171 cmd = ['git'] + args 1164 cmd = ['git'] + args
1172 if show_header: 1165 if show_header:
1173 gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs) 1166 gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs)
1174 else: 1167 else:
1175 gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs) 1168 gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs)
OLDNEW
« no previous file with comments | « gclient.py ('k') | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698