##// END OF EJS Templates
localrepo: subclass the new `repository.ipeercommandexecutor` Protocol class...
localrepo: subclass the new `repository.ipeercommandexecutor` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. See 4ef6dbc27a99 for the benefits of explicit subclassing. Since we're direct subclassing here and there are only a few methods on this interface, also make them abstract like was done in ef119f914fc1.

File last commit:

r53348:f5d134e5 default
r53393:e123c8a2 default
Show More
status.py
53 lines | 1.4 KiB | text/x-python | PythonLexer
Matt Harbison
interfaces: add a Protocol class for `scmutil.status`...
r53347 # status.py - Type annotations for status related objects
#
# Copyright Matt Harbison <mharbison72@gmail.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import annotations
Matt Harbison
scmutil: explicitly subclass the `Status` protocol...
r53348 import abc
Matt Harbison
interfaces: add a Protocol class for `scmutil.status`...
r53347 from typing import (
Iterator,
Protocol,
)
class Status(Protocol):
"""Struct with a list of files per status.
The 'deleted', 'unknown' and 'ignored' properties are only
relevant to the working copy.
"""
modified: list[bytes]
"""The list of files with modifications."""
added: list[bytes]
"""The list of files that started being tracked."""
removed: list[bytes]
"""The list of files that stopped being tracked."""
deleted: list[bytes]
"""The list of files in the working directory that are deleted from the
file system (but not in the removed state)."""
unknown: list[bytes]
"""The list of files in the working directory that are not tracked."""
ignored: list[bytes]
"""The list of files in the working directory that are ignored."""
clean: list[bytes]
"""The list of files that are not in any other state."""
Matt Harbison
scmutil: explicitly subclass the `Status` protocol...
r53348 @abc.abstractmethod
Matt Harbison
interfaces: add a Protocol class for `scmutil.status`...
r53347 def __iter__(self) -> Iterator[list[bytes]]:
"""Iterates over each of the categories of file lists."""
Matt Harbison
scmutil: explicitly subclass the `Status` protocol...
r53348 @abc.abstractmethod
Matt Harbison
interfaces: add a Protocol class for `scmutil.status`...
r53347 def __repr__(self) -> str:
"""Creates a string representation of the file lists."""