cobalt.py

changeset 47
103f184951bb
parent 46
c4d231fdf1c0
child 48
dbef418cc1c8
equal deleted inserted replaced
46:c4d231fdf1c0 47:103f184951bb
227 #tried 227 #tried
228 #enddef 228 #enddef
229 229
230 check_repo_exists ('zandronum') 230 check_repo_exists ('zandronum')
231 check_repo_exists ('zandronum-stable') 231 check_repo_exists ('zandronum-stable')
232 232 check_repo_exists ('zandronum-sandbox')
233 repocheck_timeout = {'zandronum':(time.time()) + 15, 'zandronum-stable':(time.time() + 15)} 233
234 repocheck_timeout = {'zandronum':(time.time()) + 15, 'zandronum-stable':(time.time() + 15), 'zandronum-sandbox':(time.time()) + 15}
234 235
235 def get_commit_data (zanrepo, rev, template): 236 def get_commit_data (zanrepo, rev, template):
236 return zanrepo.hg_command ('log', '-l', '1', '-r', rev, '--template', template) 237 return zanrepo.hg_command ('log', '-l', '1', '-r', rev, '--template', template)
237 #enddef 238 #enddef
238 239
279 global suds_client 280 global suds_client
280 global g_config 281 global g_config
281 global g_clients 282 global g_clients
282 283
283 usestable = repo_name == 'zandronum-stable' 284 usestable = repo_name == 'zandronum-stable'
284 repo_url = 'https://bitbucket.org/Torr_Samaho/' + repo_name 285 usesandbox = repo_name == 'zandronum-sandbox'
286 repo_owner = 'Torr_Samaho' if not usesandbox else 'crimsondusk'
287 repo_url = 'https://bitbucket.org/%s/%s' % (repo_owner, repo_name)
285 num_commits = 0 288 num_commits = 0
286 289
287 if time.time() < repocheck_timeout[repo_name]: 290 if time.time() < repocheck_timeout[repo_name]:
288 return 291 return
289 292
342 if usestable: 345 if usestable:
343 devrepo = hgapi.Repo ('zandronum') 346 devrepo = hgapi.Repo ('zandronum')
344 pull_args.insert (1, '../zandronum-stable') 347 pull_args.insert (1, '../zandronum-stable')
345 devrepo.hg_command (*pull_args) 348 devrepo.hg_command (*pull_args)
346 #fi 349 #fi
350
351 # Pull everything into sandbox too
352 if not usesandbox:
353 devrepo = hgapi.Repo ('zandronum-sandbox')
354 pull_args.insert (1, '../%s' % repo_name)
355 devrepo.hg_command (*pull_args)
356 #fi
347 except Exception as e: 357 except Exception as e:
348 chanlog ('Warning: unable to pull: %s' % `e`) 358 chanlog ('Warning: unable to pull: %s' % `e`)
349 return 359 return
350 #tried 360 #tried
351 #fi 361 #fi
353 for commit in commit_data: 363 for commit in commit_data:
354 commit_node = commit[0] 364 commit_node = commit[0]
355 commit_message = commit[1] 365 commit_message = commit[1]
356 366
357 try: 367 try:
368 if usesandbox:
369 commit_author = get_commit_data (zanrepo, commit_node, '{author}')
370 commit_url = '%s/commits/%s' % (repo_url, commit_node)
371
372 # Remove the email address from the author if possible
373 rex = re.compile (r'^(.+) <([^>]+)>$.*')
374 match = rex.match (commit_author)
375 if match:
376 commit_author = match.group (1)
377 #fi
378
379 for irc_client in g_clients:
380 for channel in irc_client.cfg['channels']:
381 if 'btprivate' in channel and channel['btprivate'] == True:
382 irc_client.privmsg (channel['name'],
383 "%s: new commit %s by %s: %s"
384 % (repo_name, commit_node, commit_author, commit_url))
385
386 for line in commit_message.split ('\n'):
387 irc_client.privmsg (channel['name'], line)
388 #fi
389 #done
390 #done
391
392 num_commits += 1
393 continue
394 #fi
395
358 rex = re.compile (r'^.*(fixes|resolves|addresses) ([0-9]+).*$') 396 rex = re.compile (r'^.*(fixes|resolves|addresses) ([0-9]+).*$')
359 match = rex.match (commit_message) 397 match = rex.match (commit_message)
360 398
361 if not match: 399 if not match:
362 continue # no "fixes" message in the commit 400 continue # no "fixes" message in the commit
610 648
611 # Check for new issues on the bugtracker 649 # Check for new issues on the bugtracker
612 bt_checklatest() 650 bt_checklatest()
613 651
614 # Check for new commits in the repositories 652 # Check for new commits in the repositories
615 for n in ['zandronum-stable', 'zandronum']: 653 for n in ['zandronum-stable', 'zandronum', 'zandronum-sandbox']:
616 process_zan_repo_updates (n) 654 process_zan_repo_updates (n)
617 655
618 def channel_by_name (self, name): 656 def channel_by_name (self, name):
619 for channel in self.channels: 657 for channel in self.channels:
620 if channel['name'].upper() == args[0].upper(): 658 if channel['name'].upper() == args[0].upper():
922 self.privmsg (replyto, 'No dev emails.') 960 self.privmsg (replyto, 'No dev emails.')
923 #fi 961 #fi
924 elif command == 'checkhg': 962 elif command == 'checkhg':
925 check_admin (sender, ident, host, command) 963 check_admin (sender, ident, host, command)
926 global repocheck_timeout 964 global repocheck_timeout
927 repocheck_timeout = {'zandronum':0, 'zandronum-stable':0} 965 repocheck_timeout = {'zandronum':0, 'zandronum-stable':0, 'zandronum-sandbox':0}
928 966
929 for n in ['zandronum-stable', 'zandronum']: 967 for n in ['zandronum-stable', 'zandronum', 'zandronum-sandbox']:
930 numcommits = process_zan_repo_updates (n) 968 numcommits = process_zan_repo_updates (n)
931 969
932 if numcommits == 0: 970 if numcommits == 0:
933 self.privmsg (replyto, 'No new commits in ' + n) 971 self.privmsg (replyto, 'No new commits in ' + n)
934 #fi 972 #fi

mercurial