Sun, 30 Nov 2014 17:27:09 +0200
- we now need an explicit check against double-processing commits
hgpoll.py | file | annotate | diff | comparison | revisions |
--- a/hgpoll.py Sun Nov 30 03:55:47 2014 +0200 +++ b/hgpoll.py Sun Nov 30 17:27:09 2014 +0200 @@ -278,6 +278,9 @@ process_new_commits (repo_name, commit_data) def process_new_commits (repo_name, commit_data): + if len (commit_data) == 0: + return + usestable = repo_name == 'zandronum-stable' usesandbox = repo_name == 'zandronum-sandbox' or repo_name == 'zandronum-sandbox-stable' repo_owner = 'Torr_Samaho' if not usesandbox else 'crimsondusk' @@ -286,38 +289,46 @@ zanrepo = hgapi.Repo (repo_name) Irc.broadcast ('%d new commits on %s' % (len (commit_data), repo_name)) - if len (commit_data) > 0: - pull_args = []; + # Drop commits that we already have + i = 0 + while i < len (commit_data): + try: + zanrepo.hg_command ('log', '-r' commit_data[i][0]) + del commit_data[i] + except: + i += 1 - for commit in commit_data: - pull_args.append ('-r'); - pull_args.append (commit[0]); - - print 'Pulling new commits...' - try: - zanrepo.hg_command ('pull', *pull_args) + pull_args = []; - # Also pull these commits to the zandronum main repository - if usestable: - devrepo = hgapi.Repo ('zandronum') - devrepo.hg_command ('pull', '../zandronum-stable', *pull_args) + for commit in commit_data: + pull_args.append ('-r'); + pull_args.append (commit[0]); + + print 'Pulling new commits...' + try: + zanrepo.hg_command ('pull', *pull_args) - # Pull everything into sandboxes too - if not usesandbox: - devrepo = hgapi.Repo ('zandronum-sandbox') - devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) - - devrepo = hgapi.Repo ('zandronum-sandbox-stable') - devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) - - devrepo = hgapi.Repo ('zandronum-everything') + # Also pull these commits to the zandronum main repository + if usestable: + devrepo = hgapi.Repo ('zandronum') + devrepo.hg_command ('pull', '../zandronum-stable', *pull_args) + # Pull everything into sandboxes too + if not usesandbox: + devrepo = hgapi.Repo ('zandronum-sandbox') devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) - global g_needCommitsTxtRebuild - g_needCommitsTxtRebuild = True - except Exception as e: - Irc.broadcast ('Warning: unable to pull: %s' % `e`) - return + devrepo = hgapi.Repo ('zandronum-sandbox-stable') + devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) + + devrepo = hgapi.Repo ('zandronum-everything') + devrepo.hg_command ('pull', '../%s' % repo_name, *pull_args) + + global g_needCommitsTxtRebuild + g_needCommitsTxtRebuild = True + + except Exception as e: + Irc.broadcast ('Warning: unable to pull: %s' % `e`) + return for commit in commit_data: commit_node = commit[0]