| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if not files: | 85 if not files: |
| 86 pass | 86 pass |
| 87 elif isinstance(files, basestring): | 87 elif isinstance(files, basestring): |
| 88 command.append(files) | 88 command.append(files) |
| 89 else: | 89 else: |
| 90 command.extend(files) | 90 command.extend(files) |
| 91 status = GIT.Capture(command).rstrip() | 91 status = GIT.Capture(command).rstrip() |
| 92 results = [] | 92 results = [] |
| 93 if status: | 93 if status: |
| 94 for statusline in status.splitlines(): | 94 for statusline in status.splitlines(): |
| 95 m = re.match('^(\w)\t(.+)$', statusline) | 95 # 3-way merges can cause the status can be 'MMM' instead of 'M'. This |
| 96 # can happen when the user has 2 local branches and he diffs between |
| 97 # these 2 branches instead diffing to upstream. |
| 98 m = re.match('^(\w)+\t(.+)$', statusline) |
| 96 if not m: | 99 if not m: |
| 97 raise gclient_utils.Error( | 100 raise gclient_utils.Error( |
| 98 'status currently unsupported: %s' % statusline) | 101 'status currently unsupported: %s' % statusline) |
| 99 results.append(('%s ' % m.group(1), m.group(2))) | 102 # Only grab the first letter. |
| 103 results.append(('%s ' % m.group(1)[0], m.group(2))) |
| 100 return results | 104 return results |
| 101 | 105 |
| 102 @staticmethod | 106 @staticmethod |
| 103 def GetEmail(cwd): | 107 def GetEmail(cwd): |
| 104 """Retrieves the user email address if known.""" | 108 """Retrieves the user email address if known.""" |
| 105 # We could want to look at the svn cred when it has a svn remote but it | 109 # We could want to look at the svn cred when it has a svn remote but it |
| 106 # should be fine for now, users should simply configure their git settings. | 110 # should be fine for now, users should simply configure their git settings. |
| 107 try: | 111 try: |
| 108 return GIT.Capture(['config', 'user.email'], cwd=cwd).strip() | 112 return GIT.Capture(['config', 'user.email'], cwd=cwd).strip() |
| 109 except gclient_utils.CheckCallError: | 113 except gclient_utils.CheckCallError: |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 if not SVN.current_version: | 817 if not SVN.current_version: |
| 814 SVN.current_version = SVN.Capture(['--version']).split()[2] | 818 SVN.current_version = SVN.Capture(['--version']).split()[2] |
| 815 current_version_list = map(only_int, SVN.current_version.split('.')) | 819 current_version_list = map(only_int, SVN.current_version.split('.')) |
| 816 for min_ver in map(int, min_version.split('.')): | 820 for min_ver in map(int, min_version.split('.')): |
| 817 ver = current_version_list.pop(0) | 821 ver = current_version_list.pop(0) |
| 818 if ver < min_ver: | 822 if ver < min_ver: |
| 819 return (False, SVN.current_version) | 823 return (False, SVN.current_version) |
| 820 elif ver > min_ver: | 824 elif ver > min_ver: |
| 821 return (True, SVN.current_version) | 825 return (True, SVN.current_version) |
| 822 return (True, SVN.current_version) | 826 return (True, SVN.current_version) |
| OLD | NEW |