changeset 52498:2aada52e80d6

interfaces: convert `repository.irevisiondelta` from zope `Attribute` attrs This is the same transformation as b455dfddfed0 did for dirstate.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 22 Oct 2024 18:34:54 -0400
parents 4ef6dbc27a99
children 43d2a2f66434
files mercurial/interfaces/repository.py
diffstat 1 files changed, 51 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/interfaces/repository.py	Tue Oct 22 17:18:26 2024 -0400
+++ b/mercurial/interfaces/repository.py	Tue Oct 22 18:34:54 2024 -0400
@@ -473,63 +473,57 @@
     Typically used for changegroup generation.
     """
 
-    node = interfaceutil.Attribute("""20 byte node of this revision.""")
-
-    p1node = interfaceutil.Attribute(
-        """20 byte node of 1st parent of this revision."""
-    )
-
-    p2node = interfaceutil.Attribute(
-        """20 byte node of 2nd parent of this revision."""
-    )
-
-    linknode = interfaceutil.Attribute(
-        """20 byte node of the changelog revision this node is linked to."""
-    )
-
-    flags = interfaceutil.Attribute(
-        """2 bytes of integer flags that apply to this revision.
-
-        This is a bitwise composition of the ``REVISION_FLAG_*`` constants.
-        """
-    )
-
-    basenode = interfaceutil.Attribute(
-        """20 byte node of the revision this data is a delta against.
-
-        ``nullid`` indicates that the revision is a full revision and not
-        a delta.
-        """
-    )
-
-    baserevisionsize = interfaceutil.Attribute(
-        """Size of base revision this delta is against.
-
-        May be ``None`` if ``basenode`` is ``nullid``.
-        """
-    )
-
-    revision = interfaceutil.Attribute(
-        """Raw fulltext of revision data for this node."""
-    )
-
-    delta = interfaceutil.Attribute(
-        """Delta between ``basenode`` and ``node``.
-
-        Stored in the bdiff delta format.
-        """
-    )
-
-    sidedata = interfaceutil.Attribute(
-        """Raw sidedata bytes for the given revision."""
-    )
-
-    protocol_flags = interfaceutil.Attribute(
-        """Single byte of integer flags that can influence the protocol.
-
-        This is a bitwise composition of the ``storageutil.CG_FLAG*`` constants.
-        """
-    )
+    node: bytes
+    """20 byte node of this revision."""
+
+    p1node: bytes
+    """20 byte node of 1st parent of this revision."""
+
+    p2node: bytes
+    """20 byte node of 2nd parent of this revision."""
+
+    # TODO: is this really optional? revlog.revlogrevisiondelta defaults to None
+    linknode: bytes | None
+    """20 byte node of the changelog revision this node is linked to."""
+
+    flags: int
+    """2 bytes of integer flags that apply to this revision.
+
+    This is a bitwise composition of the ``REVISION_FLAG_*`` constants.
+    """
+
+    basenode: bytes
+    """20 byte node of the revision this data is a delta against.
+
+    ``nullid`` indicates that the revision is a full revision and not
+    a delta.
+    """
+
+    baserevisionsize: int | None
+    """Size of base revision this delta is against.
+
+    May be ``None`` if ``basenode`` is ``nullid``.
+    """
+
+    # TODO: is this really optional? (Seems possible in
+    #  storageutil.emitrevisions()).
+    revision: bytes | None
+    """Raw fulltext of revision data for this node."""
+
+    delta: bytes | None
+    """Delta between ``basenode`` and ``node``.
+
+    Stored in the bdiff delta format.
+    """
+
+    sidedata: bytes | None
+    """Raw sidedata bytes for the given revision."""
+
+    protocol_flags: int
+    """Single byte of integer flags that can influence the protocol.
+
+    This is a bitwise composition of the ``storageutil.CG_FLAG*`` constants.
+    """
 
 
 class ifilerevisionssequence(Protocol):