340 # Acquire additional data |
340 # Acquire additional data |
341 moredata = get_commit_data (zanrepo, commit_node, |
341 moredata = get_commit_data (zanrepo, commit_node, |
342 '{author|nonempty}\n{date(date, \'%A %d %B %Y %T\')}\n{diffstat|nonempty}').split('\n') |
342 '{author|nonempty}\n{date(date, \'%A %d %B %Y %T\')}\n{diffstat|nonempty}').split('\n') |
343 |
343 |
344 if len (moredata) != 3: |
344 if len (moredata) != 3: |
345 raise logical_exception ('malformed hg data') |
345 chanlog ('error while processing %s: malformed hg data' % commit_node) |
|
346 continue |
346 #fi |
347 #fi |
347 |
348 |
348 commit_author = moredata[0] |
349 commit_author = moredata[0] |
349 commit_date = moredata[1] |
350 commit_date = moredata[1] |
350 commit_diffstat = moredata[2] |
351 commit_diffstat = moredata[2] |
352 |
353 |
353 try: |
354 try: |
354 ticket_data = suds_client.service.mc_issue_get (g_config['trackeruser'], |
355 ticket_data = suds_client.service.mc_issue_get (g_config['trackeruser'], |
355 g_config['trackerpassword'], ticket_id) |
356 g_config['trackerpassword'], ticket_id) |
356 except Exception as e: |
357 except Exception as e: |
357 raise logical_exception ('%s' % `e`) |
358 chanlog ('error while processing %s: %s' % (commit_node, `e`)) |
358 continue |
359 continue |
359 #tried |
360 #tried |
360 |
361 |
361 # Remove the email address from the author if possible |
362 # Remove the email address from the author if possible |
362 rex = re.compile (r'^(.+) <([^>]+)>$.*') |
363 rex = re.compile (r'^(.+) <([^>]+)>$.*') |
981 self.privmsg (replyto, "couldn't find a definition of \002%s\002" % args[0]) |
982 self.privmsg (replyto, "couldn't find a definition of \002%s\002" % args[0]) |
982 except logical_exception as e: |
983 except logical_exception as e: |
983 raise e |
984 raise e |
984 except Exception as e: |
985 except Exception as e: |
985 raise logical_exception ('Urban dictionary lookup failed: %s' % `e`) |
986 raise logical_exception ('Urban dictionary lookup failed: %s' % `e`) |
|
987 elif command == 'hg': |
|
988 check_admin (sender, ident, host, command) |
|
989 |
|
990 if len(args) < 2: |
|
991 raise logical_exception ('usage: %s <repo> <command...>' % command) |
|
992 |
|
993 try: |
|
994 repo = hgapi.Repo (args[0]) |
|
995 result = repo.hg_command (*args[1:]) |
|
996 self.privmsg (replyto, result) |
|
997 except hgapi.hgapi.HgException as e: |
|
998 try: |
|
999 # Blah, hgapi, why must your error messages be so hard to decipher? |
|
1000 rawmsg = e.message.replace('\n', '').replace('" +','').replace('\t','') |
|
1001 errmsg = re.compile (r'.*\btErr: (.+)Out:').match (errmsg).group (1) |
|
1002 self.privmsg (replyto, 'error: %s' % errmsg) |
|
1003 except: |
|
1004 self.privmsg (replyto, 'error (unable to decipher error message)') |
|
1005 #tried |
|
1006 #tried |
986 # else: |
1007 # else: |
987 # raiee logical_exception ("unknown command `.%s`" % command) |
1008 # raiee logical_exception ("unknown command `.%s`" % command) |
988 |
1009 |
989 # |
1010 # |
990 # Print a ticket announce to appropriate channels |
1011 # Print a ticket announce to appropriate channels |