Improve GIT.CaptureStatus() to work with incorrectly merged local branches.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3446014
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@59944 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/scm.py b/scm.py
index 5b2c8ea..00364ca 100644
--- a/scm.py
+++ b/scm.py
@@ -92,11 +92,15 @@
results = []
if status:
for statusline in status.splitlines():
- m = re.match('^(\w)\t(.+)$', statusline)
+ # 3-way merges can cause the status can be 'MMM' instead of 'M'. This
+ # can happen when the user has 2 local branches and he diffs between
+ # these 2 branches instead diffing to upstream.
+ m = re.match('^(\w)+\t(.+)$', statusline)
if not m:
raise gclient_utils.Error(
'status currently unsupported: %s' % statusline)
- results.append(('%s ' % m.group(1), m.group(2)))
+ # Only grab the first letter.
+ results.append(('%s ' % m.group(1)[0], m.group(2)))
return results
@staticmethod