changeset 2831:0b50a580be36

Add manifestflags class
author Matt Mackall <mpm@selenic.com>
date Sun, 16 Jul 2006 02:59:20 -0500
parents 00fc88b0b256
children e196aa1df169
files mercurial/manifest.py
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Wed Jul 12 08:59:20 2006 -0700
+++ b/mercurial/manifest.py	Sun Jul 16 02:59:20 2006 -0500
@@ -10,6 +10,20 @@
 from demandload import *
 demandload(globals(), "array bisect struct")
 
+class manifestflags(dict):
+    def __init__(self, mapping={}):
+        dict.__init__(self, mapping)
+    def execf(self, f):
+        "test for executable in manifest flags"
+        return self.get(f, False)
+    def linkf(self, f):
+        "test for symlink in manifest flags"
+        return False
+    def set(self, f, execf=False, linkf=False):
+        self[f] = execf
+    def copy(self):
+        return manifestflags(dict.copy(self))
+
 class manifest(revlog):
     def __init__(self, opener, defversion=REVLOGV0):
         self.mapcache = None
@@ -23,7 +37,7 @@
             return self.mapcache[1]
         text = self.revision(node)
         map = {}
-        flag = {}
+        flag = manifestflags()
         self.listcache = array.array('c', text)
         lines = text.splitlines(1)
         for l in lines: