[Buildbot-devel] Mercurial: commit vs changegroup hook
Charles-Henri d'Adhémar
cdadhemar at gmail.com
Tue Feb 2 17:33:57 UTC 2010
Hi !
2010/2/2 Marcus Lindblom <macke at yar.nu>:
> No, we use a remote repo on our server that triggers the buildbot.
> No-one ever commits there, everyone just push and pull. This is a pretty
> common scenario.
Indeed. I use Buildbot inside a company with local repositories shared
across a NAS access.
This is not that common, and I think that "your" way of using Hg is
much safer and better than mine ...
>> Did you write a commit hook (either using a python or buildbot
>> sendchange script based) that could be shared ?
>
> No, but perhaps the existing one could be adapted?
> After all, it's very much the same thing. :)
I have just wrote a python based commit hook based on what I found in
contrib/hg_buildbot.py
and buildbot/changes/hgbuildbot.py. See below for the code.
It may be adapted to your needs, It does not cover all the branching
cases. If it helps I am more than happy !
However I will try, when time permit, to merge this into
buildbot/changes/hgbuildbot.py to provide a better solution, more
integrated with the current hgbuildbot script.
Cheers,
Chicha
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildbot/hgcommit.py Tue Feb 02 18:03:19 2010 +0100
@@ -0,0 +1,27 @@
+try:
+ from mercurial import demandimport
+ demandimport.disable()
+except ImportError:
+ pass
+
+from buildbot.scripts import runner
+
+def hook(ui, repo, node=None, **kwargs):
+ ctx = repo[node]
+ master = ui.config('hgbuildbot', 'master')
+ if master is None:
+ ui.write("* You must define the 'master' in a [hgbuildbot]
section to .hg/hgrc in "
+ "order to use buildbot hook\n")
+ return True
+ branch = ui.config('hgbuildbot', 'branch')
+ if branch is None:
+ ui.write("* You must define the 'branch' in a [hgbuildbot]
section to .hg/hgrc in "
+ "order to use buildbot hook\n")
+ return True
+ change = {'master': master,
+ 'username': ctx.user(),
+ 'files': ctx.files(),
+ 'revision': node,
+ 'comments': ctx.description(),
+ 'branch': branch}
+ runner.sendchange(change, True)
More information about the devel
mailing list