§
    cÌcÏI  ã                   ó  — d dl Z d dlZd dlZddlmZ ddlmZ  e e¦   «         d¦  «          G d„ dej        ¦  «        Z	 G d„ d	ej        ¦  «        Z
 G d
„ dej        ¦  «        Z G d„ d¦  «        Z G d„ d¦  «        Z G d„ d¦  «        ZdS )é    Né   )Úerrors)Úlazy_importz[
from breezy import (
    merge,
    transform,
)
from breezy.bzr import (
    pack,
    )
c                   ó   — e Zd ZdZdS )ÚShelfCorruptzShelf corrupt.N)Ú__name__Ú
__module__Ú__qualname__Ú_fmt© ó    ú./usr/lib/python3/dist-packages/breezy/shelf.pyr   r   #   s   € € € € € à€D€D€Dr   r   c                   ó   — e Zd ZdZd„ ZdS )ÚNoSuchShelfIdz.No changes are shelved with id "%(shelf_id)d".c                 óH   — t           j                             | |¬¦  «         d S )N)Úshelf_id©r   ÚBzrErrorÚ__init__©Úselfr   s     r   r   zNoSuchShelfId.__init__,   s#   € ÝŒ× Ò  °Ð Ñ9Ô9Ð9Ð9Ð9r   N©r   r	   r
   r   r   r   r   r   r   r   (   s(   € € € € € à;€Dð:ð :ð :ð :ð :r   r   c                   ó   — e Zd ZdZd„ ZdS )ÚInvalidShelfIdz?"%(invalid_id)s" is not a valid shelf id, try a number instead.c                 óH   — t           j                             | |¬¦  «         d S )N)Ú
invalid_idr   )r   r   s     r   r   zInvalidShelfId.__init__4   s#   € ÝŒ× Ò  °*Ð Ñ=Ô=Ð=Ð=Ð=r   Nr   r   r   r   r   r   0   s(   € € € € € àL€Dð>ð >ð >ð >ð >r   r   c                   óº   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
ed
„ ¦   «         Zd„ Zd„ Zd„ Z	 dd„Zd„ Zd„ Zd„ Zedd„¦   «         Zdd„Zedd„¦   «         ZdS )ÚShelfCreatorz5Create a transform to shelve objects and its inverse.Nc                 ó|  — || _         |                     ¦   «         | _        	 || _        | j                             ¦   «         | _        	 i | _        i | _        i | _        | 	                    | j        |¬¦  «        | _	        dS #  | j         
                    ¦   «          ‚ xY w#  | j         
                    ¦   «          ‚ xY w)a‘  Constructor.

        :param work_tree: The working tree to apply changes to. This is not
            required to be locked - a tree_write lock will be taken out.
        :param target_tree: The tree to make the working tree more similar to.
            This is not required to be locked - a read_lock will be taken out.
        :param file_list: The files to make more similar to the target.
        )Úspecific_filesN)Ú	work_treeÚ	transformÚwork_transformÚtarget_treeÚpreview_transformÚshelf_transformÚrenamesÚcreationÚdeletionÚiter_changesÚfinalize)r   r!   r$   Ú	file_lists       r   r   zShelfCreator.__init__;   sÌ   € ð #ˆŒØ'×1Ò1Ñ3Ô3ˆÔð	Ø*ˆDÔØ#'Ô#3×#EÒ#EÑ#GÔ#GˆDÔ ðØ!�”Ø "�”Ø "�”Ø$-×$:Ò$:ØÔ$°Yð %;ñ %@ô %@�Ô!Ð!Ð!øðØÔ$×-Ò-Ñ/Ô/Ð/Øøøøøð	ØÔ×(Ò(Ñ*Ô*Ð*Øøøøs   ¢%B Á6B  Â BÂB ÂB;c              #   óú  K  — | j         D �]o}|j        d         €|j        d         dk    rŒ"|j        d         €|j        d         dk    rŒA|j        d         �|j        d         du r]|j        d         |j        d         |j        d         |j        f| j        |j        <   d|j        |j        d         |j        d         fV — Œº|j        d         �|j        d         du r^|j        d         |j        d         |j        d         |j        f| j        |j        <   d|j        |j        d         |j        d         fV — �Œ4|j        d         |j        d         k    s|j        d         |j        d         k    r.|j        |j        f| j	        |j        <   d|j        f|j        z   V — |j        d         |j        d         k    r1d	|j        |j        d         |j        d         |j        d         fV — �Œç|j        d         d
