Mon, 05 Oct 2015 21:55:53 +0300
Update to the calculator
124
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
1 | ''' |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
2 | Copyright 2014-2015 Teemu Piippo |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
3 | All rights reserved. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
4 | |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
5 | Redistribution and use in source and binary forms, with or without |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
6 | modification, are permitted provided that the following conditions |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
7 | are met: |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
8 | |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
9 | 1. Redistributions of source code must retain the above copyright |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
10 | notice, this list of conditions and the following disclaimer. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
11 | 2. Redistributions in binary form must reproduce the above copyright |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
12 | notice, this list of conditions and the following disclaimer in the |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
13 | documentation and/or other materials provided with the distribution. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
14 | 3. The name of the author may not be used to endorse or promote products |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
15 | derived from this software without specific prior written permission. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
16 | |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
18 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
19 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
20 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
22 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
27 | ''' |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
28 | |
146
c17b82b1f573
Mercurial handling major overhaul. Also get some stuff ready for Python 3
Teemu Piippo <tsapii@utu.fi>
parents:
145
diff
changeset
|
29 | from __future__ import print_function |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
30 | from datetime import datetime |
147 | 31 | import hgpoll |
74
9f14fb6995ff
- added a missing import..
Teemu Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
32 | import re |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
33 | import subprocess |
76 | 34 | from configfile import Config |
155
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
35 | import modulecore |
147 | 36 | from hgdb import HgCommitsDatabase |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | |
76 | 38 | def plural (a): |
39 | return '' if a == 1 else 's' | |
40 | ||
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
41 | def is_dateversion (key): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
42 | try: |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
43 | datetime.strptime (key, '%y%m%d-%H%M') |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
44 | return True |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
45 | except ValueError: |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
46 | return False |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
47 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
48 | def resolve_node (node): |
147 | 49 | repo = None |
50 | db = HgCommitsDatabase() | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
51 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
52 | if '/' in node: |
147 | 53 | reponame, node = node.split ('/')[:2] |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
54 | |
147 | 55 | try: |
56 | repo = hgpoll.RepositoriesByName[reponame] | |
57 | except KeyError: | |
155
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
58 | modulecore.command_error ('''unknown repository %s''' % reponame) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | # Possibly we're passed a date version instead. Try find the node for this. |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
61 | if is_dateversion (node): |
147 | 62 | node = db.find_commit_by_dateversion (node) |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
63 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
64 | if node == None: |
155
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
65 | modulecore.command_error ('''couldn't find changeset for date %s''' % node) |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
66 | return |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
67 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
68 | node = node[0:7] |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
69 | |
147 | 70 | noderepos = db.get_commit_repos (node) |
111 | 71 | |
147 | 72 | if repo == None: |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
73 | if not noderepos: |
155
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
74 | modulecore.command_error ('''couldn't find changeset %s''' % node) |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
75 | |
147 | 76 | repo = noderepos[0] |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
77 | |
147 | 78 | return (node, repo) |
111 | 79 | |
151 | 80 | def get_version_string (repo, node): |
145
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
81 | try: |
151 | 82 | data = repo.hg ('cat', '--rev', node, 'src/version.h') |
145
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
83 | |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
84 | regexps = [ \ |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
85 | re.compile (r'#define\s+GAMEVER_STRING\s+"([^"]+)"'), \ |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
86 | re.compile (r'#define\s+DOTVERSIONSTR_NOREV\s+"([^"]+)"'), \ |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
87 | re.compile (r'#define\s+DOTVERSIONSTR\s+"([^"]+)"')] |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
88 | except subprocess.CalledProcessError: |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
89 | try: |
151 | 90 | data = repo.hg ('cat', '--rev', node, 'src/core/versiondefs.h') |
145
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
91 | regexps = [re.compile (r'#define\s+VERSION_STRING\s+"([^"]+)"')] |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
92 | except subprocess.CalledProcessError: |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
93 | return '' |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
94 | |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
95 | for line in data.splitlines(): |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
96 | for rex in regexps: |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
97 | match = rex.match (line) |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
98 | |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
99 | if match: |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
100 | return match.group (1) |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
101 | |
155
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
102 | @modulecore.irc_command (level='admin') |
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
103 | def checkhg (bot, **rest): |
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
104 | '''Polls the zandronum repositories for updates''' |
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
105 | hgpoll.force_poll() |
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
106 | |
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
107 | @modulecore.irc_command (args='<key>') |
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
108 | def cset (bot, args, reply, **rest): |
147 | 109 | node, repo = resolve_node (args['key']) |
152 | 110 | commit = repo.get_commit_data (rev=node, |
111 | node='node|short', | |
112 | message='desc', | |
113 | author='author', | |
114 | diffstat='diffstat', | |
115 | time='date|hgdate', | |
116 | bookmarks='bookmarks', | |
117 | latesttagdistance='latesttagdistance', | |
118 | latesttag='latesttag', | |
119 | email='author|email') | |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
120 | |
147 | 121 | del node |
122 | commit['date'] = datetime.utcfromtimestamp (int (commit['time'].split (' ')[0])) | |
123 | commit['latesttagdistance'] = int (commit['latesttagdistance']) | |
124 | commit['bookmarks'] = hgpoll.prettify_bookmarks (commit['bookmarks']) | |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
125 | |
145
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
126 | # Find out the version string of this changeset |
151 | 127 | versionstring = get_version_string (repo, commit['node']) |
128 | username = Config.find_developer_by_email (commit['email']) | |
111 | 129 | |
147 | 130 | if username: |
131 | commit['author'] = username | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
132 | |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
133 | # Try prettify the diffstat |
147 | 134 | match = re.match (r'^([0-9]+): \+([0-9]+)/-([0-9]+)$', commit['diffstat']) |
111 | 135 | |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
136 | if match: |
147 | 137 | commit['diffstat'] = "%s\003:\0033 +%s\003/\0034-%s\003" % \ |
138 | (match.group (1), match.group (2), match.group (3)) | |
111 | 139 | |
151 | 140 | delta = datetime.utcnow() - commit['date'] |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
141 | if delta.days < 4: |
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
142 | if delta.days == 0: |
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
143 | if delta.seconds < 60: |
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
144 | datestring = 'just now' |
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
145 | elif delta.seconds < 3600: |
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
146 | minutes = delta.seconds / 60 |
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
147 | datestring = '%d minute%s ago' % (minutes, plural (minutes)) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | else: |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
149 | hours = delta.seconds / 3600 |
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
150 | datestring = '%d hour%s ago' % (hours, plural (hours)) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | else: |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
152 | datestring = '%d day%s ago' % (delta.days, plural (delta.days)) |
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
153 | else: |
147 | 154 | datestring = 'on %s' % (str (commit['date'])) |
112 | 155 | |
147 | 156 | if commit['latesttagdistance'] != 0: |
145
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
157 | versionblurb = "" |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
158 | |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
159 | if versionstring: |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
160 | versionblurb = versionstring + ' ' |
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
161 | |
151 | 162 | versionblurb += '%s, %d hops from %s' % (commit['date'].strftime ('%y%m%d-%H%M'), |
163 | commit['latesttagdistance'], commit['latesttag']) | |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
164 | else: |
145
588aff83bb87
- Encode messages in the hgpoll module so that joining them won't result in an error if they cannot be coded to ascii
Teemu Piippo <crimsondusk64@gmail.com>
parents:
144
diff
changeset
|
165 | versionblurb = latesttag |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
117
diff
changeset
|
166 | |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
167 | reply ('changeset\0035 %s%s\003 (%s)\003: committed by\0032 %s\003 %s,\0032 %s' % \ |
147 | 168 | (commit['node'], commit['bookmarks'], versionblurb, commit['author'], datestring, |
169 | commit['diffstat'])) | |
111 | 170 | |
151 | 171 | for line in commit['message'].split ('\n'): |
144
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
172 | reply (' ' + line) |
b3d1b356e544
- Remove hgapi dependence
Teemu Piippo <crimsondusk64@gmail.com>
parents:
132
diff
changeset
|
173 | |
147 | 174 | reply ('url: %s/commits/%s' % (repo.url, commit['node'])) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | |
155
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
176 | @modulecore.irc_command (args='<ticket> <changeset>', level='admin') |
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
177 | def resolves (bot, args, **rest): |
5a9b5065f53f
Remove more manifests
Teemu Piippo <crimsondusk64@gmail.com>
parents:
152
diff
changeset
|
178 | hgpoll.announce_ticket_resolved (args['ticket'], args['changeset'], HgCommitsDatabase()) |