mercurial/pure/parsers.py
changeset 47514 559aee84b889
parent 47513 10e740292dff
child 47515 c94d3ff46fd5
--- 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