inotify: server._updatestatus: simplify control flow
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Sun, 28 Jun 2009 19:46:36 +0900
changeset 9348 954f7a879495
parent 9347 d0474b184347
child 9349 56fb15ad8fb1
inotify: server._updatestatus: simplify control flow
hgext/inotify/server.py
--- a/hgext/inotify/server.py	Tue Aug 11 22:45:38 2009 +0200
+++ b/hgext/inotify/server.py	Sun Jun 28 19:46:36 2009 +0900
@@ -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):