diff -r b2770c43b752 -r 44d9aea72947 mod_hgpoll.py --- a/mod_hgpoll.py Mon Dec 08 16:12:51 2014 -0500 +++ b/mod_hgpoll.py Mon Dec 08 23:27:43 2014 +0200 @@ -51,7 +51,7 @@ datetime.strptime (args['key'], '%y%m%d-%H%M') HgPoll.make_commits_txt() commits_txt = open ('commits.txt', 'r') - + for line in commits_txt: data = line.replace ('\n', '').split (' ') if data[1] == args['key']: @@ -62,16 +62,21 @@ return except ValueError: pass - + # The sandboxes contain all revisions in zandronum and zandronum-stable. # Thus we only need to try find the revision in the sandbox repos. try: data = repo.hg_command ("log", "-r", node, "--template", - "{node|short}@@@@@@@{desc}@@@@@@@{author}@@@@@@@{diffstat}@@@@@@@{date|hgdate}") + "{node|short}@@@@@@@" + + "{desc}@@@@@@@" + + "{author}@@@@@@@" + + "{diffstat}@@@@@@@" + + "{date|hgdate}@@@@@@@" + + "{bookmarks}") except hgapi.HgException: bot.privmsg (replyto, 'couldn\'t find changeset %s' % (node)) return - + try: data = data.split ('@@@@@@@') node = data[0] @@ -79,40 +84,44 @@ author = data[2] diffstat = data[3] date = datetime.utcfromtimestamp (int (data[4].split (' ')[0])) + bookmarks = data[5] delta = datetime.utcnow() - date datestring = '' - + + if bookmarks: + bookmarks = HgPoll.prettify_bookmarks (bookmarks) + # Find out the Zandronum version of this changeset repo.hg_command ('revert', '-r', node, 'src/version.h') zanversion = '' - + with open ('zandronum-everything/src/version.h') as version_file: regexps = [ \ re.compile (r'#define\s+GAMEVER_STRING\s+"([^"]+)"'), \ re.compile (r'#define\s+DOTVERSIONSTR_NOREV\s+"([^"]+)"'), \ re.compile (r'#define\s+DOTVERSIONSTR\s+"([^"]+)"')] - + for line in version_file: for rex in regexps: match = rex.match (line) if match != None: zanversion = match.group (1) break - + if match != None: break - - + + repo.hg_command ('revert', '--all') - + # Remove the email address from the author if possible match = re.compile (r'^(.+) <([^>]+)>$.*').match (author) if match: author = match.group (1) email = match.group (2) - + username = Config.find_developer_by_email (email) - + if username != '': author = username @@ -137,15 +146,15 @@ datestring = '%d day%s ago' % (delta.days, plural (delta.days)) else: datestring = 'on %s' % (str (date)) - - bot.privmsg (replyto, 'changeset\0035 %s (%s %s)\003: committed by\0032 %s\003 %s,\0032 %s' % \ - (node, zanversion, date.strftime ('%y%m%d-%H%M'), author, datestring, diffstat)) - + + bot.privmsg (replyto, 'changeset\0035 %s%s\003 (%s %s)\003: committed by\0032 %s\003 %s,\0032 %s' % \ + (node, bookmarks, zanversion, date.strftime ('%y%m%d-%H%M'), author, datestring, diffstat)) + for line in message.split ('\n'): bot.privmsg (replyto, ' ' + line) except hgapi.HgException as e: result = HgPoll.decipher_hgapi_error (e) - + if result[0]: bot.privmsg (replyto, 'error: %s' % result[1]) else: @@ -158,7 +167,7 @@ self.privmsg (replyto, result) except hgapi.hgapi.HgException as e: result = HgPoll.decipher_hgapi_error (e) - + if result[0]: self.privmsg (replyto, 'error: %s' % result[1]) else: