Skip to content

Commit

Permalink
github-merge: warn if merge message contains an @
Browse files Browse the repository at this point in the history
  • Loading branch information
fanquake committed Aug 25, 2019
1 parent bfda7f3 commit b2e1a81
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions github-merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def make_acks_message(head_commit, acks):
ack_str ='\n\nTop commit has no ACKs.\n'
return ack_str

def print_merge_details(pull, title, branch, base_branch, head_branch, acks):
def print_merge_details(pull, title, branch, base_branch, head_branch, acks, message):
print('%s#%s%s %s %sinto %s%s' % (ATTR_RESET+ATTR_PR,pull,ATTR_RESET,title,ATTR_RESET+ATTR_PR,branch,ATTR_RESET))
subprocess.check_call([GIT,'log','--graph','--topo-order','--pretty=format:'+COMMIT_FORMAT,base_branch+'..'+head_branch])
if acks is not None:
Expand All @@ -198,6 +198,9 @@ def print_merge_details(pull, title, branch, base_branch, head_branch, acks):
print('* {} {}({}){}'.format(message, ATTR_NAME, name, ATTR_RESET))
else:
print('{}Top commit has no ACKs!{}'.format(ATTR_WARN, ATTR_RESET))
if message is not None:
if '@' in message:
print('{}Merge message contains an @!{}'.format(ATTR_WARN, ATTR_RESET))

def parse_arguments():
epilog = '''
Expand Down Expand Up @@ -326,7 +329,7 @@ def main():
print("ERROR: Unable to compute tree hash")
sys.exit(4)

print_merge_details(pull, title, branch, base_branch, head_branch, None)
print_merge_details(pull, title, branch, base_branch, head_branch, acks=None, message=None)
print()

# Run test command if configured.
Expand Down Expand Up @@ -376,7 +379,7 @@ def main():
sys.exit(4)

# Sign the merge commit.
print_merge_details(pull, title, branch, base_branch, head_branch, acks)
print_merge_details(pull, title, branch, base_branch, head_branch, acks, message)
while True:
reply = ask_prompt("Type 's' to sign off on the above merge, or 'x' to reject and exit.").lower()
if reply == 's':
Expand Down

0 comments on commit b2e1a81

Please sign in to comment.