changeset 8556:f5fae700cc00

inotify: set a flag so a failed inotify query doesn't get repeated. If, for some reason, we can't get the inotify server to start, it's better to disable inotify queries for the instance to avoid trying over and over to start the server, which takes time. Just fall back on repo.status()
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Wed, 06 May 2009 01:40:03 +0900
parents 3e09bc5fee12
children 67f76a4463ef
files hgext/inotify/__init__.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inotify/__init__.py	Wed Apr 22 00:37:35 2009 +0900
+++ b/hgext/inotify/__init__.py	Wed May 06 01:40:03 2009 +0900
@@ -63,17 +63,24 @@
         # to recurse.
         inotifyserver = False
 
+        # We'll set this to false after an unsuccessful attempt so that
+        # next calls of status() within the same instance don't try again
+        # to start an inotify server if it won't start.
+        _inotifyon = True
+
         def status(self, match, ignored, clean, unknown=True):
             files = match.files()
             if '.' in files:
                 files = []
-            if not ignored and not self.inotifyserver:
+            if self._inotifyon and not ignored and not self.inotifyserver:
                 cli = client(ui, repo)
                 try:
                     result = cli.statusquery(files, match, False,
                                             clean, unknown)
                 except QueryFailed, instr:
                     ui.debug(str(instr))
+                    # don't retry within the same hg instance
+                    inotifydirstate._inotifyon = False
                     pass
                 else:
                     if ui.config('inotify', 'debug'):