inotify: do not complain that inotify is not running if autostart is False
authorBrendan Cully <brendan@kublai.com>
Mon, 01 Dec 2008 14:06:02 -0800
changeset 7452 89c516430107
parent 7451 fca9947652ce
child 7453 9898427add1c
inotify: do not complain that inotify is not running if autostart is False
hgext/inotify/__init__.py
--- a/hgext/inotify/__init__.py	Mon Dec 01 13:38:26 2008 -0800
+++ b/hgext/inotify/__init__.py	Mon Dec 01 14:06:02 2008 -0800
@@ -73,12 +73,13 @@
                     if result is not None:
                         return result
             except (OSError, socket.error), err:
+                autostart = ui.configbool('inotify', 'autostart', True)
+
                 if err[0] == errno.ECONNREFUSED:
                     ui.warn(_('(found dead inotify server socket; '
                                    'removing it)\n'))
                     os.unlink(repo.join('inotify.sock'))
-                if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and \
-                        ui.configbool('inotify', 'autostart', True):
+                if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart:
                     query = None
                     ui.debug(_('(starting inotify server)\n'))
                     try:
@@ -100,8 +101,9 @@
                         except socket.error, err:
                             ui.warn(_('could not talk to new inotify '
                                            'server: %s\n') % err[-1])
-                elif err[0] == errno.ENOENT:
-                    ui.warn(_('(inotify server not running)\n'))
+                elif err[0] in (errno.ECONNREFUSED, errno.ENOENT):
+                    # silently ignore normal errors if autostart is False
+                    ui.debug(_('(inotify server not running)\n'))
                 else:
                     ui.warn(_('failed to contact inotify server: %s\n')
                              % err[-1])