changeset 8068:389e2820280d

inotify: Simplifying init code simplifying retry = False try: try: doA() retry = True except X: doB() retry = True except: doC() pass if retry: doD() -- into -- try: try: doA() except X: doB() except: doC() pass else: doD()
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Wed, 08 Apr 2009 13:29:51 +0900
parents b084d6d6f345
children 82e28c7be8fb
files hgext/inotify/__init__.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inotify/__init__.py	Wed Apr 08 13:27:28 2009 +0900
+++ b/hgext/inotify/__init__.py	Wed Apr 08 13:29:51 2009 +0900
@@ -80,23 +80,21 @@
                                    'removing it)\n'))
                     os.unlink(repo.join('inotify.sock'))
                 if err[0] in (errno.ECONNREFUSED, errno.ENOENT) and autostart:
-                    query = None
                     ui.debug(_('(starting inotify server)\n'))
                     try:
                         try:
                             server.start(ui, repo)
-                            query = client.query
                         except server.AlreadyStartedException, inst:
                             # another process may have started its own
                             # inotify server while this one was starting.
                             ui.debug(str(inst))
-                            query = client.query
                     except Exception, inst:
                         ui.warn(_('could not start inotify server: '
                                        '%s\n') % inst)
-                    if query:
+                    else:
+                        # server is started, send query again
                         try:
-                            return query(ui, repo, files, match,
+                            return client.query(ui, repo, files, match,
                                          ignored, clean, unknown)
                         except socket.error, err:
                             ui.warn(_('could not talk to new inotify '