diff --git a/hgext/inotify/__init__.py b/hgext/inotify/__init__.py --- a/hgext/inotify/__init__.py +++ b/hgext/inotify/__init__.py @@ -63,9 +63,8 @@ def reposetup(ui, repo): ui.warn(_('(found dead inotify server socket; ' 'removing it)\n')) os.unlink(repo.join('inotify.sock')) - elif err[0] != errno.ENOENT: - raise - if ui.configbool('inotify', 'autostart'): + if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and \ + ui.configbool('inotify', 'autostart'): query = None ui.debug(_('(starting inotify server)\n')) try: @@ -79,16 +78,20 @@ def reposetup(ui, repo): except Exception, inst: ui.warn(_('could not start inotify server: ' '%s\n') % inst) - ui.print_exc() - if query: try: return query(ui, repo, files or [], match, list_ignored, list_clean, list_unknown) except socket.error, err: ui.warn(_('could not talk to new inotify ' - 'server: %s\n') % err[1]) - ui.print_exc() + 'server: %s\n') % err[-1]) + else: + ui.warn(_('failed to contact inotify server: %s\n') + % err[-1]) + ui.print_exc() + # replace by old status function + ui.warn(_('deactivating inotify\n')) + self.status = super(inotifydirstate, self).status return super(inotifydirstate, self).status( files, match or util.always, list_ignored, list_clean, diff --git a/tests/hghave b/tests/hghave --- a/tests/hghave +++ b/tests/hghave @@ -57,6 +57,13 @@ def has_executablebit(): finally: os.remove(path) +def has_inotify(): + try: + import hgext.inotify.linux.watcher + return True + except ImportError: + return False + def has_fifo(): return hasattr(os, "mkfifo") @@ -129,14 +136,15 @@ checks = { "fifo": (has_fifo, "named pipes"), "git": (has_git, "git command line client"), "hotshot": (has_hotshot, "python hotshot module"), + "inotify": (has_inotify, "inotify extension support"), "lsprof": (has_lsprof, "python lsprof module"), "mtn": (has_mtn, "monotone client (> 0.31)"), + "pygments": (has_pygments, "Pygments source highlighting library"), "svn": (has_svn, "subversion client and admin tools"), "svn-bindings": (has_svn_bindings, "subversion python bindings"), "symlink": (has_symlink, "symbolic links"), "tla": (has_tla, "GNU Arch tla client"), "unix-permissions": (has_unix_permissions, "unix-style permissions"), - "pygments": (has_pygments, "Pygments source highlighting library"), } def list_features(): diff --git a/tests/test-inotify-issue1208 b/tests/test-inotify-issue1208 new file mode 100755 --- /dev/null +++ b/tests/test-inotify-issue1208 @@ -0,0 +1,15 @@ +#!/bin/sh + +"$TESTDIR/hghave" inotify || exit 80 + +echo "[extensions]" >> $HGRCPATH +echo "inotify=" >> $HGRCPATH + +p="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +hg init $p +cd $p + +echo % inserve +hg inserve +echo % status +hg status diff --git a/tests/test-inotify-issue1208.out b/tests/test-inotify-issue1208.out new file mode 100644 --- /dev/null +++ b/tests/test-inotify-issue1208.out @@ -0,0 +1,5 @@ +% inserve +abort: AF_UNIX path too long +% status +failed to contact inotify server: AF_UNIX path too long +deactivating inotify