k    re| j
                             |j        d         ¦  «        }| j                             |j        d         ¦  «        }d|j        |j        d         ||fV — �Œ]|j        rd|j        fV — �ŒqdS )aö  Iterable of tuples describing shelvable changes.

        As well as generating the tuples, this updates several members.
        Tuples may be::

           ('add file', file_id, work_kind, work_path)
           ('delete file', file_id, target_kind, target_path)
           ('rename', file_id, target_path, work_path)
           ('change kind', file_id, target_kind, work_kind, target_path)
           ('modify text', file_id)
           ('modify target', file_id, target_target, work_target)
        r   Nr   Ú Fúadd fileúdelete fileÚrenameúchange kindÚsymlinkúmodify targetúmodify text)r*   ÚkindÚnameÚ	versionedÚ	parent_idr(   Úfile_idÚpathr)   r'   r$   Úget_symlink_targetr!   Úchanged_content)r   ÚchangeÚt_targetÚw_targets       r   Úiter_shelvablezShelfCreator.iter_shelvableV   s‘  è è € ð Ô'ð 	:ñ 	:ˆFð
 Œ{˜1Œ~Ð%¨&¬+°a¬.¸BÒ*>Ð*>ØàŒ{˜1Œ~Ð%¨&¬+°a¬.¸BÒ*>Ð*>ØØŒ{˜1Œ~Ð%¨Ô)9¸!Ô)<ÀÐ)EÐ)Eà”K ”N F¤K°¤N°FÔ4DÀQÔ4GÈÔIYð1[�”˜fœnÑ-à! 6¤>°6´;¸q´>À6Ä;ÈqÄ>ÐRÐRÐRÐRÐRØ”˜Q”Ð'¨6Ô+;¸AÔ+>À%Ð+GÐ+Gà”K ”N F¤K°¤N°FÔ4DÀQÔ4GÈÔIYð1[�”˜fœnÑ-à$ f¤n°f´kÀ!´nÀfÄkÐRSÄnÐUÐUÐUÐUÑUà”;˜q”> V¤[°¤^Ò3Ð3°vÔ7GÈÔ7JÈfÔN^Ð_`ÔNaÒ7aÐ7aØ4:´KÀÔAQÐ3R�D”L ¤Ñ0Ø# V¤^Ð4°v´{ÑBÐBÐBÐBà”;˜q”> V¤[°¤^Ò3Ð3Ø(¨&¬.¸&¼+Àa¼.È&Ì+ÐVWÌ.ÐZ`ÔZeÐfgÔZhÐiÐiÐiÐiÑiØ”[ ”^ yÒ0Ð0Ø#Ô/×BÒBÀ6Ä;ÈqÄ>ÑRÔR�HØ#œ~×@Ò@ÀÄÈQÄÑPÔP�HØ*¨F¬N¸F¼KÈ¼NÈHØ#ð%ð %ð %ð %ñ %àÔ+ð :Ø(¨&¬.Ð9Ð9Ð9Ð9ùð?	:ð 	:r   c                 óÈ  — |d         dk    r|                       |d         ¦  «         d	S |d         dk    r|                      |d         ¦  «         d	S |d         dk    r|                      |d         ¦  «         d	S |d         dv r|                      |d         ¦  «         d	S |d         dk    r|                      |d         ¦  «         d	S t          d|d         z  ¦  «        ‚)
z-Shelve a change in the iter_shelvable format.r   r1   r   r0   r/   )r2   r5   r4   zUnknown change kind: "%s"N)Úshelve_renameÚshelve_deletionÚshelve_creationÚshelve_content_changeÚshelve_modify_targetÚ
ValueError©r   r>   s     r   Úshelve_changezShelfCreator.shelve_change„   sü   € à�!Œ9˜Ò Ð Ø×Ò˜v aœyÑ)Ô)Ð)Ð)Ð)Ø�AŒY˜-Ò'Ð'Ø× Ò  ¨¤Ñ+Ô+Ð+Ð+Ð+Ø�AŒY˜*Ò$Ð$Ø× Ò  ¨¤Ñ+Ô+Ð+Ð+Ð+Ø�AŒYÐ8Ð8Ð8Ø×&Ò& v¨a¤yÑ1Ô1Ð1Ð1Ð1Ø�AŒY˜/Ò)Ð)Ø×%Ò% f¨Q¤iÑ0Ô0Ð0Ð0Ð0åÐ8¸6À!¼9ÑDÑEÔEÐEr   c                 óf   — d}|                       ¦   «         D ]}|                      |¦  «         Œ|duS )zeShelve all changes.

        :return: ``True`` if changes were shelved, otherwise ``False``.
        N)rA   rJ   rI   s     r   Ú
