[Python-checkins] hooks: a more descriptive subject line for merges

antoine.pitrou python-checkins at python.org
Tue Mar 1 21:29:14 CET 2011


http://hg.python.org/hooks/rev/46c91e36716d
changeset: 42:46c91e36716d
user: Antoine Pitrou <solipsis at pitrou.net>
date: Tue Mar 01 21:29:12 2011 +0100
summary:
 a more descriptive subject line for merges
files:
 mail.py
diff --git a/mail.py b/mail.py
--- a/mail.py
+++ b/mail.py
@@ -58,11 +58,21 @@
 print 'no email address configured'
 return False
 
- branch = ctx.branch()
- if branch == 'default':
- branch_insert = ''
+ if len(parents) == 2:
+ b1, b2, b = parents[0].branch(), parents[1].branch(), ctx.branch()
+ if b in (b1, b2):
+ bp = b2 if b == b1 else b1
+ # normal case
+ branch_insert = ' (merge: %s -> %s)' % (bp, b)
+ else:
+ # XXX really??
+ branch_insert = ' (merge: %s + %s -> %s)' % (b1, b2, b)
 else:
- branch_insert = ' (%s)' % branch
+ branch = ctx.branch()
+ if branch == 'default':
+ branch_insert = ''
+ else:
+ branch_insert = ' (%s)' % branch
 
 desc = ctx.description().splitlines()[0]
 if len(desc) > 80:
@@ -71,8 +81,6 @@
 desc = desc.rsplit(' ', 1)[0]
 
 subj = '%s%s: %s' % (path, branch_insert, desc)
- if len(parents) > 1:
- subj = "merge in " + subj
 
 send(subj, FROM % user, to, '\n'.join(body) + '\n')
 print 'notified %s of incoming changeset %s' % (to, ctx)
-- 
Repository URL: http://hg.python.org/hooks


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /