diff -r 44d9aea72947 -r cdafc1a0544e mod_hgpoll.py --- a/mod_hgpoll.py Mon Dec 08 23:27:43 2014 +0200 +++ b/mod_hgpoll.py Wed Dec 31 10:27:57 2014 -0500 @@ -66,13 +66,15 @@ # 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", + data = repo.hg_command ("log", "-l1", "-r", node, "--template", "{node|short}@@@@@@@" + "{desc}@@@@@@@" + "{author}@@@@@@@" + "{diffstat}@@@@@@@" + "{date|hgdate}@@@@@@@" + - "{bookmarks}") + "{bookmarks}@@@@@@@" + + "{latesttagdistance}@@@@@@@" + + "{latesttag}") except hgapi.HgException: bot.privmsg (replyto, 'couldn\'t find changeset %s' % (node)) return @@ -85,6 +87,8 @@ diffstat = data[3] date = datetime.utcfromtimestamp (int (data[4].split (' ')[0])) bookmarks = data[5] + latesttagdistance = int( data[6] ) + latesttag = data[7] delta = datetime.utcnow() - date datestring = '' @@ -147,8 +151,14 @@ else: datestring = 'on %s' % (str (date)) - 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)) + versionstring = "" + if latesttagdistance != 0: + versionstring = '%s %s, %d hops from %s' % (zanversion, date.strftime ('%y%m%d-%H%M'), latesttagdistance, latesttag) + else: + versionstring = latesttag + + bot.privmsg (replyto, 'changeset\0035 %s%s\003 (%s)\003: committed by\0032 %s\003 %s,\0032 %s' % \ + (node, bookmarks, versionstring, author, datestring, diffstat)) for line in message.split ('\n'): bot.privmsg (replyto, ' ' + line)