how to poll hg repo in python

Gregory Szorc gregory.szorc at gmail.com
Sat May 9 11:27:15 CDT 2015


On Thu, May 7, 2015 at 5:25 AM, Rathnamachary G <rathnamachary at gmail.com>
wrote:

>
> Hi,
> I want to poll hg repository by python without using buildbot tool is it
> possible?
> i have tried below, but, it is always going into if condition only
> with/without checkin, please help me. if anything is there.
>
> _____________________repo.py______________________________
> from buildbot.changes.hgpoller import HgPoller
>
> while 1:
>        ret1=HgPoller('repo', workdir = '/path', pollInterval = 5,
> project='name')
>        ret=ret1.poll()
>         if ret:
>                 print ret
>                 print 'if'
>         else:
>                 print ret
>                 print 'else'
>

Mercurial 3.4 has the beginning of a JSON API on all hgweb commands. You
can use any Python HTTP library (I recommend "requests") and hit a URL like
http://selenic.com/repo/hg/json-rev/tip. If the "node" of the "tip"
changeset changes, the repo has been updated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150509/4602981e/attachment.html>


More information about the Mercurial-devel mailing list