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

Side by Side Diff: gclient_scm.py

Issue 495003: gclient: Don't change directories when checking git version. (Closed)
Patch Set: Created 11 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 | « 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) 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 re 9 import re
10 import subprocess 10 import subprocess
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 self._Run(['diff', '--name-status', merge_base], redirect_stdout=False) 186 self._Run(['diff', '--name-status', merge_base], redirect_stdout=False)
187 files = self._Run(['diff', '--name-only', merge_base]).split() 187 files = self._Run(['diff', '--name-only', merge_base]).split()
188 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 188 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
189 189
190 def _CheckMinVersion(self, min_version): 190 def _CheckMinVersion(self, min_version):
191 def only_int(val): 191 def only_int(val):
192 if val.isdigit(): 192 if val.isdigit():
193 return int(val) 193 return int(val)
194 else: 194 else:
195 return 0 195 return 0
196 version = self._Run(['--version']).split()[-1] 196 version = self._Run(['--version'], cwd='.').split()[-1]
197 version_list = map(only_int, version.split('.')) 197 version_list = map(only_int, version.split('.'))
198 min_version_list = map(int, min_version.split('.')) 198 min_version_list = map(int, min_version.split('.'))
199 for min_ver in min_version_list: 199 for min_ver in min_version_list:
200 ver = version_list.pop(0) 200 ver = version_list.pop(0)
201 if min_ver > ver: 201 if min_ver > ver:
202 raise gclient_utils.Error('git version %s < minimum required %s' % 202 raise gclient_utils.Error('git version %s < minimum required %s' %
203 (version, min_version)) 203 (version, min_version))
204 elif min_ver < ver: 204 elif min_ver < ver:
205 return 205 return
206 206
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 self.ReplaceAndPrint(line) 479 self.ReplaceAndPrint(line)
480 else: 480 else:
481 if (line.startswith(self.original_prefix) or 481 if (line.startswith(self.original_prefix) or
482 line.startswith(self.working_prefix)): 482 line.startswith(self.working_prefix)):
483 self.ReplaceAndPrint(line) 483 self.ReplaceAndPrint(line)
484 else: 484 else:
485 print line 485 print line
486 486
487 filterer = DiffFilterer(self.relpath) 487 filterer = DiffFilterer(self.relpath)
488 self.RunAndFilterOutput(command, path, False, False, filterer.Filter) 488 self.RunAndFilterOutput(command, path, False, False, filterer.Filter)
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