diff mercurial/manifest.py @ 2834:35af2e56f15a

manifestflags: eliminate remaining users of direct dict access
author Matt Mackall <mpm@selenic.com>
date Wed, 19 Jul 2006 19:11:50 -0500
parents d0159c5f18bf
children a9f5d4149123
line wrap: on
line diff
--- a/mercurial/manifest.py	Sun Jul 16 03:22:05 2006 -0500
+++ b/mercurial/manifest.py	Wed Jul 19 19:11:50 2006 -0500
@@ -13,6 +13,10 @@
 class manifestflags(dict):
     def __init__(self, mapping={}):
         dict.__init__(self, mapping)
+    def __getitem__(self, f):
+        raise "oops"
+    def flags(self, f):
+        return dict.__getitem__(self, f)
     def execf(self, f):
         "test for executable in manifest flags"
         return "x" in self.get(f, "")
@@ -140,7 +144,7 @@
 
             # if this is changed to support newlines in filenames,
             # be sure to check the templates/ dir again (especially *-raw.tmpl)
-            text = ["%s\000%s%s\n" % (f, hex(map[f]), flags[f]) for f in files]
+            text = ["%s\000%s%s\n" % (f, hex(map[f]), flags.flags(f)) for f in files]
             self.listcache = array.array('c', "".join(text))
             cachedelta = None
         else:
@@ -166,7 +170,7 @@
                 # bs will either be the index of the item or the insert point
                 start, end = self._search(addbuf, f, start)
                 if w[1] == 0:
-                    l = "%s\000%s%s\n" % (f, hex(map[f]), flags[f])
+                    l = "%s\000%s%s\n" % (f, hex(map[f]), flags.flags(f))
                 else:
                     l = ""
                 if start == end and w[1] == 1: