Question to Mercurial's command server

Idan Kamara idankk86 at gmail.com
Fri Aug 26 16:41:37 UTC 2011


On Fri, Aug 26, 2011 at 6:54 PM, Detlev Offenbach <detlev at die-offenbachs.de>
wrote:
>
> Hello,
>
> I am interested in using the Mercurial Command server. What I am curious
about
> is, if it is possible to interrupt the execution of a command (e.g. a pull
of
> a remote repository in case the server doesn't respond).

The protocol itself has no built in support for this.

But since the command server itself is simply a process, you can interrupt
it:

>>> import hglib
>>> r = hglib.open(...)
>>> r.server.pid
11781
>>> r = hglib.pull('http://foo.com')

Meanwhile:

$ kill -2 11781

>>> ...hglib.pull...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "hglib/client.py", line 1103, in pull
    self.rawcommand(args, eh=eh)
  File "hglib/client.py", line 136, in rawcommand
    return eh(ret, out, err)
  File "hglib/util.py", line 132, in __call__
    raise error.CommandError(self.args, ret, out, err)
hglib.error.CommandError: interrupted!

But this is risky since you might end up interrupting it by the
time pull finished, and cause it to exit.

It'll probably be a good idea to have pull timeout sooner,
although I recall someone saying that's in Python's hands (urllib?).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20110826/847dbb7c/attachment-0002.html>


More information about the Mercurial mailing list