| OLD | NEW |
| 1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-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 """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 os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 """Returns the list of modified files between two branches.""" | 303 """Returns the list of modified files between two branches.""" |
| 304 if not branch: | 304 if not branch: |
| 305 branch = GIT.GetUpstreamBranch(cwd) | 305 branch = GIT.GetUpstreamBranch(cwd) |
| 306 command = ['diff', '--name-only', branch + "..." + branch_head] | 306 command = ['diff', '--name-only', branch + "..." + branch_head] |
| 307 return GIT.Capture(command, cwd)[0].splitlines(False) | 307 return GIT.Capture(command, cwd)[0].splitlines(False) |
| 308 | 308 |
| 309 @staticmethod | 309 @staticmethod |
| 310 def GetPatchName(cwd): | 310 def GetPatchName(cwd): |
| 311 """Constructs a name for this patch.""" | 311 """Constructs a name for this patch.""" |
| 312 short_sha = GIT.Capture(['rev-parse', '--short=4', 'HEAD'], cwd)[0].strip() | 312 short_sha = GIT.Capture(['rev-parse', '--short=4', 'HEAD'], cwd)[0].strip() |
| 313 return "%s-%s" % (GIT.GetBranch(cwd), short_sha) | 313 return "%s#%s" % (GIT.GetBranch(cwd), short_sha) |
| 314 | 314 |
| 315 @staticmethod | 315 @staticmethod |
| 316 def GetCheckoutRoot(path): | 316 def GetCheckoutRoot(path): |
| 317 """Returns the top level directory of a git checkout as an absolute path. | 317 """Returns the top level directory of a git checkout as an absolute path. |
| 318 """ | 318 """ |
| 319 root = GIT.Capture(['rev-parse', '--show-cdup'], path)[0].strip() | 319 root = GIT.Capture(['rev-parse', '--show-cdup'], path)[0].strip() |
| 320 return os.path.abspath(os.path.join(path, root)) | 320 return os.path.abspath(os.path.join(path, root)) |
| 321 | 321 |
| 322 @staticmethod | 322 @staticmethod |
| 323 def AssertVersion(min_version): | 323 def AssertVersion(min_version): |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 if not SVN.current_version: | 940 if not SVN.current_version: |
| 941 SVN.current_version = SVN.Capture(['--version']).split()[2] | 941 SVN.current_version = SVN.Capture(['--version']).split()[2] |
| 942 current_version_list = map(only_int, SVN.current_version.split('.')) | 942 current_version_list = map(only_int, SVN.current_version.split('.')) |
| 943 for min_ver in map(int, min_version.split('.')): | 943 for min_ver in map(int, min_version.split('.')): |
| 944 ver = current_version_list.pop(0) | 944 ver = current_version_list.pop(0) |
| 945 if ver < min_ver: | 945 if ver < min_ver: |
| 946 return (False, SVN.current_version) | 946 return (False, SVN.current_version) |
| 947 elif ver > min_ver: | 947 elif ver > min_ver: |
| 948 return (True, SVN.current_version) | 948 return (True, SVN.current_version) |
| 949 return (True, SVN.current_version) | 949 return (True, SVN.current_version) |
| OLD | NEW |