dirstate: change all writes to dirstatemap._map to go through one method

Summary:
This separates some concerns that were introduced in
https://phab.mercurial-scm.org/D1341.

In particular, this makes it easier for `eden_dirstate` to provide its own
implementation, which incidentally, does not use `dirstatetuple`.

Test Plan:
Ran this against a complementary change in Eden and verified that all of Eden's
integration tests pass.

Reviewers: mbthomas, durham, #hg-reviewers!

Subscribers: mercurial-devel

Differential Revision: https://phab.mercurial-scm.org/D1354
(grafted from eb6590eec45176982198e1a91ccae5821f65958c)
(grafted from 43c991e04a2a1e56918040db8e7c0ea49d3d0abe)
(grafted from 4926c8af95b45593749ef96a194a1a065d916b3c)
(grafted from 5c77cbac5f578e3924a76f7017bf5d34b6718757)
(grafted from 14cf809e89209da973d17b38a8cde9fe6659e424)
(grafted from 7ddca31c3875fdcaf7a2a64198bbb321ec1cb018)
This commit is contained in:
Michael Bolin 2018-01-03 05:35:56 -08:00
parent df1532996b
commit 4c9e29681a

View File

@ -1268,7 +1268,7 @@ class dirstatemap(object):
self._dirs.addpath(f)
if oldstate == "?" and "_alldirs" in self.__dict__:
self._alldirs.addpath(f)
self._map[f] = dirstatetuple(state, mode, size, mtime)
self._insert_tuple(f, state, mode, size, mtime)
if state != 'n' or mtime == -1:
self.nonnormalset.add(f)
if size == -2:
@ -1289,7 +1289,7 @@ class dirstatemap(object):
if "filefoldmap" in self.__dict__:
normed = util.normcase(f)
self.filefoldmap.pop(normed, None)
self._map[f] = dirstatetuple('r', 0, size, 0)
self._insert_tuple(f, 'r', 0, size, 0)
self.nonnormalset.add(f)
def dropfile(self, f, oldstate):
@ -1313,9 +1313,12 @@ class dirstatemap(object):
for f in files:
e = self.get(f)
if e is not None and e[0] == 'n' and e[3] == now:
self._map[f] = dirstatetuple(e[0], e[1], e[2], -1)
self._insert_tuple(f, e[0], e[1], e[2], -1)
self.nonnormalset.add(f)
def _insert_tuple(self, f, state, mode, size, mtime):
self._map[f] = dirstatetuple(state, mode, size, mtime)
def nonnormalentries(self):
'''Compute the nonnormal dirstate entries from the dmap'''
try: