Mercurial > hg
comparison hgext/inotify/__init__.py @ 6996:fecf060f32a1
inotify: deactivate inotify status on failure
workaround issue1208, add test
fix traceback handling (socket.error is a singleton in this case)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 06 Sep 2008 12:49:20 +0200 |
parents | 25619b72f86a |
children | 9c4e488f105e |
comparison
equal
deleted
inserted
replaced
6995:25619b72f86a | 6996:fecf060f32a1 |
---|---|
61 except socket.error, err: | 61 except socket.error, err: |
62 if err[0] == errno.ECONNREFUSED: | 62 if err[0] == errno.ECONNREFUSED: |
63 ui.warn(_('(found dead inotify server socket; ' | 63 ui.warn(_('(found dead inotify server socket; ' |
64 'removing it)\n')) | 64 'removing it)\n')) |
65 os.unlink(repo.join('inotify.sock')) | 65 os.unlink(repo.join('inotify.sock')) |
66 elif err[0] != errno.ENOENT: | 66 if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and \ |
67 raise | 67 ui.configbool('inotify', 'autostart'): |
68 if ui.configbool('inotify', 'autostart'): | |
69 query = None | 68 query = None |
70 ui.debug(_('(starting inotify server)\n')) | 69 ui.debug(_('(starting inotify server)\n')) |
71 try: | 70 try: |
72 server.start(ui, repo) | 71 server.start(ui, repo) |
73 query = client.query | 72 query = client.query |
77 ui.debug(str(inst)) | 76 ui.debug(str(inst)) |
78 query = client.query | 77 query = client.query |
79 except Exception, inst: | 78 except Exception, inst: |
80 ui.warn(_('could not start inotify server: ' | 79 ui.warn(_('could not start inotify server: ' |
81 '%s\n') % inst) | 80 '%s\n') % inst) |
82 ui.print_exc() | |
83 | |
84 if query: | 81 if query: |
85 try: | 82 try: |
86 return query(ui, repo, files or [], match, | 83 return query(ui, repo, files or [], match, |
87 list_ignored, list_clean, list_unknown) | 84 list_ignored, list_clean, list_unknown) |
88 except socket.error, err: | 85 except socket.error, err: |
89 ui.warn(_('could not talk to new inotify ' | 86 ui.warn(_('could not talk to new inotify ' |
90 'server: %s\n') % err[1]) | 87 'server: %s\n') % err[-1]) |
91 ui.print_exc() | 88 else: |
89 ui.warn(_('failed to contact inotify server: %s\n') | |
90 % err[-1]) | |
91 ui.print_exc() | |
92 # replace by old status function | |
93 ui.warn(_('deactivating inotify\n')) | |
94 self.status = super(inotifydirstate, self).status | |
92 | 95 |
93 return super(inotifydirstate, self).status( | 96 return super(inotifydirstate, self).status( |
94 files, match or util.always, list_ignored, list_clean, | 97 files, match or util.always, list_ignored, list_clean, |
95 list_unknown) | 98 list_unknown) |
96 | 99 |