summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorOrgad Shaneh <orgads@gmail.com>2013-04-11 13:41:20 +0300
committerOrgad Shaneh <orgads@gmail.com>2013-04-11 13:41:48 +0300
commitf18e1e0d2f2d03d62f44fc548bafda188db52450 (patch)
treeb12c2a99832a04427b0a1ae9335160e811e00ab2 /contrib
parenteecfa12b271ba1acaff41b2f333b5e7f61daa616 (diff)
TrivialRebase: Correctly handle empty patch-id
If only one of the patch-ids is empty, it should not be considered a trivial rebase Change-Id: Ie5196bc81d4d3bcdd16572ade265f96c086fabed
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/trivial_rebase.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/contrib/trivial_rebase.py b/contrib/trivial_rebase.py
index 3e77c4c9cf..475e20e45b 100755
--- a/contrib/trivial_rebase.py
+++ b/contrib/trivial_rebase.py
@@ -152,7 +152,8 @@ class TrivialRebase:
git_show_process = subprocess.Popen(git_show_cmd, stdout=subprocess.PIPE)
patch_id_process = subprocess.Popen(patch_id_cmd, stdout=subprocess.PIPE,
stdin=git_show_process.stdout)
- return patch_id_process.communicate()[0]
+ res = patch_id_process.communicate()[0] or '0'
+ return res.split()[0]
def SuExec(self, as_user, cmd):
suexec_cmd = [self.ssh, '-l', "Gerrit Code Review", self.ssh_port_flag, self.port, self.server]
@@ -180,14 +181,10 @@ class TrivialRebase:
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):
- # Merge commit
- if not prev_patch_id:
- print "GetPatchId failed for commit %s" % (prev_revision)
- if not cur_patch_id:
- print "GetPatchId failed for commit %s" % (self.commit)
+ if prev_patch_id == '0' and cur_patch_id == '0':
+ print "commits %s and %s are both empty or merge commits" % (prev_revision, self.commit)
return
- if cur_patch_id.split()[0] != prev_patch_id.split()[0]:
+ if cur_patch_id != prev_patch_id:
# patch-ids don't match
return
# Patch ids match. This is a trivial rebase.