245 |
245 |
246 repocheck_timeout = {'zandronum':(time.time()) + 15, 'zandronum-stable':(time.time() + 15)} |
246 repocheck_timeout = {'zandronum':(time.time()) + 15, 'zandronum-stable':(time.time() + 15)} |
247 |
247 |
248 ' Retrieves and processes commits for zandronum repositories ' |
248 ' Retrieves and processes commits for zandronum repositories ' |
249 ' Ensure both repositories are OK before using this! ' |
249 ' Ensure both repositories are OK before using this! ' |
250 def process_zan_repo_updates (usestable): |
250 def process_zan_repo_updates (repo_name): |
251 global repocheck_timeout |
251 global repocheck_timeout |
252 global suds_client |
252 global suds_client |
253 global g_config |
253 global g_config |
254 global g_clients |
254 global g_clients |
255 |
255 |
256 repo_name = 'zandronum' if usestable == False else 'zandronum-stable' |
256 usestable = repo_name == 'zandronum-stable' |
257 repo_url = 'https://bitbucket.org/Torr_Samaho/' + repo_name |
257 repo_url = 'https://bitbucket.org/Torr_Samaho/' + repo_name |
|
258 num_commits = 0 |
258 |
259 |
259 if time.time() < repocheck_timeout[repo_name]: |
260 if time.time() < repocheck_timeout[repo_name]: |
260 return |
261 return |
261 |
262 |
262 repocheck_timeout[repo_name] = time.time() + (cfg ('hg_checkinterval', 15) * 60) |
263 repocheck_timeout[repo_name] = time.time() + (cfg ('hg_checkinterval', 15) * 60) |
407 if need_update: |
408 if need_update: |
408 suds_client.service.mc_issue_update (g_config['trackeruser'], g_config['trackerpassword'], ticket_id, ticket_data) |
409 suds_client.service.mc_issue_update (g_config['trackeruser'], g_config['trackerpassword'], ticket_id, ticket_data) |
409 #fi |
410 #fi |
410 |
411 |
411 suds_client.service.mc_issue_note_add (g_config['trackeruser'], g_config['trackerpassword'], ticket_id, { 'text': message }) |
412 suds_client.service.mc_issue_note_add (g_config['trackeruser'], g_config['trackerpassword'], ticket_id, { 'text': message }) |
|
413 num_commits += 1 |
412 except Exception as e: |
414 except Exception as e: |
413 chanlog ('Error while processing %s: %s' % (commit_node, `e`)) |
415 chanlog ('Error while processing %s: %s' % (commit_node, `e`)) |
414 failed = True |
416 failed = True |
415 #tried |
417 #tried |
416 |
418 |
562 |
566 |
563 # Check for new issues on the bugtracker |
567 # Check for new issues on the bugtracker |
564 bt_checklatest() |
568 bt_checklatest() |
565 |
569 |
566 # Check for new commits in the repositories |
570 # Check for new commits in the repositories |
567 # note: stable (i.e. True) goes first! |
571 for n in ['zandronum-stable', 'zandronum']: |
568 for n in [True, False]: |
|
569 process_zan_repo_updates (n) |
572 process_zan_repo_updates (n) |
570 |
573 |
571 def channel_by_name (self, name): |
574 def channel_by_name (self, name): |
572 for channel in self.channels: |
575 for channel in self.channels: |
573 if channel['name'].upper() == args[0].upper(): |
576 if channel['name'].upper() == args[0].upper(): |
876 #fi |
879 #fi |
877 elif command == 'checkhg': |
880 elif command == 'checkhg': |
878 check_admin (sender, ident, host, command) |
881 check_admin (sender, ident, host, command) |
879 global repocheck_timeout |
882 global repocheck_timeout |
880 repocheck_timeout = {'zandronum':0, 'zandronum-stable':0} |
883 repocheck_timeout = {'zandronum':0, 'zandronum-stable':0} |
881 process_zan_repo_updates (True) |
884 |
882 process_zan_repo_updates (False) |
885 for n in ['zandronum-stable', 'zandronum']: |
|
886 numcommits = process_zan_repo_updates (n) |
|
887 |
|
888 if numcommits == 0: |
|
889 self.privmsg (replyto, 'No new commits in ' + n) |
|
890 #fi |
|
891 #done |
883 elif command == 'die': |
892 elif command == 'die': |
884 check_admin (sender, ident, host, command) |
893 check_admin (sender, ident, host, command) |
885 quit() |
894 quit() |
886 elif command == 'convert': |
895 elif command == 'convert': |
887 if len(args) != 3 or args[1] != 'as': |
896 if len(args) != 3 or args[1] != 'as': |