shelve_allzShelfCreator.shelve_all“   sF   € ð
 ˆØ×)Ò)Ñ+Ô+ð 	'ð 	'ˆFØ×Ò˜vÑ&Ô&Ð&Ð&Ø˜TÐ!Ð!r   c                 ó–  — | j         |         \  }}| j                             |¦  «        }| j                             |d         ¦  «        }| j                             |d         ||¦  «         | j                             |¦  «        }| j                             |d         ¦  «        }| j                             |d         ||¦  «         dS )zjShelve a file rename.

        :param file_id: The file id of the file to shelve the renaming of.
        r   r   N)r'   r#   Útrans_id_file_idÚadjust_pathr&   )r   r:   ÚnamesÚparentsÚ
w_trans_idÚwork_parentÚ
s_trans_idÚshelf_parents           r   rC   zShelfCreator.shelve_rename�   s¸   € ð
 œ gÔ.‰ˆˆwØÔ(×9Ò9¸'ÑBÔBˆ
ØÔ)×:Ò:¸7À1¼:ÑFÔFˆØÔ×'Ò'¨¨a¬°+¸zÑJÔJÐJàÔ)×:Ò:¸7ÑCÔCˆ
ØÔ+×<Ò<¸WÀQ¼ZÑHÔHˆØÔ×(Ò(¨¨q¬°<ÀÑLÔLÐLÐLÐLr   c                 ó  — | j                              |¦  «        }| j                              |¦  «        }| j                             |¦  «        }| j                             |¦  «         | j                             ||¦  «         | j                             |¦  «        }| j                             |¦  «        }| j                             |¦  «        }| j                             |¦  «         | j                             ||¦  «         dS )zÕShelve a change of symlink target.

        :param file_id: The file id of the symlink which changed target.
        :param new_target: The target that the symlink should have due
            to shelving.
        N)	r$   Úid2pathr<   r#   rN   Údelete_contentsÚcreate_symlinkr!   r&   )r   r:   Únew_pathÚ
new_targetrR   Úold_pathÚ
old_targetrT   s           r   rG   z!ShelfCreator.shelve_modify_target«   sì   € ð Ô#×+Ò+¨GÑ4Ô4ˆØÔ%×8Ò8¸ÑBÔBˆ
ØÔ(×9Ò9¸'ÑBÔBˆ
ØÔ×+Ò+¨JÑ7Ô7Ð7ØÔ×*Ò*¨:°zÑBÔBÐBà”>×)Ò)¨'Ñ2Ô2ˆØ”^×6Ò6°xÑ@Ô@ˆ
ØÔ)×:Ò:¸7ÑCÔCˆ
ØÔ×,Ò,¨ZÑ8Ô8Ð8ØÔ×+Ò+¨J¸
ÑCÔCÐCÐCÐCr   c                 ón  — | j                              |¦  «        }| j                              |¦  «         | j                              ||¦  «         | j                             |¦  «        }| j                             |¦  «         |                      ||¦  «        }| j                             ||¦  «         dS )zÔShelve text changes to a file, using provided lines.

        :param file_id: The file id of the file to shelve the text of.
        :param new_lines: The lines that the file should have due to shelving.
        N)r#   rN   rX   Úcreate_filer&   Ú_inverse_lines)r   r:   Ú	new_linesrR   rT   Úinverse_liness         r   Úshelve_lineszShelfCreator.shelve_lines¾   s«   € ð Ô(×9Ò9¸'ÑBÔBˆ
