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

Side by Side Diff: gclient_scm.py

Issue 486036: gclient: fix git version check to handle 1.6.5.2.5.g7c3ba.dirty (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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if not os.path.isdir(self.checkout_path): 181 if not os.path.isdir(self.checkout_path):
182 print('\n________ couldn\'t run status in %s:\nThe directory ' 182 print('\n________ couldn\'t run status in %s:\nThe directory '
183 'does not exist.' % self.checkout_path) 183 'does not exist.' % self.checkout_path)
184 else: 184 else:
185 merge_base = self._Run(['merge-base', 'HEAD', 'origin']) 185 merge_base = self._Run(['merge-base', 'HEAD', 'origin'])
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):
192 if val.isdigit():
193 return int(val)
194 else:
195 return 0
191 version = self._Run(['--version']).split()[-1] 196 version = self._Run(['--version']).split()[-1]
192 version_list = map(int, version.split('.')) 197 version_list = map(only_int, version.split('.'))
193 min_version_list = map(int, min_version.split('.')) 198 min_version_list = map(int, min_version.split('.'))
194 for min_ver in min_version_list: 199 for min_ver in min_version_list:
195 ver = version_list.pop(0) 200 ver = version_list.pop(0)
196 if min_ver > ver: 201 if min_ver > ver:
197 raise gclient_utils.Error('git version %s < minimum required %s' % 202 raise gclient_utils.Error('git version %s < minimum required %s' %
198 (version, min_version)) 203 (version, min_version))
199 elif min_ver < ver: 204 elif min_ver < ver:
200 return 205 return
201 206
202 def _Run(self, args, cwd=None, checkrc=True, redirect_stdout=True): 207 def _Run(self, args, cwd=None, checkrc=True, redirect_stdout=True):
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 self.ReplaceAndPrint(line) 479 self.ReplaceAndPrint(line)
475 else: 480 else:
476 if (line.startswith(self.original_prefix) or 481 if (line.startswith(self.original_prefix) or
477 line.startswith(self.working_prefix)): 482 line.startswith(self.working_prefix)):
478 self.ReplaceAndPrint(line) 483 self.ReplaceAndPrint(line)
479 else: 484 else:
480 print line 485 print line
481 486
482 filterer = DiffFilterer(self.relpath) 487 filterer = DiffFilterer(self.relpath)
483 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