Permalink
Browse files

Send messages from the committers address, not the author. Include th…

…e author info in the message. 2nd time's a charm :-)
  • Loading branch information...
1 parent b2940d2 commit 4237a4509722843be66efaca0e826de62c3b007a @gleu gleu committed with dpage Jul 28, 2010
Showing with 22 additions and 9 deletions.
  1. +22 −9 commitmsg.py
View
31 commitmsg.py
@@ -107,33 +107,41 @@ def parse_commit_log(lines):
# Reset our parsing data
commitinfo = ""
+ committerinfo = ""
authorinfo = ""
- dateinfo = ""
+ commitdateinfo = ""
+ authordateinfo = ""
mergeinfo = ""
while True:
l = lines.pop().strip()
if l == "":
break
elif l.startswith("commit "):
commitinfo = l
- elif l.startswith("Author: "):
+ elif l.startswith("Commit: "):
+ committerinfo = l
+ elif l.startswith("CommitDate: "):
+ commitdateinfo = l
+ elif l.startswith("Author: "):
authorinfo = l
- elif l.startswith("Date: "):
- dateinfo = l
- elif l.startswith("Merge: "):
+ elif l.startswith("AuthorDate: "):
+ authordateinfo = l
+ elif l.startswith("Merge: "):
mergeinfo = l
else:
raise Exception("Unknown header line: %s" % l)
- if not (commitinfo or authorinfo or dateinfo):
+ if not (commitinfo or committerinfo or authorinfo or commitdateinfo):
# If none of these existed, we must've hit the end of the log
return False
# Check for any individual piece that is missing
if not commitinfo:
raise Exception("Could not find commit hash!")
+ if not committerinfo:
+ raise Exception("Could not find committer!")
if not authorinfo:
raise Exception("Could not find author!")
- if not dateinfo:
+ if not commitdateinfo:
raise Exception("Could not find commit date!")
commitmsg = []
@@ -174,6 +182,11 @@ def parse_commit_log(lines):
mail.append("-----------")
mail.extend(commitmsg)
mail.append("")
+ if authorinfo[7:].strip() != committerinfo[7:].strip():
+ mail.append("Author")
+ mail.append("------")
+ mail.append(authorinfo[7:].strip())
+ mail.append("")
if len(branches) > 1:
mail.append("Branches")
mail.append("--------")
@@ -189,7 +202,7 @@ def parse_commit_log(lines):
mail.append("")
msg = create_message("\n".join(mail),
- authorinfo[7:],
+ committerinfo[7:],
c.get('commitmsg','subject').replace("$shortmsg",
commitmsg[0][:80-len(c.get('commitmsg','subject'))]))
sendmail(msg)
@@ -292,7 +305,7 @@ def parse_annotated_tag(lines):
"Branch %s was removed" % ref)))
else:
# If both are real object ids, we can call git log on them
- cmd = "git log %s..%s --stat" % (oldobj, newobj)
+ cmd = "git log %s..%s --stat --format=fuller" % (oldobj, newobj)
p = Popen(cmd, shell=True, stdout=PIPE)
lines = p.stdout.readlines()
lines.reverse()

0 comments on commit 4237a45

Please sign in to comment.