From patchwork Wed Nov 15 09:08:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D1354: dirstate: change all writes to dirstatemap._map to go through one method From: phabricator X-Patchwork-Id: 25575 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Wed, 15 Nov 2017 09:08:53 +0000 mbthomas updated this revision to Diff 3522. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1354?vs=3383&id=3522 REVISION DETAIL https://phab.mercurial-scm.org/D1354 AFFECTED FILES mercurial/dirstate.py CHANGE DETAILS To: mbolin, mbthomas, durham, #hg-reviewers Cc: durin42, mercurial-devel diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -1268,7 +1268,7 @@ 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 @@ 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 @@ 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: