marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
REVISION SUMMARY This is going to be clearer and easier to track than -1. Ultimately I would like to get ride of this special value everywhere but in the lower level, however we need to clarify the API first. This changeset is part of such clarification. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D10927 AFFECTED FILES mercurial/dirstate.py CHANGE DETAILS diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -51,6 +51,9 @@ # a special value used internally for `size` if the file come from the other parent FROM_P2 = -2 +# a special value used internally for `size` if the file is modified/merged/added +NONNORMAL = -1 + class repocache(filecache): """filecache for files in .hg/""" @@ -488,9 +491,9 @@ # being removed, restore that state. entry = self._map.get(f) if entry is not None: - if entry[0] == b'r' and entry[2] in (-1, FROM_P2): + if entry[0] == b'r' and entry[2] in (NONNORMAL, FROM_P2): source = self._map.copymap.get(f) - if entry[2] == -1: + if entry[2] == NONNORMAL: self.merge(f) elif entry[2] == FROM_P2: self.otherparent(f) @@ -499,7 +502,7 @@ return if entry[0] == b'm' or entry[0] == b'n' and entry[2] == FROM_P2: return - self._addpath(f, b'n', 0, -1, -1) + self._addpath(f, b'n', 0, NONNORMAL, -1) self._map.copymap.pop(f, None) def otherparent(self, f): @@ -517,7 +520,7 @@ def add(self, f): '''Mark a file added.''' - self._addpath(f, b'a', 0, -1, -1) + self._addpath(f, b'a', 0, NONNORMAL, -1) self._map.copymap.pop(f, None) def remove(self, f): @@ -530,7 +533,7 @@ if entry is not None: # backup the previous state if entry[0] == b'm': # merge - size = -1 + size = NONNORMAL elif entry[0] == b'n' and entry[2] == FROM_P2: # other parent size = FROM_P2 self._map.otherparentset.add(f) To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel