summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorOrgad Shaneh <orgads@gmail.com>2013-04-10 06:01:52 +0300
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-04-11 07:21:35 +0000
commita17f23c525f017944c577a56a47dfc06b768254a (patch)
treec807b4d69e9f17a6dbf9dc4ef7b81cbd9fb68e87 /contrib
parentd6c0f81a40407dc97ef831652adb8d183201d6b7 (diff)
TrivialRebase: Raise exception on error
If previous revision is not found for patchsets greater than 1 Change-Id: Ifb8b16d5be7c984a5a01773320786b56cc3b9e33
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/trivial_rebase.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/trivial_rebase.py b/contrib/trivial_rebase.py
index 804f2b951a..80b96288be 100755
--- a/contrib/trivial_rebase.py
+++ b/contrib/trivial_rebase.py
@@ -38,6 +38,7 @@ import argparse
import json
import re
import subprocess
+import sys
class TrivialRebase:
def __init__(self):
@@ -167,9 +168,7 @@ class TrivialRebase:
# Nothing to detect on first patchset
return
prev_revision = self.FindPrevRev()
- if not prev_revision:
- # Couldn't find a previous revision
- return
+ assert prev_revision, "Previous revision not found"
prev_patch_id = self.GetPatchId(prev_revision)
cur_patch_id = self.GetPatchId(self.commit)
if not (prev_patch_id and cur_patch_id):
@@ -226,4 +225,7 @@ class TrivialRebase:
self.SuExec(email_addr, ' '.join(gerrit_approve_cmd))
if __name__ == "__main__":
- TrivialRebase().Run()
+ try:
+ TrivialRebase().Run()
+ except AssertionError, e:
+ print >> sys.stderr, e