From patchwork Thu May 29 23:19:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,5,V2] dirstate: add dirstatetuple to create dirstate values From: Siddharth Agarwal X-Patchwork-Id: 4900 Message-Id: <1c01003e3a34dc7ec6a8.1401405558@dev1738.prn1.facebook.com> To: Date: Thu, 29 May 2014 16:19:18 -0700 # HG changeset patch # User Siddharth Agarwal # Date 1401235828 25200 # Tue May 27 17:10:28 2014 -0700 # Node ID 1c01003e3a34dc7ec6a867da5fa587ecf6926fc7 # Parent c8b554d5951988222aeab65ef56eaf291c2ec930 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. diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -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