changeset 9348:954f7a879495

inotify: server._updatestatus: simplify control flow
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Sun, 28 Jun 2009 19:46:36 +0900
parents d0474b184347
children 56fb15ad8fb1
files hgext/inotify/server.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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):