0
  /   ˆ{‹„„-i[D<†ªoZƒ›Ù«À555_‘I|¥‰ÓMdœv ©ƒ†ü+=ÅÄ +    ‹      Å•]oÚ0…ïû+<_ì.y	mEC¦Ž �¦jšváØ&±šØ‘mFé¯Ÿ!°ÂÓºî*þ8ö{žËßÄ£îìó¸‡>Ìîhüéý ßEØ¸otâY\M4ýZ Ðb„3kË6Àr¹ô—_éfÈl‘7ÁX-¨õ™e8º×cÑ
3N˜û¢Ð
›ó¨/DjŽ@-¬Œ»�ËE’º ¦
†K69÷/”ŸŸ*UºBLQã“ïÔMX&#z½�B™•W~Ý{4yUEç¶&ÂD±ÕÚ[ðª>\¹M $ÙØY7uÚ}#¹He[Uâ(EŠŒ¦‚*i É‰|ðS1Çˆä¶ƒ¿ô»£¯N6[¯ŽB‚2Íçü®ÛÞŒ:1Ž†¤à!�ãš;§¹ÅÑ€‹
ÅÄ\pvR<­ÄSñtzÃ¸ÒÄÜP-J+”|–‚CÜG¥*7%q¬-G�é}U%a¿KƒÐƒ0Æ·“Þp÷'U$l½Å³»ôWq4vMiQ,4§VéÕ–¸*ÿV&¦¼ÙuÑ–G‹4³8BÈCG•UE©¹1œíGáb>Â°w?õcž"ýôÉ�Žƒþ¾óŸ¬ÖkõK/¼zÍv+@è„ðêòò•™hFdÊs•îƒ<“®Õ®OÒ]û��ÿ‹îëexPóïyòAª¥<F•«måÍ—8t¨ÑüÆ™wloã6oBÕ{õQ«êõ    H   ˆl–Ü4ý('ÜZÔâ€vã,ÜÅ£“þ[fEœl�É#Í6ä¯	i½š¿çÃÁÀÂ440_‹I|¥Žƒî4ÃVŸÇÆ ¸    ‹      }”MSƒ0†ïùË¥L¥zF½xñPý¥lH::uZþ»!KøÈ�i²}v÷Í»–�„,€åŸ¿ÙA¤�H‘ÁÒÛš€÷“/}B¶®KÀ…W‘�BIs8‡i©~
y�^iŒC˜G”ÇŒƒ�1•žÊ©ÓžO’�Ã‚â:”aW·Â"ðu¤ÍJU‹°�g‘B5�šÄÕ4/iQJžÃ•—Ù�Ê
vM@å N­J	�YBB¢ž½.¶¯KlIRò¨`‚›Â/æ@+Mm°ÿ®€%€Qp‚ ÿ(}Zã{þFÆitdÉcŒn4‹¼b?Ê4mÁ@�\,fG“”^Ø™@Ô6$›yíhQëZÓ(T’û
ÑÚj¶QˆàX¡fú
;P¯,r¬=lÖö®œ®ïbN?¯Þ÷OªöèÈ“™ÅíÖ6\YäàèfßIo{Muž(l°ù²ÃDgpAæag8|sÍ ðÊÃƒ¯÷UÏ¸�.Û(ÛH4îqÊ¸19mÝÊ¶×Tç‰Â›/kg»<;¶©–qw=çê§	ßû¤"„^ô·Q½a™£O‚Oþ 
õÓ"=    Z   	ˆl–äY>”JeJe@†à¸Û*bÑ¿�þYeÈÖnP¸VDHÓ@þÅ„!qŸÄ_ŠI|¥�+Wé3ž¯a–äY>” ”¾R( 	Å+�9q�)‹FÿÉ 3k    	import threading

from mercurial.node import (
    hex,
    sha1nodeconstants,
)
from mercurial.pycompat import getattr
from mercurial import (
    mdiff,
    revlog,
)
from . import (
    basestore,
    constants,
    shallowutil,
)


class ChainIndicies:
    """A static class for easy reference to the delta chain indicies."""

    # The filename of this revision delta
    NAME = 0
    # The mercurial file node for this revision delta
    NODE = 1
    # The filename of the delta base's revision. This is useful when delta
    # between different files (like in the case of a move or copy, we can delta
    # against the original file content).
    BASENAME = 2
    # The mercurial file node for the delta base revision. This is the nullid if
    # this delta is a full text.
    BASENODE = 3
    # The actual delta or full text data.
    DATA = 4


class unioncontentstore(basestore.baseunionstore):
    def __init__(self, *args, **kwargs):
        super(unioncontentstore, self).__init__(*args, **kwargs)

        self.stores = args
        self.writestore = kwargs.get('writestore')

        # If allowincomplete==True then the union store can return partial
        # delta chains, otherwise it will throw a KeyError if a full
        # deltachain can't be found.
        self.allowincomplete = kwargs.get('allowincomplete', False)

    def get(self, name, node):
        """Fetches the full text revision contents of the given name+node pair.
        If the full text doesn't exist, throws a KeyError.

        Under the hood, this uses getdeltachain() across all the stores to build
        up a full chain to produce the full text.
        """
        chain = self.getdeltachain(name, node)

        if chain[-1][ChainIndicies.BASENODE] != sha1nodeconstants.nullid:
            # If we didn't receive a full chain, throw
            raise KeyError((name, hex(node)))

        # The last entry in the chain is a full text, so we start our delta
        # applies with that.
        fulltext = chain.pop()[ChainIndicies.DATA]

        text = fulltext
        while chain:
            delta = chain.pop()[ChainIndicies.DATA]
            text = mdiff.patches(text, [delta])

        return text

    @basestore.baseunionstore.retriable
    def getdelta(self, name, node):
        """Return the single delta entry for the given name/node pair."""
        for store in self.stores:
            try:
                return store.getdelta(name, node)
            except KeyError:
                pass

        raise KeyError((name, hex(node)))

    def getdeltachain(self, name, node):
        """Returns the deltachain for the given name/node pair.

        Returns an ordered list of:

          [(name, node, deltabasename, deltabasenode, deltacontent),...]

        where the chain is terminated by a full text entry with a null