hgext/inotify/__init__.py
changeset 7452 89c516430107
parent 7434 cf7741aa1e96
child 7522 2f4a399a8787
--- 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])