ØÔ×+Ò+¨JÑ7Ô7Ð7ØÔ×'Ò'¨	°:Ñ>Ô>Ð>àÔ)×:Ò:¸7ÑCÔCˆ
ØÔ×,Ò,¨ZÑ8Ô8Ð8Ø×+Ò+¨I°wÑ?Ô?ˆØÔ×(Ò(¨¸
ÑCÔCÐCÐCÐCr   c                 óº   — |                       |¦  «        }|                      |¦  «         t                               | |||                     |¦  «        ¦  «         d S ©N)rN   rX   r"   Úcreate_from_treerW   )ÚttÚtreer:   Útrans_ids       r   Ú_content_from_treezShelfCreator._content_from_treeÍ   sU   € à×&Ò& wÑ/Ô/ˆØ
×Ò˜8Ñ$Ô$Ð$Ý×"Ò" 2 x°°t·|²|ÀGÑ7LÔ7LÑMÔMÐMÐMÐMr   c                 óŠ   — |                       | j        | j        |¦  «         |                       | j        | j        |¦  «         dS )zšShelve a kind change or binary file content change.

        :param file_id: The file id of the file to shelve the content change
            of.
        N)rj   r#   r$   r&   r!   )r   r:   s     r   rF   z"ShelfCreator.shelve_content_changeÓ   sE   € ð 	×Ò Ô 3°TÔ5EÀwÑOÔOÐOØ×Ò Ô 4°d´nÀgÑNÔNÐNÐNÐNr   c           
      ó’   — | j         |         \  }}}}|d          }|                      | j        || j        | j        ||||¦  «         dS )zšShelve creation of a file.

        This handles content and inventory id.
        :param file_id: The file_id of the file to shelve creation of.
        r   N)r(   Ú_shelve_creationr!   r#   r&   )r   r:   r6   r7   Úparentr8   Úversions          r   rE   zShelfCreator.shelve_creationÜ   sa   € ð )-¬°gÔ(>Ñ%ˆˆd�F˜IØ ”lÐ"ˆØ×Ò˜dœn¨g°tÔ7JØ"Ô2°D¸$ÀØ%ñ	'ô 	'ð 	'ð 	'ð 	'r   c                 ó  — | j         |         \  }}}}| j                             |¦  «        }| j                             |¦  «        sd}|d          }|                      | j        || j        | j        |||||¬¦	  «	         dS )zšShelve deletion of a file.

        This handles content and inventory id.
        :param file_id: The file_id of the file to shelve deletion of.
        Nr   )Úexisting_path)r)   r$   rW   r!   Úhas_filenamerm   r&   r#   )r   r:   r6   r7   rn   r8   rq   ro   s           r   rD   zShelfCreator.shelve_deletionè   s¡   € ð )-¬°gÔ(>Ñ%ˆˆd�F˜IØÔ(×0Ò0°Ñ9Ô9ˆØŒ~×*Ò*¨=Ñ9Ô9ð 	!Ø ˆMØ ”lÐ"ˆØ×Ò˜dÔ.°¸Ô9MØ"Ô1°4¸¸vØ%°]ð 	ñ 	Dô 	Dð 	Dð 	Dð 	Dr   c
                 ó  — |                      |¦  «        }
