Mon, 10 Nov 2014 17:40:26 +0200
- .cset now looks up the appropriate skulltag/zandronum version
mod_hgpoll.py | file | annotate | diff | comparison | revisions |
--- a/mod_hgpoll.py Mon Nov 10 17:22:37 2014 +0200 +++ b/mod_hgpoll.py Mon Nov 10 17:40:26 2014 +0200 @@ -60,16 +60,14 @@ # The sandboxes contain all revisions in zandronum and zandronum-stable. # Thus we only need to try find the revision in the sandbox repos. try: - repo.hg_command ("log", "-r", node, "--template", " ") + data = repo.hg_command ("log", "-r", node, "--template", + "{node|short}@@@@@@@{desc}@@@@@@@{author}@@@@@@@{diffstat}@@@@@@@{date|hgdate}") except hgapi.HgException: bot.privmsg (replyto, 'couldn\'t find changeset %s' % (node)) return try: - data = repo.hg_command ("log", "-r", node, "--template", - "{node|short}@@@@@@@{desc}@@@@@@@{author}@@@@@@@{diffstat}@@@@@@@{date|hgdate}") data = data.split ('@@@@@@@') - node = data[0] message = data[1] author = data[2] @@ -78,6 +76,29 @@ delta = datetime.now() - date datestring = '' + # Find out the Zandronum version of this changeset + repo.hg_command ('revert', '-r', node, 'src/version.h') + zanversion = '<unknown zandronum version>' + + 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: @@ -104,8 +125,8 @@ else: datestring = 'on %s' % (str (date)) - bot.privmsg (replyto, 'changeset %s (%s): committed by %s %s (%s)' % \ - (node, date.strftime ('%y%m%d-%H%M'), author, datestring, diffstat)) + bot.privmsg (replyto, 'changeset %s (%s %s): committed by %s %s (%s)' % \ + (node, zanversion, date.strftime ('%y%m%d-%H%M'), author, datestring, diffstat)) for line in message.split ('\n'): bot.privmsg (replyto, ' ' + line)