Tue, 11 Aug 2015 19:12:30 +0300
Yet more fixes
hgpoll.py | file | annotate | diff | comparison | revisions | |
hgrepo.py | file | annotate | diff | comparison | revisions | |
mod_hg.py | file | annotate | diff | comparison | revisions |
--- a/hgpoll.py Sat Aug 08 14:21:51 2015 +0300 +++ b/hgpoll.py Tue Aug 11 19:12:30 2015 +0300 @@ -163,8 +163,8 @@ need_update = True # Set target version if not set - if not 'target_version' in ticket_data: - ticket_data['target_version'] = repoinfo.get_value ('version') + if repo.version and not 'target_version' in ticket_data: + ticket_data['target_version'] = repo.version need_update = True # Announce on IRC
--- a/hgrepo.py Sat Aug 08 14:21:51 2015 +0300 +++ b/hgrepo.py Tue Aug 11 19:12:30 2015 +0300 @@ -43,6 +43,7 @@ self.name = reponame self.published = not bool (repoinfo.get_value ('extrarepo', default=False)) self.url = repoinfo.get_value ('url') + self.version = repoinfo.get_value ('version', default='') self.color = int (repoinfo.get_value ('colorcode', default=0)) if not self.url:
--- a/mod_hg.py Sat Aug 08 14:21:51 2015 +0300 +++ b/mod_hg.py Tue Aug 11 19:12:30 2015 +0300 @@ -113,10 +113,9 @@ return (node, repo) -def get_version_string (reponame, node): +def get_version_string (repo, node): try: - data = subprocess.check_output (['hg', '--cwd', reponame, 'cat', - '--rev', node, 'src/version.h']) + data = repo.hg ('cat', '--rev', node, 'src/version.h') regexps = [ \ re.compile (r'#define\s+GAMEVER_STRING\s+"([^"]+)"'), \ @@ -124,8 +123,7 @@ re.compile (r'#define\s+DOTVERSIONSTR\s+"([^"]+)"')] except subprocess.CalledProcessError: try: - data = subprocess.check_output (['hg', '--cwd', reponame, 'cat', - '--rev', node, 'src/core/versiondefs.h']) + data = repo.hg ('cat', '--rev', node, 'src/core/versiondefs.h') regexps = [re.compile (r'#define\s+VERSION_STRING\s+"([^"]+)"')] except subprocess.CalledProcessError: return '' @@ -138,11 +136,10 @@ return match.group (1) def cmd_cset (bot, args, reply, **rest): - data = "" node, repo = resolve_node (args['key']) try: - data = repo.get_commit_data (rev=node, + commit = repo.get_commit_data (rev=node, node='node|short', message='desc', author='author', @@ -153,7 +150,7 @@ latesttag='latesttag', email='author|email') except Subprocess.CalledProcessError: - command_error ('''couldn't find changeset %s in %s''' % (node, reponame)) + command_error ('''couldn't find changeset %s in %s''' % (node, repo.name)) del node commit['date'] = datetime.utcfromtimestamp (int (commit['time'].split (' ')[0])) @@ -161,8 +158,8 @@ commit['bookmarks'] = hgpoll.prettify_bookmarks (commit['bookmarks']) # Find out the version string of this changeset - versionstring = get_version_string (reponame, commit['node']) - username = Config.find_developer_by_email (email) + versionstring = get_version_string (repo, commit['node']) + username = Config.find_developer_by_email (commit['email']) if username: commit['author'] = username @@ -174,7 +171,7 @@ commit['diffstat'] = "%s\003:\0033 +%s\003/\0034-%s\003" % \ (match.group (1), match.group (2), match.group (3)) - delta = datetime.utcnow() - date + delta = datetime.utcnow() - commit['date'] if delta.days < 4: if delta.days == 0: if delta.seconds < 60: @@ -196,8 +193,8 @@ if versionstring: versionblurb = versionstring + ' ' - versionblurb += '%s, %d hops from %s' % (date.strftime ('%y%m%d-%H%M'), - latesttagdistance, latesttag) + versionblurb += '%s, %d hops from %s' % (commit['date'].strftime ('%y%m%d-%H%M'), + commit['latesttagdistance'], commit['latesttag']) else: versionblurb = latesttag @@ -205,7 +202,7 @@ (commit['node'], commit['bookmarks'], versionblurb, commit['author'], datestring, commit['diffstat'])) - for line in message.split ('\n'): + for line in commit['message'].split ('\n'): reply (' ' + line) reply ('url: %s/commits/%s' % (repo.url, commit['node']))