|�|�|                     |
¦  «         |                     |
¦  «         |	�|                     |	¦  «        }n|                      |¦  «        }|�x|                      |¦  «        }|                     |||¦  «         |	€J|€|                     dg|¦  «         n0t                               ||||                     |¦  «        ¦  «         |r| 	                    ||¬¦  «         d S d S )Nr   )r:   )
rN   rX   Úunversion_fileÚtrans_id_tree_pathrO   r_   r"   rf   rW   Úversion_file)r   rh   r:   Úfrom_transformÚto_transformr6   r7   rn   ro   rq   rR   rT   Ús_parent_ids                r   rm   zShelfCreator._shelve_creation÷   s1  € à#×4Ò4°WÑ=Ô=ˆ
ØÐ $Ð"2Ø×*Ò*¨:Ñ6Ô6Ð6Ø×%Ò% jÑ1Ô1Ð1àÐ$Ø%×8Ò8¸ÑGÔGˆJˆJà%×6Ò6°wÑ?Ô?ˆJØÐØ&×7Ò7¸Ñ?Ô?ˆKØ×$Ò$ T¨;¸
ÑCÔCÐCØÐ$Ø�<Ø ×,Ò,¨c¨U°JÑ?Ô?Ð?Ð?å×.Ò.Ø$ j°$ØŸš WÑ-Ô-ñ/ô /ð /ð ð 	CØ×%Ò% j¸'Ð%ÑBÔBÐBÐBÐBð	Cð 	Cr   c                 ó2  — | j                              |¦  «        }| j                              |¦  «        }| j                             |¦  «        }| j                             |¦  «        }ddlm} ddl} |||||j        ¬¦  «                             ¦   «         S )zAProduce a version with only those changes removed from new_lines.r   )ÚMerge3N)Úsequence_matcher)	r$   rW   Úget_file_linesr!   Úmerge3r{   ÚpatiencediffÚPatienceSequenceMatcherÚmerge_lines)	r   ra   r:   Útarget_pathÚtarget_linesÚ	work_pathÚ
work_linesr{   r   s	            r   r`   zShelfCreator._inverse_lines  s§   € àÔ&×.Ò.¨wÑ7Ô7ˆØÔ'×6Ò6°{ÑCÔCˆØ”N×*Ò*¨7Ñ3Ô3ˆ	Ø”^×2Ò2°9Ñ=Ô=ˆ
Ø!Ð!Ð!Ð!Ð!Ð!ØÐÐÐØˆvØ�| ZØ)ÔAðñ ô ÷ Šk‰mŒmð	r   c                 ój   — | j                              ¦   «          | j                             ¦   «          dS )z0Release all resources used by this ShelfCreator.N)r#   r+   r&   ©r   s    r   r+   zShelfCreator.finalize  s2   € àÔ×$Ò$Ñ&Ô&Ð&ØÔ×%Ò%Ñ'Ô'Ð'Ð'Ð'r   c                 ó8   — | j                              ¦   «          dS )z!Shelve changes from working tree.N)r#   Úapplyr‡   s    r   r"   zShelfCreator.transform!  s   € àÔ×!Ò!Ñ#Ô#Ð#Ð#Ð#r   c                 óŽ   — d|i}|�|                      d¦  «        |d<   |                      t          j        |¦  «        d¦  «        S )Nó   revision_idúutf-8ó   message)©s   metadata)ÚencodeÚbytes_recordÚbencode)Ú
serializerÚrevision_idÚmessageÚmetadatas       r   Úmetadata_recordzShelfCreator.metadata_record%  sP   € à" KÐ0ˆØÐØ#*§>¢>°'Ñ#:Ô#:ˆH�ZÑ Ø×&Ò&ÝŒO˜HÑ%Ô%Ð'8ñ:ô :ð 	:r   c                 ó¬   — t                                | j        ¦  «         | j                             ¦   «         }|                      || j        ||¦  «        S )zöSerialize the shelved changes to a file.

        :param shelf_file: A file-like object to write the shelf to.
        :param message: An optional message describing the shelved changes.
        :return: the filename of the written file.
        )r"   Úresolve_conflictsr&   r$   Úget_revision_idÚ_write_shelf)r   Ú
shelf_filer”   r“   s       r   Úwrite_shelfzShelfCreator.write_shelf-  sS   € õ 	×#Ò# DÔ$8Ñ9Ô9Ð9ØÔ&×6Ò6Ñ8Ô8ˆØ× Ò  ¨TÔ-AÀ;Ø!(ñ*ô *ð 	*r   c                 ó†  — t                                ¦   «         }|                     |                     ¦   «         ¦  «         |                      |||¦  «        }|                     |¦  «         |                     |¦  «        D ]}|                     |¦  «         Œ|                     |                     ¦   «         ¦  «         d S re   )ÚpackÚContainerSerialiserÚwriteÚbeginr–   Ú	serializeÚend)Úclsr›   r"   r“   r”   r’   r•   Úbytess           r   rš   zShelfCreator._write_shelf9  s¶   € å×-Ò-Ñ/Ô/ˆ
Ø×Ò˜×)Ò)Ñ+Ô+Ñ,Ô,Ð,Ø×&Ò& z°;ÀÑHÔHˆØ×Ò˜Ñ"Ô"Ð"Ø×(Ò(¨Ñ4Ô4ð 	$ð 	$ˆEØ×Ò˜UÑ#Ô#Ð#Ð#Ø×Ò˜ŸšÑ)Ô)Ñ*Ô*Ð*Ð*Ð*r   re   )r   r	   r
   Ú__doc__r   rA   rJ   rL   rC   rG   rc   Ústaticmethodrj   rF   rE   rD   rm   r`   r+   r"   r–   rœ   Úclassmethodrš   r   r   r   r   r   8   s†  € € € € € Ø?Ð?ðð ð ð ð6,:ð ,:ð ,:ð\Fð Fð Fð"ð "ð "ðMð Mð MðDð Dð Dð&Dð Dð Dð ðNð Nñ „\ðNð
Oð Oð Oð
'ð 
'ð 
'ðDð Dð Dð  EIðCð Cð Cð Cð0ð ð ð(ð (ð (ð
$ð $ð $ð ð:ð :ð :ñ „\ð:ð
*ð 
*ð 
*ð 
*ð ð+ð +ð +ñ „[ð+ð +ð +r   r   c                   óf   — e Zd ZdZd„ Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Z	d„ Z
d„ ZdS )	Ú	UnshelverzUnshelve shelved changes.c                 ó>   — || _         || _        || _        || _        dS )zÉConstructor.

        :param tree: The tree to apply the changes to.
        :param base_tree: The basis to apply the tranform to.
        :param message: A message from the shelved transform.
        N)rh   Ú	base_treer"   r”   )r   rh   r¬   r"   r”   s        r   r   zUnshelver.__init__G  s$   € ð ˆŒ	Ø"ˆŒØ"ˆŒØˆŒˆˆr   c                 óÄ   — t                                ¦   «         }|                     |                      ¦   «         ¦  «         t	          |                     ¦   «         ¦  «        S re   )rž   ÚContainerPushParserÚaccept_bytesÚreadÚiterÚread_pending_records)r›   Úparsers     r   Úiter_recordszUnshelver.iter_recordsS  sK   € å×)Ò)Ñ+Ô+ˆØ×Ò˜JŸOšOÑ-Ô-Ñ.Ô.Ð.Ý�F×/Ò/Ñ1Ô1Ñ2Ô2Ð2r   c                 óÖ   — t          | ¦  «        \  }}|d         dk    rt          ‚t          j        |¦  «        }|                     d¦  «        }|�|                     d¦  «        |d<   |S )Nr   rŽ   r�   rŒ   )Únextr   r‘   ÚbdecodeÚgetÚdecode)ÚrecordsrP   Úmetadata_bytesr•   r”   s        r   Úparse_metadatazUnshelver.parse_metadataY  sh   € å $ W¡¤Ñˆˆ~Ø�Œ8�~Ò%Ð%ÝÐÝ”? >Ñ2Ô2ˆØ—,’,˜zÑ*Ô*ˆØÐØ#*§>¢>°'Ñ#:Ô#:ˆH�ZÑ Øˆr   c                 ó�  — |                       |¦  «        }|                      |¦  «        }|d         }	 |                     |¦  «        }n4# t          j        $ r" |j        j                             |¦  «        }Y nw xY w|                     ¦   «         }|                     |¦  «          | |||| 	                    d¦  «        ¦  «        S )zàCreate an Unshelver from a tree and a shelf file.

        :param tree: The tree to apply shelved changes to.
        :param shelf_file: A file-like object containing shelved changes.
        :return: The Unshelver.
        r‹   r�   )
