Mercurial > hg
diff mercurial/dirstate.py @ 47513:10e740292dff
dirstate-entry: add a `merged` property
Lets start to define and use more semantic property.
Differential Revision: https://phab.mercurial-scm.org/D10955
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 03 Jul 2021 04:07:21 +0200 |
parents | 769037a279ec |
children | 559aee84b889 |
line wrap: on
line diff
--- a/mercurial/dirstate.py Sun Jul 04 03:29:20 2021 +0200 +++ b/mercurial/dirstate.py Sat Jul 03 04:07:21 2021 +0200 @@ -355,7 +355,7 @@ def setparents(self, p1, p2=None): """Set dirstate parents to p1 and p2. - When moving from two parents to one, 'm' merged entries a + When moving from two parents to one, "merged" entries a adjusted to normal and previous copy records discarded and returned by the call. @@ -386,8 +386,8 @@ if s is None: continue - # Discard 'm' markers when moving away from a merge state - if s.state == b'm': + # Discard "merged" markers when moving away from a merge state + if s.merged: source = self._map.copymap.get(f) if source: copies[f] = source @@ -527,7 +527,7 @@ '''Mark a file normal, but possibly dirty.''' if self.in_merge: # if there is a merge going on and the file was either - # in state 'm' (-1) or coming from other parent (-2) before + # "merged" or coming from other parent (-2) before # being removed, restore that state. entry = self._map.get(f) if entry is not None: @@ -540,11 +540,7 @@ if source: self.copy(source, f) return - if ( - entry.state == b'm' - or entry.state == b'n' - and entry[2] == FROM_P2 - ): + if entry.merged or entry.state == b'n' and entry[2] == FROM_P2: return self._addpath(f, b'n', 0, possibly_dirty=True) self._map.copymap.pop(f, None) @@ -1362,7 +1358,7 @@ ladd(fn) elif listclean: cadd(fn) - elif state == b'm': + elif t.merged: madd(fn) elif state == b'a': aadd(fn)