# HG changeset patch # User Benoit Boissinot # Date 1266435889 -3600 # Node ID 08064db9f0050395b83b845fc2526c744d7e9594 # Parent 283f3b413f19579c7fb482d3749455501380d141 inotify/inserve: implement --timeout-idle option (issue885) hg inserve was ignoring and miscomputing the --timeout-idle option (seconds vs. minutes). Thanks to Jesse Glick for the bugreport and the initial patch. diff -r 283f3b413f19 -r 08064db9f005 hgext/inotify/linuxserver.py --- a/hgext/inotify/linuxserver.py Wed Feb 17 20:30:57 2010 +0100 +++ b/hgext/inotify/linuxserver.py Wed Feb 17 20:44:49 2010 +0100 @@ -397,7 +397,7 @@ self.register(timeout=timeout) def handle_timeout(self): - pass + raise server.TimeoutException def handle_pollevents(self, events): for e in events: diff -r 283f3b413f19 -r 08064db9f005 hgext/inotify/server.py --- a/hgext/inotify/server.py Wed Feb 17 20:30:57 2010 +0100 +++ b/hgext/inotify/server.py Wed Feb 17 20:44:49 2010 +0100 @@ -19,6 +19,8 @@ class AlreadyStartedException(Exception): pass +class TimeoutException(Exception): + pass def join(a, b): if a: @@ -444,9 +446,11 @@ master = _server.master def start(ui, dirstate, root, opts): - timeout = opts.get('timeout') + timeout = opts.get('idle_timeout') if timeout: - timeout = float(timeout) * 1e3 + timeout = float(timeout) * 60000 + else: + timeout = None class service(object): def init(self): @@ -457,7 +461,10 @@ def run(self): try: - self.master.run() + try: + self.master.run() + except TimeoutException: + pass finally: self.master.shutdown()