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

Side by Side Diff: gclient_scm.py

Issue 878001: Extract git version check code from gclient_scm.py into scm.py where it belongs. (Closed)
Patch Set: Created 10 years, 9 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 | scm.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) 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 posixpath 9 import posixpath
10 import re 10 import re
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 548
549 print rebase_output.strip() 549 print rebase_output.strip()
550 if rebase_err: 550 if rebase_err:
551 print "Rebase produced error output:\n%s" % rebase_err.strip() 551 print "Rebase produced error output:\n%s" % rebase_err.strip()
552 if not verbose: 552 if not verbose:
553 # Make the output a little prettier. It's nice to have some 553 # Make the output a little prettier. It's nice to have some
554 # whitespace between projects when syncing. 554 # whitespace between projects when syncing.
555 print "" 555 print ""
556 556
557 def _CheckMinVersion(self, min_version): 557 def _CheckMinVersion(self, min_version):
558 def only_int(val): 558 (ok, current_version) = scm.GIT.AssertVersion(min_version)
559 if val.isdigit(): 559 if not ok:
560 return int(val) 560 raise gclient_utils.Error('git version %s < minimum required %s' %
561 else: 561 (current_version, min_version))
562 return 0
563 version = self._Run(['--version'], cwd='.').split()[-1]
564 version_list = map(only_int, version.split('.'))
565 min_version_list = map(int, min_version.split('.'))
566 for min_ver in min_version_list:
567 ver = version_list.pop(0)
568 if min_ver > ver:
569 raise gclient_utils.Error('git version %s < minimum required %s' %
570 (version, min_version))
571 elif min_ver < ver:
572 return
573 562
574 def _GetCurrentBranch(self): 563 def _GetCurrentBranch(self):
575 # Returns name of current branch 564 # Returns name of current branch
576 # Returns None if inside a (no branch) 565 # Returns None if inside a (no branch)
577 tokens = self._Run(['branch']).split() 566 tokens = self._Run(['branch']).split()
578 branch = tokens[tokens.index('*') + 1] 567 branch = tokens[tokens.index('*') + 1]
579 if branch == '(no': 568 if branch == '(no':
580 return None 569 return None
581 return branch 570 return branch
582 571
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " 820 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory "
832 "does not exist." 821 "does not exist."
833 % (' '.join(command), path)) 822 % (' '.join(command), path))
834 # There's no file list to retrieve. 823 # There's no file list to retrieve.
835 else: 824 else:
836 self.RunAndGetFileList(options, command, path, file_list) 825 self.RunAndGetFileList(options, command, path, file_list)
837 826
838 def FullUrlForRelativeUrl(self, url): 827 def FullUrlForRelativeUrl(self, url):
839 # Find the forth '/' and strip from there. A bit hackish. 828 # Find the forth '/' and strip from there. A bit hackish.
840 return '/'.join(self.url.split('/')[:4]) + url 829 return '/'.join(self.url.split('/')[:4]) + url
OLDNEW
« no previous file with comments | « no previous file | scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698