Make my_activity.py robust to log parsing problems
If (hypothetically) you pointed your WebKit repo environment variable to
Blink and not WebKit, then the change_re will not find anything in the
log and the script will explode on changes[0] because changes=[].
Fix this by being robust to not being able to parse anything out of the
log in process_git_commits.
R=szager@chromium.org
BUG=none
Review URL: https://chromiumcodereview.appspot.com/16258010
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@205290 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/my_activity.py b/my_activity.py
index ac68a23..4883cdf 100755
--- a/my_activity.py
+++ b/my_activity.py
@@ -573,7 +573,9 @@
output = self.git_cmd(repo, 'log', commit + "^!", "--format=%cn%n%cd%n%B")
author = output[0]
date = datetime.strptime(output[1], "%a %b %d %H:%M:%S %Y +0000")
- ret.append(self.process_git_commit(instance, author, date, output[2:]))
+ processed = self.process_git_commit(instance, author, date, output[2:])
+ if processed:
+ ret.append(processed)
ret = sorted(ret, key=lambda i: i['modified'], reverse=True)
return ret
@@ -614,8 +616,11 @@
url = 'http://%s/%d' % (instance['review_url'], reviews[0])
if instance['review_prop']:
ret[instance['review_prop']] = reviews[0]
- else:
+ elif len(changes) == 1:
url = 'http://%s/%d' % (instance['change_url'], changes[0])
+ else:
+ # Couldn't find anything.
+ return None
ret['review_url'] = url
return ret