r´   r¼   Úrevision_treer   ÚNoSuchRevisionInTreeÚbranchÚ
repositoryr%   Údeserializer¸   )Úklassrh   r›   rº   r•   Úbase_revision_idr¬   rg   s           r   Úfrom_tree_and_shelfzUnshelver.from_tree_and_shelfd  sÕ   € ð ×$Ò$ ZÑ0Ô0ˆØ×'Ò'¨Ñ0Ô0ˆØ# NÔ3Ðð	OØ×*Ò*Ð+;Ñ<Ô<ˆIˆIøÝÔ*ð 	Oð 	Oð 	OØœÔ.×<Ò<Ð=MÑNÔNˆIˆIˆIð	Oøøøà×(Ò(Ñ*Ô*ˆØ
�Š�wÑÔÐØˆu�T˜9 b¨(¯,ª,°zÑ*BÔ*BÑCÔCÐCs   ´A
 Á
.A;Á:A;c                 ó°   — | j                              ¦   «         }t          j                             | j        || j        ¦  «        }t          j        |_        |S )z.Return a merger that can unshelve the changes.)	r"   Úget_preview_treeÚmergeÚMergerÚfrom_uncommittedrh   r¬   ÚMerge3MergerÚ
merge_type)r   r$   Úmergers      r   Úmake_mergerzUnshelver.make_mergerw  sG   € à”n×5Ò5Ñ7Ô7ˆÝ”×.Ò.¨t¬y¸+Ø/3¬~ñ?ô ?ˆå!Ô.ˆÔØˆr   c                 ó8   — | j                              ¦   «          dS )z-Release all resources held by this Unshelver.N)r"   r+   r‡   s    r   r+   zUnshelver.finalize  s   € àŒ×ÒÑ!Ô!Ð!Ð!Ð!r   N)r   r	   r
   r¦   r   r§   r´   r¼   r¨   rÅ   rÎ   r+   r   r   r   rª   rª   D  s›   € € € € € Ø#Ð#ð
