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

Side by Side Diff: scm.py

Issue 10693008: Fix skipping update for git dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« 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) 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 """SCM-specific utility classes.""" 5 """SCM-specific utility classes."""
6 6
7 import cStringIO 7 import cStringIO
8 import glob 8 import glob
9 import logging 9 import logging
10 import os 10 import os
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 try: 398 try:
399 lines = GIT.Capture( 399 lines = GIT.Capture(
400 ['svn', 'find-rev', 'r' + str(rev)], cwd=cwd).splitlines() 400 ['svn', 'find-rev', 'r' + str(rev)], cwd=cwd).splitlines()
401 return lines[-1].strip() if lines else None 401 return lines[-1].strip() if lines else None
402 except subprocess2.CalledProcessError: 402 except subprocess2.CalledProcessError:
403 return None 403 return None
404 404
405 @staticmethod 405 @staticmethod
406 def IsValidRevision(cwd, rev): 406 def IsValidRevision(cwd, rev):
407 """Verifies the revision is a proper git revision.""" 407 """Verifies the revision is a proper git revision."""
408 # 'git rev-parse foo' where foo is *any* 40 character hex string will return
409 # the string and return code 0. So strip one character to force 'git
410 # rev-parse' to do a hash table look-up and returns 128 if the hash is not
411 # present.
412 if re.match(r'^[0-9a-fA-F]{40}$', rev):
413 rev = rev[:-1]
408 try: 414 try:
409 GIT.Capture(['rev-parse', rev], cwd=cwd) 415 GIT.Capture(['rev-parse', rev], cwd=cwd)
410 return True 416 return True
411 except subprocess2.CalledProcessError: 417 except subprocess2.CalledProcessError:
412 return False 418 return False
413 419
414 @classmethod 420 @classmethod
415 def AssertVersion(cls, min_version): 421 def AssertVersion(cls, min_version):
416 """Asserts git's version is at least min_version.""" 422 """Asserts git's version is at least min_version."""
417 if cls.current_version is None: 423 if cls.current_version is None:
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 # revert, like for properties. 1063 # revert, like for properties.
1058 if not os.path.isdir(cwd): 1064 if not os.path.isdir(cwd):
1059 # '.' was deleted. It's not worth continuing. 1065 # '.' was deleted. It's not worth continuing.
1060 return 1066 return
1061 try: 1067 try:
1062 SVN.Capture(['revert', file_status[1]], cwd=cwd) 1068 SVN.Capture(['revert', file_status[1]], cwd=cwd)
1063 except subprocess2.CalledProcessError: 1069 except subprocess2.CalledProcessError:
1064 if not os.path.exists(file_path): 1070 if not os.path.exists(file_path):
1065 continue 1071 continue
1066 raise 1072 raise
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