Normal
  5   ˆl–ßi~”Ji?u8 [¸Ûw ê˜´o�þB gŒ€jOç¿ƒh¹ÄÂÁ      00000042
  6   	ˆl–ßi~”Ji?u8 [¸Ë÷˜´o�þB gy·_xµüÿÀƒh¹ÅÃÂ      	00000032
  B   ˆl–Ü4ý( ©”u( 	•íÀà™S�ÿ�þ_rHÖnQðÈ0„¤óÁ„eçÿÆ_ŠI|¥�+Wé3ž¯ÅÄ ?÷     # Copyright (C) 2005-2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

"""Tree classes, representing directory at point in time.
"""

__docformat__ = "google"

from typing import List, Type, TYPE_CHECKING, Optional, Iterator, Dict, Union, cast

from . import (
    errors,
    lock,
    osutils,
    revision as _mod_revision,
    trace,
    )
from .inter import InterObject


class FileTimestampUnavailable(errors.BzrError):

    _fmt = "The filestamp for %(path)s is not available."

    internal_error = True

    def __init__(self, path):
        self.path = path


class MissingNestedTree(errors.BzrError):

    _fmt = "The nested tree for %(path)s can not be resolved."""

    def __init__(self, path):
        self.path = path


class TreeEntry:
    """An entry that implements the minimum interface used by commands.
    """

    __slots__: List[str] = []

    def __eq__(self, other):
        # yes, this is ugly, TODO: best practice __eq__ style.
        return (isinstance(other, TreeEntry)
                and other.__class__ == self.__class__)

    kind: str

    def kind_character(self):
        return "???"

    def is_unmodified(self, other):
        """Does this entry reference the same entry?

        This is mostly the same as __eq__, but returns False
        for entries without enough information (i.e. revision is None)
        """
        return False


class TreeDirectory(TreeEntry):
    """See TreeEntry. This is a directory in a working tree."""

    __slots__: List[str] = []

    kind = 'directory'

    def kind_character(self):
        return "/"


class TreeFile(TreeEntry):
    """See TreeEntry. This is a regular file in a working tree."""

    __slots__: List[str] = []

    kind = 'file'

    def kind_character(self):
        return ''


class TreeLink(TreeEntry):
    """See TreeEntry. This is a symlink in a working tree."""

    __slots__: List[str] = []

    kind = 'symlink'

    def kind_character(self):
        return ''


class TreeReference(TreeEntry):
    """See TreeEntry. This is a reference to a nested tree in a working tree."""

    __slots__: List[str] = []

    kind = 'tree-reference'

    def kind_character(self):
        return '+'


class TreeChange:
    """Describes the changes between the same item in two different trees."""

    __slots__ = ['path', 'changed_content', 'versioned',
                 'name', 'kind', 'executable', 'copied']

    def __init__(self, path, changed_content, versioned,
                 name, kind, executable, copied=False):
        self.path = path
        self.changed_content = changed_content
        self.versioned = versioned
        self.name = name
        self.kind = kind
        self.executable = executable
        self.copied = copied

    def __repr__(self):
        return "{}{!r}".format(self.__class__.__name__, self._as_tuple())

    def _as_tuple(self):
        return (self.path, self.changed_content, self.versioned,
                self.name, self.kind, self.executable, self.copied)

    def __eq__(self, other):
        if isinstance(other, TreeChange):
            return self._as_tuple() == other._as_tuple()
        if isinstance(other, tuple):