ð 
ð 
ð ð3ð 3ñ „\ð3ð
 ðð ñ „\ðð ðDð Dñ „[ðDð$ð ð ð"ð "ð "ð "ð "r   rª   c                   óV   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zdd„Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ ZdS )ÚShelfManagerz#Maintain a list of shelved changes.c                 óz   — || _         |                     d¦  «        | _        | j                             ¦   «          d S )NÚshelf)rh   ÚcloneÚ	transportÚensure_base)r   rh   rÕ   s      r   r   zShelfManager.__init__‡  s6   € ØˆŒ	Ø"Ÿš¨Ñ1Ô1ˆŒØŒ×"Ò"Ñ$Ô$Ð$Ð$Ð$r   c                 ó   — d|z  S )Nzshelf-%dr   r   s     r   Úget_shelf_filenamezShelfManager.get_shelf_filenameŒ  s   € Ø˜HÑ$Ð$r   c                 óÔ   — t          j        d¦  «        }g }|D ]N}|                     |¦  «        }|�5|                     t	          |                     d¦  «        ¦  «        ¦  «         ŒO|S )Nzshelf-([1-9][0-9]*)r   )ÚreÚcompileÚmatchÚappendÚintÚgroup)r   Ú	filenamesÚmatcherÚ	shelf_idsÚfilenamerÜ   s         r   Úget_shelf_idszShelfManager.get_shelf_ids�  sj   € Ý”*Ð2Ñ3Ô3ˆØˆ	Ø!ð 	6ð 	6ˆHØ—M’M (Ñ+Ô+ˆEØÐ Ø× Ò ¥ U§[¢[°¡^¤^Ñ!4Ô!4Ñ5Ô5Ð5øØÐr   c                 óÀ   — |                       ¦   «         }|€d}n|dz   }|                      |¦  «        }t          | j                             |¦  «        d¦  «        }||fS )z=Return a file object and id for a new set of shelved changes.Nr   Úwb)Ú
last_shelfrØ   ÚopenrÕ   Úlocal_abspath)r   rç   Ú
next_shelfrã   r›   s        r   Ú	new_shelfzShelfManager.new_shelf˜  sd   € à—_’_Ñ&Ô&ˆ
ØÐØˆJˆJà# a™ˆJØ×*Ò*¨:Ñ6Ô6ˆÝ˜$œ.×6Ò6°xÑ@Ô@À$ÑGÔGˆ
Ø˜:Ð%Ð%r   Nc                 óæ   — |                       ¦   «         \  }}	 |                     ||¦  «         |                     ¦   «          n# |                     ¦   «          w xY w|                     ¦   «          |S )z/Store the changes in a ShelfCreator on a shelf.)rë   rœ   Úcloser"   )r   Úcreatorr”   rê   r›   s        r   Úshelve_changeszShelfManager.shelve_changes£  sv   € à!%§¢Ñ!1Ô!1Ñˆ
�Jð	Ø×Ò 
¨GÑ4Ô4Ð4à×ÒÑÔÐÐøˆJ×ÒÑÔÐÐøøøØ×ÒÑÔÐØÐs   ™A ÁAc                 óì   — |                       |¦  «        }	 t          | j                             |¦  «        d¦  «        S # t          $ r*}|j        t
          j        k    r‚ t          |¦  «        ‚d}~ww xY w)z‡Return the file associated with a shelf_id for reading.

        :param shelf_id: The id of the shelf to retrive the file for.
        ÚrbN)rØ   rè   rÕ   ré   ÚOSErrorÚerrnoÚENOENTr   )r   r   rã   Úes       r   Ú
