diff mercurial/pure/parsers.py @ 47514:559aee84b889

dirstate-entry: add a `from_p2` property Lets start to define and use more semantic property. Differential Revision: https://phab.mercurial-scm.org/D10956
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 03 Jul 2021 04:26:28 +0200
parents 10e740292dff
children c94d3ff46fd5
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Sat Jul 03 04:07:21 2021 +0200
+++ b/mercurial/pure/parsers.py	Sat Jul 03 04:26:28 2021 +0200
@@ -33,6 +33,10 @@
 _decompress = zlib.decompress
 
 
+# a special value used internally for `size` if the file come from the other parent
+FROM_P2 = -2
+
+
 class dirstatetuple(object):
     """represent a dirstate entry
 
@@ -87,6 +91,14 @@
         """
         return self._state == b'm'
 
+    @property
+    def from_p2(self):
+        """True if the file have been fetched from p2 during the current merge
+
+        Should only be set if a merge is in progress in the dirstate
+        """
+        return self._size == FROM_P2
+
     def v1_state(self):
         """return a "state" suitable for v1 serialization"""
         return self._state