changeset 21808:7537e57f5dbd

dirstate: add dirstatetuple to create dirstate values Upcoming patches will switch away from using Python tuples for dirstate values in compiled builds. Make that easier by introducing a variable called dirstatetuple, currently set to tuple. In upcoming patches, this will be set to an object from the parsers module.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 27 May 2014 17:10:28 -0700
parents a96a3d1261c6
children e250b8300e6e
files mercurial/dirstate.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Tue May 27 15:22:23 2014 -0700
+++ b/mercurial/dirstate.py	Tue May 27 17:10:28 2014 -0700
@@ -14,6 +14,10 @@
 filecache = scmutil.filecache
 _rangemask = 0x7fffffff
 
+def dirstatetuple(*x):
+    # x is a tuple
+    return x
+
 class repocache(filecache):
     """filecache for files in .hg/"""
     def join(self, obj, fname):
@@ -335,7 +339,7 @@
         if oldstate in "?r" and "_dirs" in self.__dict__:
             self._dirs.addpath(f)
         self._dirty = True
-        self._map[f] = (state, mode, size, mtime)
+        self._map[f] = dirstatetuple(state, mode, size, mtime)
 
     def normal(self, f):
         '''Mark a file normal and clean.'''
@@ -400,7 +404,7 @@
                 size = -1
             elif entry[0] == 'n' and entry[2] == -2: # other parent
                 size = -2
-        self._map[f] = ('r', 0, size, 0)
+        self._map[f] = dirstatetuple('r', 0, size, 0)
         if size == 0 and f in self._copymap:
             del self._copymap[f]
 
@@ -493,9 +497,9 @@
                 self._map[f] = oldmap[f]
             else:
                 if 'x' in allfiles.flags(f):
-                    self._map[f] = ('n', 0777, -1, 0)
+                    self._map[f] = dirstatetuple('n', 0777, -1, 0)
                 else:
-                    self._map[f] = ('n', 0666, -1, 0)
+                    self._map[f] = dirstatetuple('n', 0666, -1, 0)
         self._pl = (parent, nullid)
         self._dirty = True