read_shelfzShelfManager.read_shelf­  s{   € ð
 ×*Ò*¨8Ñ4Ô4ˆð	*Ý˜œ×4Ò4°XÑ>Ô>ÀÑEÔEÐEøÝð 	*ð 	*ð 	*ØŒw�%œ,Ò&Ð&ØÝ Ñ)Ô)Ð)øøøøð	*øøøs   —'? ¿
A3Á	%A.Á.A3c                 óÈ   — |                       |¦  «        }	 t                               | j        |¦  «        |                     ¦   «          S # |                     ¦   «          w xY w)zvReturn an unshelver for a given shelf_id.

        :param shelf_id: The shelf id to return the unshelver for.
        )rö   rª   rÅ   rh   rí   )r   r   r›   s      r   Úget_unshelverzShelfManager.get_unshelverº  s\   € ð
 —_’_ XÑ.Ô.ˆ
ð	Ý×0Ò0°´¸JÑGÔGà×ÒÑÔÐÐøˆJ×ÒÑÔÐÐøøøs   —A ÁA!c                 óò   — |                       |¦  «        }	 t                               |¦  «        }|                     ¦   «          n# |                     ¦   «          w xY wt                               |¦  «        S )z5Return the metadata associated with a given shelf_id.)rö   rª   r´   rí   r¼   )r   r   r›   rº   s       r   Úget_metadatazShelfManager.get_metadataÅ  sl   € à—_’_ XÑ.Ô.ˆ
ð	Ý×,Ò,¨ZÑ8Ô8ˆGà×ÒÑÔÐÐøˆJ×ÒÑÔÐÐøøøÝ×'Ò'¨Ñ0Ô0Ð0s   —A ÁAc                 ód   — |                       |¦  «        }| j                             |¦  «         dS )zrDelete the shelved changes for a given id.

        :param shelf_id: id of the shelved changes to delete.
        N)rØ   rÕ   Údelete)r   r   rã   s      r   Údelete_shelfzShelfManager.delete_shelfÎ  s3   € ð
 ×*Ò*¨8Ñ4Ô4ˆØŒ×Ò˜hÑ'Ô'Ð'Ð'Ð'r   c                 óz   — t          |                      | j                             d¦  «        ¦  «        ¦  «        }|S )z!Return a list of shelved changes.ú.)Úsortedrä   rÕ   Úlist_dir©r   Úactives     r   Úactive_shelveszShelfManager.active_shelvesÖ  s2   € å˜×*Ò*¨4¬>×+BÒ+BÀ3Ñ+GÔ+GÑHÔHÑIÔIˆØˆr   c                 ód   — |                       ¦   «         }t          |¦  «        dk    r|d         S dS )z1Return the id of the last-created shelved change.r   éÿÿÿÿN)r  Úlenr  s     r   rç   zShelfManager.last_shelfÛ  s1   € à×$Ò$Ñ&Ô&ˆÝˆv‰;Œ;˜Š?ˆ?Ø˜"”:Ðà�4r   re   )r   r	   r
   r¦   r   rØ   rä   rë   rï   rö   rø   rú   rý   r  rç   r   r   r   rÑ   rÑ   „  sÄ   € € € € € Ø-Ð-ð%ð %ð %ð
%ð %ð %ðð ð ð	&ð 	&ð 	&ðð ð ð ð*ð *ð *ð	ð 	ð 	ð1ð 1ð 1ð(ð (ð (ðð ð ð
ð ð ð ð r   rÑ   )ró   rÚ   Úfastbencoder‘   r.   r   r   Úglobalsr   r   r   r   r   rª   rÑ   r   r   r   ú<module>r
     s„  ðð" €€€Ø 	€	€	€	à Ð Ð Ð à Ð Ð Ð Ð Ð Ø $Ð $Ð $Ð $Ð $Ð $Ø €ˆGˆG‰IŒIð ñ ô ð ðð ð ð ð �6”?ñ ô ð ð
:ð :ð :ð :ð :�F”Oñ :ô :ð :ð>ð >ð >ð >ð >�V”_ñ >ô >ð >ðI+ð I+ð I+ð I+ð I+ñ I+ô I+ð I+ðX="ð ="ð ="ð ="ð ="ñ ="ô ="ð ="ð@]ð ]ð ]ð ]ð ]ñ ]ô ]ð ]ð ]ð ]r   