mod_hg.py

changeset 117
6c0609395889
parent 116
9e483447654b
child 121
ac07779f788d
equal deleted inserted replaced
116:9e483447654b 117:6c0609395889
13 'name': 'checkhg', 13 'name': 'checkhg',
14 'description': 'Polls the zandronum repositories for updates', 14 'description': 'Polls the zandronum repositories for updates',
15 'args': None, 15 'args': None,
16 'level': 'admin', 16 'level': 'admin',
17 }, 17 },
18
18 { 19 {
19 'name': 'cset', 20 'name': 'cset',
20 'description': 'Yields changeset information (use a hash or date as key)', 21 'description': 'Yields changeset information (use a hash or date as key)',
21 'args': '<key>', 22 'args': '<key>',
22 'level': 'normal', 23 'level': 'normal',
23 }, 24 },
25
24 { 26 {
25 'name': 'hg', 27 'name': 'hg',
26 'description': 'Executes a hg command', 28 'description': 'Executes a hg command',
27 'args': '<repo> <command...>', 29 'args': '<repo> <command...>',
28 'level': 'admin', 30 'level': 'admin',
29 }, 31 },
32
30 { 33 {
31 'name': 'resolves', 34 'name': 'resolves',
32 'description': 'Manually cause a ticket to be resolved by a changeset', 35 'description': 'Manually cause a ticket to be resolved by a changeset',
33 'args': '<ticket> <changeset>', 36 'args': '<ticket> <changeset>',
34 'level': 'admin', 37 'level': 'admin', # TODO
35 }, 38 },
39
40 {
41 'name': 'compress',
42 'description': 'Compresses a head on the sandbox repositories.',
43 'args': '<changeset>',
44 'level': 'admin', # TODO
45 }
36 ] 46 ]
37 } 47 }
38 48
39 def plural (a): 49 def plural (a):
40 return '' if a == 1 else 's' 50 return '' if a == 1 else 's'
168 if result[0]: 178 if result[0]:
169 command_error (result[1]) 179 command_error (result[1])
170 else: 180 else:
171 command_error (`e`) 181 command_error (`e`)
172 182
173 def cmd_hg (bot, args, **rest): 183 def cmd_hg (bot, args, reply, **rest):
174 try: 184 try:
175 repo = hgapi.Repo (args['repo']) 185 repo = hgapi.Repo (args['repo'])
176 result = repo.hg_command (*args['command']) 186 result = repo.hg_command (*args['command'])
177 reply (replyto, result) 187 reply (result)
178 except hgapi.hgapi.HgException as e: 188 except hgapi.hgapi.HgException as e:
179 result = HgPoll.decipher_hgapi_error (e) 189 result = HgPoll.decipher_hgapi_error (e)
180 190
181 if result[0]: 191 if result[0]:
182 command_error (result[1]) 192 command_error (result[1])
183 else: 193 else:
184 command_error (`e`) 194 command_error (`e`)
185 195
186 def cmd_resolves (bot, args, replyto, **rest): 196 def cmd_resolves (bot, args, **rest):
187 try: 197 try:
188 HgPoll.announce_ticket_resolved (args['ticket'], args['changeset']) 198 HgPoll.announce_ticket_resolved (args['ticket'], args['changeset'])
189 except Exception as e: 199 except Exception as e:
190 command_error (str (e)) 200 command_error (str (e))

mercurial