[PATCH 2 of 3] inotify: Simplifying init code
Nicolas Dumazet
nicdumz at gmail.com
Wed Apr 8 00:17:59 CDT 2009
# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1239164991 -32400
# Node ID d618b5fbddedfca6c4598cb6ac221de065faa71b
# Parent 31f842e68e3427c2bf4df166c77dd8f4d37a45ee
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()
diff --git a/hgext/inotify/__init__.py b/hgext/inotify/__init__.py
--- a/hgext/inotify/__init__.py
+++ b/hgext/inotify/__init__.py
@@ -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 '
More information about the Mercurial-devel
mailing list