[PATCH 1 of 5] inotify: server._updatestatus: simplify control flow

Nicolas Dumazet nicdumz at gmail.com
Fri Aug 14 02:11:50 CDT 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1246185996 -32400
# Node ID d5a60d6e167f821a1788abe1b83bc20f7012acca
# Parent  94114ea3503d9a9eed4c42e0417b87769401f199
inotify: server._updatestatus: simplify control flow

diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py
--- a/hgext/inotify/server.py
+++ b/hgext/inotify/server.py
@@ -443,14 +443,13 @@
         if oldstatus and oldstatus in self.statuskeys \
             and oldstatus != newstatus:
             del self.statustrees[oldstatus].dir(root).files[fn]
-        if newstatus and newstatus != 'i':
+
+        if newstatus in (None, 'i'):
+            d.files.pop(fn, None)
+        elif oldstatus != newstatus:
             d.files[fn] = newstatus
-            if newstatus in self.statuskeys:
-                dd = self.statustrees[newstatus].dir(root)
-                if oldstatus != newstatus or fn not in dd.files:
-                    dd.files[fn] = newstatus
-        else:
-            d.files.pop(fn, None)
+            if newstatus != 'n':
+                self.statustrees[newstatus].dir(root).files[fn] = newstatus
 
 
     def check_deleted(self, key):


More information about the Mercurial-devel mailing list