Mercurial > hg
comparison hgext/inotify/__init__.py @ 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 |
comparison
equal
deleted
inserted
replaced
8555:3e09bc5fee12 | 8556:f5fae700cc00 |
---|---|
61 class inotifydirstate(repo.dirstate.__class__): | 61 class inotifydirstate(repo.dirstate.__class__): |
62 # Set to True if we're the inotify server, so we don't attempt | 62 # Set to True if we're the inotify server, so we don't attempt |
63 # to recurse. | 63 # to recurse. |
64 inotifyserver = False | 64 inotifyserver = False |
65 | 65 |
66 # We'll set this to false after an unsuccessful attempt so that | |
67 # next calls of status() within the same instance don't try again | |
68 # to start an inotify server if it won't start. | |
69 _inotifyon = True | |
70 | |
66 def status(self, match, ignored, clean, unknown=True): | 71 def status(self, match, ignored, clean, unknown=True): |
67 files = match.files() | 72 files = match.files() |
68 if '.' in files: | 73 if '.' in files: |
69 files = [] | 74 files = [] |
70 if not ignored and not self.inotifyserver: | 75 if self._inotifyon and not ignored and not self.inotifyserver: |
71 cli = client(ui, repo) | 76 cli = client(ui, repo) |
72 try: | 77 try: |
73 result = cli.statusquery(files, match, False, | 78 result = cli.statusquery(files, match, False, |
74 clean, unknown) | 79 clean, unknown) |
75 except QueryFailed, instr: | 80 except QueryFailed, instr: |
76 ui.debug(str(instr)) | 81 ui.debug(str(instr)) |
82 # don't retry within the same hg instance | |
83 inotifydirstate._inotifyon = False | |
77 pass | 84 pass |
78 else: | 85 else: |
79 if ui.config('inotify', 'debug'): | 86 if ui.config('inotify', 'debug'): |
80 r2 = super(inotifydirstate, self).status( | 87 r2 = super(inotifydirstate, self).status( |
81 match, False, clean, unknown) | 88 match, False, clean, unknown) |