403Webshell
Server IP : 50.21.180.56  /  Your IP : 216.73.216.208
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67922704 ( 67922704)
PHP Version : 8.5.13
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/lib/python3/dist-packages/breezy/bzr/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/lib/python3/dist-packages/breezy/bzr/__pycache__/inventory.cpython-313.pyc
�

p��g������SrSSKJr SSKJr SSKJrJr SSKJ	r	J
r
JrJr SSKJ
r
 \r"S	S
\	R 5r"SS\	R$5r"S
S5r"SS\5r"SS\5r"SS\5r"SS\5r"SS5r"SS\5r"SS\5r"SS\5r\\\\S.rS,S!jrS"r\
R@"S#5r!S$r"S%r#S&r$S'r%S(r&S)r'S*r(S+r)g )-s	TREE_ROOT�)�deque)�Iterable)�Optional�Union�)�errors�
lazy_regex�osutils�trace�)�chk_mapc��\rSrSrSrSrSrg)�InvalidEntryName�(zInvalid entry name: %(name)sc�N�[RRU5 Xlg�N)r�BzrError�__init__�name)�selfrs  �6/usr/lib/python3/dist-packages/breezy/bzr/inventory.pyr�InvalidEntryName.__init__+s����� � ��&��	��rN��__name__�
__module__�__qualname__�__firstlineno__�_fmtr�__static_attributes__�rrrr(s��)�D�rrc��\rSrSrSrSrSrg)�DuplicateFileId�0z>File id {%(file_id)s} already exists in inventory as %(entry)sc�Z�[RRU5 XlX lgr)rrr�file_id�entry)rr'r(s   rr�DuplicateFileId.__init__3s����� � ��&����
r)r(r'Nrr"rrr$r$0s��K�D�rr$c���\rSrSrSrSrSr/SQrSrSr	Sr
SrSrSr
SrSS	jrS
rSrSrS
rSr\S5rSrSrSr\S5rSrSrSrSrSrSr Sr!Sr"Sr#g)�InventoryEntry�9a�Description of a versioned file.

An InventoryEntry has the following fields, which are also
present in the XML inventory-entry element:

file_id

name
    (within the parent directory)

parent_id
    file_id of the parent directory, or ROOT_ID

revision
    the revision_id in which this variation of this file was
    introduced.

executable
    Indicates that this file should be executable on systems
    that support it.

text_sha1
    sha-1 of the text of the file

text_size
    size in bytes of the text of the file

(reading a version 4 tree created a text_id field.)

>>> i = Inventory()
>>> i.path2id('')
b'TREE_ROOT'
>>> i.add(InventoryDirectory(b'123', 'src', ROOT_ID))
InventoryDirectory(b'123', 'src', parent_id=b'TREE_ROOT', revision=None)
>>> i.add(InventoryFile(b'2323', 'hello.c', parent_id=b'123'))
InventoryFile(b'2323', 'hello.c', parent_id=b'123', sha1=None, len=None, revision=None)
>>> shouldbe = {0: '', 1: 'src', 2: 'src/hello.c'}
>>> for ix, j in enumerate(i.iter_entries()):
...   print(j[0] == shouldbe[ix], j[1])
...
True InventoryDirectory(b'TREE_ROOT', '', parent_id=None, revision=None)
True InventoryDirectory(b'123', 'src', parent_id=b'TREE_ROOT', revision=None)
True InventoryFile(b'2323', 'hello.c', parent_id=b'123', sha1=None, len=None, revision=None)
>>> i.add(InventoryFile(b'2324', 'bye.c', b'123'))
InventoryFile(b'2324', 'bye.c', parent_id=b'123', sha1=None, len=None, revision=None)
>>> i.add(InventoryDirectory(b'2325', 'wibble', b'123'))
InventoryDirectory(b'2325', 'wibble', parent_id=b'123', revision=None)
>>> i.path2id('src/wibble')
b'2325'
>>> i.add(InventoryFile(b'2326', 'wibble.c', b'2325'))
InventoryFile(b'2326', 'wibble.c', parent_id=b'2325', sha1=None, len=None, revision=None)
>>> i.get_entry(b'2326')
InventoryFile(b'2326', 'wibble.c', parent_id=b'2325', sha1=None, len=None, revision=None)
>>> for path, entry in i.iter_entries():
...     print(path)
...
<BLANKLINE>
src
src/bye.c
src/hello.c
src/wibble
src/wibble/wibble.c
>>> i.id2path(b'2326')
'src/wibble/wibble.c'
�renamedzmodified and renamed)r'r�	parent_id�revisionFNc��g)z�Return a (text_modified, meta_modified) from this to old_entry.

_read_tree_state must have been called on self and old_entry prior to
calling detect_changes.
)FFr")r�	old_entrys  r�detect_changes�InventoryEntry.detect_changes�s��rc	��g)z4Perform a diff between two entries of the same kind.Nr")	r�	text_diff�
from_label�tree�to_label�to_entry�to_tree�	output_to�reverses	         r�_diff�InventoryEntry._diff�s�rc�r�0nUH�nURUR5nURU;aEX$RRUR:waSX$RlSUlMrMtXBUR'M� U$![a M�f=f![
Ra M�f=f)a$Find possible per-file graph parents.

This is currently defined by:
 - Select the last changed revision in the parent inventory.
 - Do deal with a short lived bug in bzr 0.8's development two entries
   that have the same last changed but different 'x' bit settings are
   changed in-place.
F)�	get_entryr'r/�
executable�AttributeErrorr�NoSuchId)r�previous_inventories�
candidates�inv�ies     r�parent_candidates� InventoryEntry.parent_candidates�s����
�'�C�
1��]�]�4�<�<�0���;�;�*�,�
�%�k�k�2�=�=����N�AF�J�{�{�3�>�,1�B�M�O�/1�r�{�{�+�'(�(���*������?�?�
��
�s#�B�AB
�
B�B�B6�5B6c��g)a-Return true if the object this entry represents has textual data.

Note that textual data includes binary content.

Also note that all entries get weave files created for them.
This attribute is primarily used when upgrading from old trees that
did not have the weave index for all inventory entries.
Fr"�rs r�has_text�InventoryEntry.has_text�s��rc��SU;a	[US9e[U[5(d[U5eXlSUlX lX0lg)a�Create an InventoryEntry.

The filename must be a single component, relative to the
parent directory; it cannot be a whole path or relative name.

>>> e = InventoryFile(b'123', 'hello.c', ROOT_ID)
>>> e.name
'hello.c'
>>> e.file_id
b'123'
>>> e = InventoryFile(b'123', 'src/hello.c', ROOT_ID)
Traceback (most recent call last):
breezy.bzr.inventory.InvalidEntryName: Invalid entry name: src/hello.c
�/rN)r�
isinstance�bytes�	TypeErrorr'r/rr.)rr'rr.s    rr�InventoryEntry.__init__�sD���$�;�"��-�-��'�5�)�)��G�$�$�����
��	�"�rc�`�[R"SRUR55e)z<Return a short kind indicator useful for appending to names.�unknown kind {!r})rr�format�kindrKs r�kind_character�InventoryEntry.kind_character�s!���o�o�1�8�8����C�D�Dr)�file�	directory�symlinkc��US;$)N)rZr[r\�tree-referencer")rWs r�versionable_kind�InventoryEntry.versionable_kind�s���I�I�Irc��URbPURUR5(d0[R"SR	URU55eURX05 UR
X5 g)a�Check this inventory entry is intact.

This is a template method, override _check for kind specific
tests.

:param checker: Check object providing context for the checks;
     can be used to find out what parts of the repository have already
     been checked.
:param rev_id: Revision id from which this InventoryEntry was loaded.
     Not necessarily the last-changed revision for this file.
:param inv: Inventory from which the entry was loaded.
Nz6missing parent {{{}}} in inventory for revision {{{}}})r.�has_idr�
BzrCheckErrorrV�!_add_entry_to_text_key_references�_check)r�checker�rev_idrFs    r�check�InventoryEntry.check�sg���>�>�%��:�:�d�n�n�-�-��*�*�L�S�S��������
	�1�1�#�<����G�$rc�n�URRSRURU55 g)z4Check this inventory entry for kind specific errors.z*unknown entry kind {!r} in revision {{{}}}N)�
_report_items�appendrVrW�rrfrgs   rre�InventoryEntry._checks*�����$�$�8�?�?��	�	�6�R�	
rc��[e)zClone this inventory entry.)�NotImplementedErrorrKs r�copy�InventoryEntry.copys��!�!rc��XLagUcgUcgURUR:wagURU5up#U(dU(aSnOSnURUR:waSnOURUR:waSnOSnU(aU(d[R
$U(aU(dgU(aU(a[R$g)atDescribe the change between old_entry and this.

This smells of being an InterInventoryEntry situation, but as its
the first one, we're making it a static method for now.

An entry with a different parent, or different name is considered
to be renamed. Reparenting is an internal detail.
Note that renaming the parent does not trigger a rename for the
child entry itself.
�	unchanged�added�removed�modifiedTF)rWr2r.rr+�RENAMED�MODIFIED_AND_RENAMED)r1�	new_entry�
text_modified�
meta_modifiedrwr-s      r�describe_change�InventoryEntry.describe_changes����!��
�
��
�
���>�>�Y�^�^�+��'0�'?�'?�	�'J�$�
��M��H��H����)�"5�"5�5��G�
�^�^�y�~�~�
-��G��G��8�!�)�)�)��G����!�6�6�6�rc��SRURRURURUR
UR5$)Nz-{}({!r}, {!r}, parent_id={!r}, revision={!r}))rV�	__class__rr'rr.r/rKs r�__repr__�InventoryEntry.__repr__Ds>��>�E�E��N�N�#�#��L�L��I�I��N�N��M�M�
�	
rc�V�[USS5nUcgURUR:H$)Nr/F)�getattrr/)r�other�other_revisions   r�
is_unmodified�InventoryEntry.is_unmodifiedMs,�� ��
�D�9���!���}�}����.�.rc��XLag[U[5(d[$URUR:H=(Ga: URUR:H=(Ga UR
UR
:H=(a� URUR:H=(a� URUR:H=(a� URUR:H=(a� URUR:H=(ay URUR:H=(aY URUR:H=(a9 URUR:H=(a URUR:H$�NT)rPr+�NotImplementedr'r�symlink_target�	text_sha1�	text_size�text_idr.rWr/rA�reference_revision�rr�s  r�__eq__�InventoryEntry.__eq__Ss6���=���%��0�0�!�!��\�\�U�]�]�
*�

F�

F����e�j�j�(�

F�

F��%�%��)<�)<�<�

F����5�?�?�2�

F����5�?�?�2�	

F�
������.�

F����5�?�?�2�

F����e�j�j�(�

F����%�.�.�0�

F����E�$4�$4�4�

F��(�(�E�,D�,D�D�	
rc��X:X+$rr"r�s  r�__ne__�InventoryEntry.__ne__hs���"�"rc��[S5e�Nznot hashable��
ValueErrorrKs r�__hash__�InventoryEntry.__hash__k�
����(�(rc��SnURUR:waSnU$URUR:waSnU$URUR:waSnU$)zdHas this entry changed relative to previous_ie.

This method should be overridden in child classes.
TF)r.rrW)r�previous_ie�
compatibles   r�
_unchanged�InventoryEntry._unchangednsh��
�
�� � �D�N�N�2��J���	�
�
����
*��J����
�
����
*��J��rc��g)z�Populate fields in the inventory entry from the given tree.

Note that this should be modified to be a noop on virtual trees
as all entries created there are prepopulated.
Nr"�r�path�	work_trees   r�_read_tree_state�InventoryEntry._read_tree_state~s��	
rc��grr"rKs r�_forget_tree_state�!InventoryEntry._forget_tree_state�s��r�F)$rrrr�__doc__rxry�	__slots__rAr�r�r�r�r�r2r=rHrLrrX�known_kinds�staticmethodr_rhrerqr}r�r�r�r�r�r�r�r�r!r"rrr+r+9s���@�N�G�1��<�I��J��I��I��G��N����"�C� �D	�#�0E�3�K��J��J�%�.
�"��'��'�R
�/�
�*#�)�� 	
�
rr+c�N^�\rSrSrSrS/rSrSrSrU4Sjr	Sr
S	rS
rU=r
$)�InventoryDirectoryi��A directory in an inventory.�childrenr[c��URS:XaUR(dgURUSURUR4SS5 g)�See InventoryEntry._check.�N�texts�text�(da39a3ee5e6b4b0d3255bfef95601890afd80709)r�
rich_roots�add_pending_itemr'r/rms   rre�InventoryDirectory._check�sE���9�9��?�7�#5�#5��	� � ��
�d�l�l�D�M�M�2��7�		
rc�~�[URURUR5nURUlU$r)r�r'rr.r/r�s  rrq�InventoryDirectory.copy�s.��"�4�<�<����D�N�N�K��������rc�4>�[TU]XU5 0Ulgr)�superrr��rr'rr.r�s    �rr�InventoryDirectory.__init__�s���
����	�2���
rc�H�[URR55$r)�sortedr��itemsrKs r�sorted_children�"InventoryDirectory.sorted_children�s���d�m�m�)�)�+�,�,rc��g)�"See InventoryEntry.kind_character.rOr"rKs rrX�!InventoryDirectory.kind_character����r)r�)rrrrr�r�rWrerqrr�rXr!�
__classcell__�r�s@rr�r��s0���&���I��D�
� ��-��rr�c�^�\rSrSrSr/SQrSrU4SjrSrSr	Sr
SS	jrS
rSr
SrS
rSrU4SjrSrU=r$)�
InventoryFilei��A file in an inventory.)rAr�r�r�rZc�^>�[TU]XU5 SUlSUlSUlSUlg�NF)r�rr�r�r�rAr�s    �rr�InventoryFile.__init__�s.���
����	�2������������rc���URUSURUR4SUR5 URc6UR
R
SRURU55 gg)r�r�r�Nz.fileid {{{}}} in {{{}}} has None for text_size)r�r'r/r�r�rkrlrV�rrf�tree_revision_ids   rre�InventoryFile._check�sn��	� � ��
�d�l�l�D�M�M�2���N�N�		
��>�>�!��!�!�(�(�@�G�G��L�L�"2��
�"rc��[URURUR5nURUlUR
UlURUlURUlURUlU$r)	r�r'rr.rAr�r�r�r/r�s  rrq�InventoryFile.copy�sY���d�l�l�D�I�I�t�~�~�F���?�?�������
��.�.����.�.���������rc�l�URUR:gnURUR:gnX#4$)�"See InventoryEntry.detect_changes.)r�rA�rr1r{r|s    rr2�InventoryFile.detect_changes�s3�����)�*=�*=�=�
����9�+?�+?�?�
��+�+rc		��SSKJn	 URn
U(aURnURU5nOSnSnU
bURU
5n
OSn
U(aX�p�XcpcXBpBU	"X6USSSU5nUR	X�X$X�5$)�See InventoryEntry._diff.r)�DiffTextN�utf-8r�)�breezy.diffr�r'�id2path�	diff_text)rr5r6r7r8r9r:r;r<r��from_file_id�
to_file_id�to_path�	from_path�differs               rr=�InventoryFile._diff�s���	)��|�|���!�)�)�J��o�o�j�1�G��J��G��#����\�2�I��I��'3��#�'�#+���$��G�R��Y�O������
�l�
�	
rc��g)zSee InventoryEntry.has_text.Tr"rKs rrL�InventoryFile.has_texts��rc��g�r�r�r"rKs rrX�InventoryFile.kind_character
���rc�\�URU5UlURU5Ulg�z$See InventoryEntry._read_tree_state.N)�
get_file_sha1r��
is_executablerAr�s   rr��InventoryFile._read_tree_states(��"�0�0��6���$�1�1�$�7��rc	���SRURRURURUR
URURUR5$)Nz>{}({!r}, {!r}, parent_id={!r}, sha1={!r}, len={}, revision={}))	rVr�rr'rr.r�r�r/rKs rr��InventoryFile.__repr__sL��O�V�V��N�N�#�#��L�L��I�I��N�N��N�N��N�N��M�M�
�	
rc��SUlgr)r�rKs rr�� InventoryFile._forget_tree_state s	����rc�>�[TU]U5nURUR:waSnOURUlURUR:waSnU$�zSee InventoryEntry._unchanged.F)r�r�r�r�rA�rr�r�r�s   �rr��InventoryFile._unchanged#sU����W�'��4�
��>�>�[�2�2�2��J�)�2�2�D�N��?�?�k�4�4�4��J��rr�)rrrrr�r�rWrrerqr2r=rLrXr�r�r�r�r!r�r�s@rr�r��sR���!�C�I��D� �� �,�� 
�D��8�	
���rr�c�r^�\rSrSrSrS/rSrU4SjrSrSr	Sr
SS	jrS
rSr
SrU4S
jrSrU=r$)�
InventoryLinki1r�r�r\c�4>�[TU]XU5 SUlgr)r�rr�r�s    �rr�InventoryLink.__init__8s���
����	�2�"��rc���URc5URRSRURU55 URUSURUR4SS5 g)r�Nz/symlink {{{}}} has no target in revision {{{}}}r�r�r�)r�rkrlrVr'r�r/r�s   rre�InventoryLink._check<se�����&��!�!�(�(�A�H�H��L�L�"2��
�	� � ��
�d�l�l�D�M�M�2��7�		
rc��[URURUR5nURUlUR
UlU$r)rr'rr.r�r/r�s  rrq�InventoryLink.copyLs:���d�l�l�D�I�I�t�~�~�F��#�2�2���������rc�x�URUR:gnU(a[R"S5 SnX#4$)r�z    symlink target changedF)r�r�mutterr�s    rr2�InventoryLink.detect_changesRs8���+�+�y�/G�/G�G�
���L�L�5�6��
��+�+rc	��SSKJn	 URn
Ub
URnOSnU(dUnUn
OUnUn
X�p�U	"X�U5nURX�5$)r�r)�DiffSymlinkN)r�rr��diff_symlink)rr5r6r7r8r9r:r;r<r�
old_target�
new_target�old_tree�new_treer�s               rr=�InventoryLink._diff[sa��	,��(�(�
���!�0�0�J��J���H��H��H��H�%/�
��X��;���"�"�:�:�:rc��gr�r"rKs rrX�InventoryLink.kind_characterxr�rc�x�URURUR5UR5Ulgr�)�get_symlink_targetr�r'r�r�s   rr��InventoryLink._read_tree_state|s-��'�:�:����d�l�l�+�T�\�\�
��rc��SUlgr�r�rKs rr�� InventoryLink._forget_tree_state�s
��"��rc�^>�[TU]U5nURUR:waSnU$r�)r�r�r�r�s   �rr��InventoryLink._unchanged�s1����W�'��4�
����+�"<�"<�<��J��rrr�)rrrrr�r�rWrrerqr2r=rXr�r�r�r!r�r�s@rrr1sJ���!�!�"�I��D�#�
� �,�$�;�:�
�#��rrc�V^�\rSrSrS/rSrSSjrSrSrSr	U4Sjr
S	rS
rU=r
$)�
TreeReferencei�r�r^c�H�[RXX#5 X@lXPlgr)r+rr/r�)rr'rr.r/r�s      rr�TreeReference.__init__�s��	����t�?� �
�"4�rc��[URURURURUR
5$r)rr'rr.r/r�rKs rrq�TreeReference.copy�s4����L�L��I�I��N�N��M�M��#�#�
�	
rc�D�URXR5Ulg)z;Populate fields in the inventory entry from the given tree.N)�get_reference_revisionr'r�r�s   rr��TreeReference._read_tree_state�s��"+�"B�"B�4���"V��rc��SUlgr)r�rKs rr�� TreeReference._forget_tree_state�s
��"&��rc�^>�[TU]U5nURUR:waSnU$r�)r�r�r�r�s   �rr��TreeReference._unchanged�s1����W�'��4�
��"�"�k�&D�&D�D��J��rc��g)r��+r"rKs rrX�TreeReference.kind_character�r�r)r�r/�NN)rrrrr�rWrrqr�r�r�rXr!r�r�s@rrr�s;���%�&�I��D�KO�5�
�W�'���rrc��\rSrSrSrSrSrSSjrSrSSjr	S	r
SS
jrSrSr
S
rSrSrS\S\\4SjrSrg)�CommonInventoryi�a�Basic inventory logic, defined in terms of primitives like has_id.

An inventory is the metadata about the contents of a tree.

This is broadly a map from file_id to entries such as directories, files,
symlinks and tree references. Each entry maintains its own metadata like
SHA1 and length for files, or children for a directory.

Entries can be looked up either by path or by file_id.

InventoryEntry objects must not be modified after they are
inserted, other than through the Inventory API.
c�6�[URU55$r)�bool�path2id)r�filenames  r�has_filename�CommonInventory.has_filename�s���D�L�L��*�+�+rc��SR[URU5Vs/sHo"RPM snSS55$s snf)a)Return as a string the path to file_id.

>>> i = Inventory()
>>> e = i.add(InventoryDirectory(b'src-id', 'src', ROOT_ID))
>>> e = i.add(InventoryFile(b'foo-id', 'foo.c', parent_id=b'src-id'))
>>> print(i.id2path(b'foo-id'))
src/foo.c

:raises NoSuchId: If file_id is not present in the inventory.
rON���)�join�reversed�_iter_file_id_parentsr)rr'�parents   rr��CommonInventory.id2path�sJ���x�x��+/�+E�+E�g�+N�O�+N����+N�O�PS�QS�T�
�
�	
��Os�ANc#�# �Uc+URcgURnSUR4v� O&[U[5(aURU5n[	UR
R
55nU(dUShv�N g[U5nSU4/nU(a�USupSU(avUR5upgUS-U-nUSSU4v� URS:waM<[	UR
R
55n	[U	5n	URX�45 OUR5 U(aM�ggN�7f)z�Return (path, entry) pairs, in order by name.

:param from_dir: if None, start from the root,
  otherwise start from this directory (either file-id or entry)
:param recursive: recurse into directories or not
Nr�r6rOrr[)�rootrPrQr@r�r�r�r�popleftrWrl�pop)
r�from_dir�	recursiver��stack�from_dir_relpathrrGr��new_childrens
          r�iter_entries�CommonInventory.iter_entries�s*������y�y� ���y�y�H��d�i�i�-��
��%�
(�
(��~�~�h�/�H��(�+�+�1�1�3�4���������?���h�� ���).�r��&���#�+�+�-���(�#�-��4���1�2�h��l�"��7�7�k�)�� &�b�k�k�&7�&7�&9�:��$�\�2�����d�1�2���	�	��3�e�	
 �s�BE�E�B7E�Ec��g)z�Populate any caches, we are about to access all items.

The default implementation does nothing, because CommonInventory doesn't
have a cache.
Nr"rKs r�_preload_cache�CommonInventory._preload_caches��	
rc#�8^^
^# �U(a [U[5(d[U5nUcUcUR5 Uc�URcgUbH[	U5S:Xa9[U5SnUb'UR
U5nX@RU54v� ggURnUbURRU;aSUR4v� O2[U[5(aURU5nO[U5eUb&[5mUm
UU
U4SjmUHnT"U5 M
 OSmSU4/nU(a�UR5upg/n[URR!55H^up�Xi-nUbU
RU;aX�4v� U
R"S:XdM3TbU
RT;dMHUR%US-U
45 M` UR'[)U55 U(aM�gg![Ra gf=f7f)a&Iterate over the entries in a directory first order.

This returns all entries for a directory before returning
the entries for children of a directory. This is not
lexicographically sorted order, and is a hybrid between
depth-first and breadth-first.

:return: This yields (path, entry) pairs
Nrrr�c�>�TRU5(dgTRU5RnUcgUT;aTRU5 T"U5 ggr)rbr@r.�add)r'r.�
add_ancestors�byid�parentss  ���rrM�:CommonInventory.iter_entries_by_dir.<locals>.add_ancestorsBsS����{�{�7�+�+�� �N�N�7�3�=�=�	��$���G�+��K�K�	�*�!�)�,�,rr[rO)rP�setrHr=�len�listr�r@rrCr'rQrRr?r�r�r�rWrl�extendr8)rr@�specific_file_idsr'r�rB�cur_relpath�cur_dir�
child_dirs�
child_name�child_ie�
child_relpathrMrNrOs            @@@r�iter_entries_by_dir�#CommonInventory.iter_entries_by_dirs�����Z�0A�3�%G�%G� #�$5� 6���� 1� 9�
���!����y�y� �� �,��5F�1G�1�1L��0�1�!�4���&�<�#�|�|�G�4��#�N�N�7�$;�;�;���y�y�H� �(�D�I�I�,=�,=�AR�,R��$�)�)�m�#��
��%�
(�
(��~�~�h�/�H��H�%�%��(��e�G��D�
-�-���g�&�-��G��h�� ���#(�9�9�;� �K��J�(.�w�/?�/?�/E�/E�/G�(H�$�
� +� 8�
�$�,��0@�0@�DU�0U�'�1�1��=�=�K�/���(�*:�*:�g�*E�"�)�)�=�3�+>��*I�J�)I�
�L�L��*�-�.��e��G"�?�?����	�s=�A2H�8H�	DH�,H�;H�>H�H�H�H�Hc	�R�[UR55n[UR55nX2-
nX#-
nURU5n/nUH'nURUR	U5SUS45 M) UH5nURSUR	U5X�RU545 M7 UHknURU5URU5:wdM)URUR	U5UR	U5UURU545 Mm U$��-Make an inventory delta from two inventories.N)rQ�iter_all_ids�intersectionrlr�r@)	r�old�old_ids�new_ids�adds�deletes�common�deltar's	         r�_make_delta�CommonInventory._make_deltaas���c�&�&�(�)���d�'�'�)�*��� ���#���%�%�g�.�����G��L�L�#�+�+�g�.��g�t�D�E���G��L�L��t�|�|�G�,�g�~�~�g�7N�O�
���G��}�}�W�%�����)@�@�������G�,����W�-�����w�/�	����rc��[XX45$)z0Simple thunk to breezy.bzr.inventory.make_entry.)�
make_entry)rrWrr.r's     rrm�CommonInventory.make_entry{s���$�i�9�9rc�\^^�/mUU4SjmURbT"URS5 T$)zbReturn list of (path, ie) for all entries except the root.

This may be faster than iter_entries.
c��>�[URR55nUHGup4[R"X5nTRXT45 URS:XdM?T"XE5 MI g)Nr[)r�r�r�r
�pathjoinrlrW)�dir_ie�dir_path�kidsrrG�
child_path�accum�descends      ��rrw�(CommonInventory.entries.<locals>.descend�sY����&�/�/�/�/�1�2�D� ���$�-�-�h�=�
����j�-�.��7�7�k�)��B�+�	!rr�)r=)rrvrws @@r�entries�CommonInventory.entriess.���
��	,��9�9� ��D�I�I�r�"��rc�z�[U[5(a[R"U5nOUnURnUcg[U5H?upE[USS5nUc gXenURS:XaXrSUS-X$S-S4s $UnMA X2/4$![
Ra gf=f![a  gf=f)z�Like get_entry_by_path, but return TreeReference objects.

:param relpath: Path to resolve, either as string with / as separators,
    or as list of elements.
:return: tuple with ie, resolved elements and elements left to resolve
)NNNNr�r^r)rP�strr
�	splitpathr=rrC�	enumerater�rW�KeyError)r�relpath�namesr:�i�fr��cies        r�get_entry_by_path_partial�)CommonInventory.get_entry_by_path_partial�s����g�s�#�#��%�%�g�.�E��E�	$��Y�Y�F��>�#��e�$�D�A�

(�"�6�:�t�<���#�+��k���8�8�/�/��g��A����!�e�g��>�>���%��b� � ��#���	$�#�	$���
(�'�
(�s/�B�B,�#"B,�B,�B)�(B)�,
B:�9B:c��[U[5(a[R"U5nOUnURnUcgUHn[USS5nUc gXTnUnM U$![
Ra gf=f![a  gf=f)a-Return an inventory entry by path.

:param relpath: may be either a list of path components, or a single
    string, in which case it is automatically split.

This returns the entry of the last component in the path,
which may be either a file or a directory.

Returns None IFF the path is not found.
Nr�)	rPr|r
r}r=rrCr�r)rr�r�r:r�r�r�s       r�get_entry_by_path�!CommonInventory.get_entry_by_path�s����g�s�#�#��%�%�g�.�E��E�	��Y�Y�F��>���A�
�"�6�:�t�<���#���k����
��
�����	��	���
��
�s)�A$�A>�A>�$A;�:A;�>
B�Bc�D�URU5nUcgUR$)aKWalk down through directories to return entry of last component.

:param relpath: may be either a list of path components, or a single
    string, in which case it is automatically split.

This returns the entry of the last component in the path,
which may be either a file or a directory.

Returns None IFF the path is not found.
N)r�r')rr�rGs   rr1�CommonInventory.path2id�s&���
#�
#�G�
,��
�:���z�z�rc��[5nUH$nURURU55 M& UR5nURc	[SS9$[[U5SR5nURRURl
URUl[5nUHnupxURn	X�;dURU;a"URS:XaURU	5 OX�;aMOURUR55 Mp U$![Ra GM=f=f)��Get an inventory view filtered against a set of file-ids.

Children of directories and parents are included.

The result may or may not reference the underlying inventory
so it should be treated as immutable.
N��root_idrr[)rQ�update�
get_idpathrrCrEr=�	Inventory�nextr'r/�revision_idr.rWrLrq)
r�specific_fileids�interesting_parents�fileidryr��directories_to_expand�_pathr(r's
          r�filter�CommonInventory.filter�s��"�e��&�F�
�#�*�*�4�?�?�6�+B�C�'��#�#�%���9�9���T�*�*��$�w�-��*�2�2�3��"�i�i�0�0��
�
�� �,�,��� #���#�L�E��m�m�G��*�e�o�o�AV�.V��:�:��,�)�-�-�g�6���3���I�I�e�j�j�l�#�$����%�?�?�
��
�s� D2�2E�
Er'�returnc�,�[UR5e)�Return a list of file_ids for the path to an entry.

The list contains one element for each directory followed by
the id of the file itself.  So the length of the returned list
is equal to the depth of the file in the tree, counting the
root directory as depth 1.
)rpr��rr's  rr��CommonInventory.get_idpaths��"�$�/�/�2�2rr"r�r,r)rrrrr�r3r�rErHr\rjrmryr�r�r1r��FileIdrSr�r!r"rrr.r.�s`���,�
�$0�d
�L/�\�4:��&!�B!�F� �@3�&�3�T�&�\�3rr.c���\rSrSrSr\S4SjrSrSrS!Sjr	Sr
S	rS
\S\
\4SjrS
rSrSrSrSrSrSrSrS"SjrSrSrSrSrSrSrSrSrSr Sr!S r"g)#r�ia�Mutable dict based in-memory inventory.

We never store the full path to a file, because renaming a directory
implicitly moves all of its contents.  This class internally maintains a
lookup tree that allows the children under a directory to be
returned quickly.

>>> inv = Inventory()
>>> inv.add(InventoryFile(b'123-123', 'hello.c', ROOT_ID))
InventoryFile(b'123-123', 'hello.c', parent_id=b'TREE_ROOT', sha1=None, len=None, revision=None)
>>> inv.get_entry(b'123-123').name
'hello.c'

Id's may be looked up from paths:

>>> inv.path2id('hello.c')
b'123-123'
>>> inv.has_id(b'123-123')
True

There are iterators over the contents:

>>> [entry[0] for entry in inv.iter_entries()]
['', 'hello.c']
Nc�l�UbUR[USS55 OSUl0UlX lg)aCreate or read an inventory.

If a working directory is specified, the inventory is read
from there.  If the file is specified, read from that. If not,
the inventory is created empty.

The inventory is created with a default root directory, with
an id of None.
Nr�)�	_set_rootr�r=�_byidr�)rr�r�s   rr�Inventory.__init__,s4�����N�N�-�g�r�4�@�A��D�I��D�J�&�rc��SnSn[UR5n[U5U:�aUSU[U5-
U-nSR[	U5U5$)Niz...}z)<Inventory object at {:x}, contents={!r}>)�reprr�rRrV�id)r�max_len�closing�contentss    rr��Inventory.__repr__=sX��������
�
�#���x�=�7�"�� :�7�S��\�#9�;�g�E�H�:�A�A�"�T�(�H�U�Urc���[[[[[	[[
U5555555 0n[SU5SS9H�up4[URU5S05n[U5(aXRU'URU5U:wa6[R"UUSRURU555eURU5 M� [SU55H�upgnUR S:Xa_[#UR$UR&UR(5n	UR*U	lUR-U	R$05U	lU	nUR1U5 URUR$5U:wdM�[R"UUR$S5e [U5(a*UR75up�[R"SUS
5eg	![2a'n
[R"XhR$S5U
eS	n
A
f[4a'n
[R"XhR$S
5U
eS	n
A
ff=f)a/Apply a delta to this inventory.

See the inventory developers documentation for the theory behind
inventory deltas.

If delta application fails the inventory is left in an indeterminate
state and must not be used.

:param delta: A list of changes to apply. After all the changes are
    applied the final inventory must be internally consistent, but it
    is ok to supply changes which, if only half-applied would have an
    invalid result - such as supplying two changes which rename two
    files, 'A' and 'B' with each other : [('A', 'B', b'A-id', a_entry),
    ('B', 'A', b'B-id', b_entry)].

    Each change is a tuple, of the form (old_path, new_path, file_id,
    new_entry).

    When new_path is None, the change indicates the removal of an entry
    from the inventory and new_entry will be ignored (using None is
    appropriate). If new_path is not None, then new_entry must be an
    InventoryEntry instance, which will be incorporated into the
    inventory (and replace any existing entry with the same file id).

    When old_path is None, the change indicates the addition of
    a new entry to the inventory.

    When neither new_path nor old_path are None, the change is a
    modification to an entry, such as a rename, reparent, kind change
    etc.

    The children attribute of new_entry is ignored. This is because
    this method preserves children automatically across alterations to
    the parent of the children, and cases where the parent id of a
    child is changing require the child to be passed in as a separate
    change regardless. E.g. in the recursive deletion of a directory -
    the directory's children must be included in the delta, or the
    final inventory will be invalid.

    Note that a file_id must only appear once within a given delta.
    An AssertionError is raised otherwise.
c3�8# �UHupp4UcMX4v� M g7frr"��.0�op�npr��es     r�	<genexpr>�(Inventory.apply_delta.<locals>.<genexpr>�s���A�����"�W�b�W��s�
�
T)r<r��#Entry was at wrong other path {!r}.c3�:# �UHupp4UcMX#U4v� M g7frr"r�s     rr�r��s���.
�+0�<�2�1�B�J�R�A�J�5�s�
�r[z$New id is already present in target.NzParent is not a directory.z,New path is not consistent with parent path.z	<deleted>z:The file id was deleted but its children were not deleted.)rS�_check_delta_unique_ids�_check_delta_unique_new_paths�_check_delta_unique_old_paths�_check_delta_ids_match_entry�_check_delta_ids_are_valid�(_check_delta_new_path_entry_both_or_Noner�r�r@rRr�r�InconsistentDeltarV�remove_recursive_idrWr�r'rr.r/r?r�rLr$rB�popitem)rrir��old_pathr'�file_id_children�new_path�_frz�replacementr�r.s            r�apply_delta�Inventory.apply_deltaFsM��^	
�#�-�1�4�6� H�� O�����

�	
���
"(�A��A�4�"
��H� '�t�~�~�g�'>�
�B�O���#�$�$�$4��!��|�|�G�$��0��.�.���9�@�@����g�AV�W���
�$�$�W�-�"
�*(.�.
�+0�.
�(
�#�H�)��~�~��,�1��%�%�y�~�~�y�7J�7J���(1�'9�'9��$�'/�|�|�K�4G�4G��'L��$�'�	�	
�����#��|�|�I�-�-�.�(�:��.�.���%�%�B���1(
�:�x�=�=�"*�"2�"2�"4��I��*�*���L��
���#�
��.�.��/�/�1W�����"�
��.�.��/�/�1M�����
�s$�2H�
I#�
"H/�/
I#�<"I�I#c�T�UR5nURU5 X$lU$)z)See CHKInventory.create_by_apply_delta().)rqr�r�)r�inventory_delta�new_revision_id�propagate_caches�new_invs     r�create_by_apply_delta�Inventory.create_by_apply_delta�s(���)�)�+�����O�,�-���rc�^�XlURRUR0Ulgr)r=r'r�)rrGs  rr��Inventory._set_root�s!���	��i�i�'�'����3��
rc�2�UR5nURc	[SS9$[[U5SR5nURR
URlUH$up4UR
UR55 M& U$)Nr�r)rEr=r�r�r'r/rLrq)rryr�r�r(s     rrq�Inventory.copy�sy���#�#�%���9�9���T�*�*��$�w�-��*�2�2�3��"�i�i�0�0��
�
��$�L�E��I�I�e�j�j�l�#�$��rr'r�c�r�/nURU5HnURSUR5 M! U$)r�r)r9�insertr')rr'�pr:s    rr��Inventory.get_idpath�s5�����0�0��9�F�
�H�H�Q����'�:��rc�,�[UR5$)�Iterate over all file-ids.)�iterr�rKs rra�Inventory.iter_all_ids�s���D�J�J��rc�R�URcgURR5$)��Iterate over all entries.

Unlike iter_entries(), just the entries are returned (not (path, ie))
and the order of entries is undefined.

XXX: We may not want to merge this into bzr.dev.
r")r=r��valuesrKs r�iter_just_entries�Inventory.iter_just_entries�s$���9�9����z�z� � �"�"rc�,�[UR5$)zReturns number of entries.)rRr�rKs r�__len__�Inventory.__len__�s���4�:�:��rc��[U[5(d[U5eURU$![an[
R"X5UeSnAff=f)aReturn the entry for given file_id.

>>> inv = Inventory()
>>> inv.add(InventoryFile(b'123123', 'hello.c', ROOT_ID))
InventoryFile(b'123123', 'hello.c', parent_id=b'TREE_ROOT', sha1=None, len=None, revision=None)
>>> inv.get_entry(b'123123').name
'hello.c'
N)rPrQrRr�rrrC)rr'r�s   rr@�Inventory.get_entry�sQ���'�5�)�)��G�$�$�	8��:�:�g�&�&���	8��/�/�$�0�a�7��	8�s�1�
A�A�Ac�4�URUR$r)r�rWr�s  r�
get_file_kind�Inventory.get_file_kinds���z�z�'�"�'�'�'rc�V�URU5RRU5$r)r@r��get)rr.r2s   r�	get_child�Inventory.get_childs"���~�~�i�(�1�1�5�5�h�?�?rc�8�URUR;a/[R"SR	UR55eXRUR'[US05nUb(UR
5HnURU5 M U$)z?Add an entry to the inventory, without adding it to its parent.z/inventory already contains entry with id {{{}}}r�)r'r�rrrVr�r��
_add_child)rr(r��childs    rr��Inventory._add_childs}���=�=�D�J�J�&��/�/�A�H�H����W��
�%*�
�
�5�=�=�!��5�*�b�1����!���*������&�+��rc��URUR;a-[URURUR5eURcXlO�URURnURUR;aR[R"URURURR5URS5eXRUR'URU5$![
a(n[R"SURS5UeSnAff=f)z(Add entry to inventory.

:return: entry
N�	<unknown>zParent not in inventory.zPath already versioned)r'r�r$r.r=rrr�rr�r�r�)rr(r:r�s    rrL�
Inventory.add"s���
�=�=�D�J�J�&�!�%�-�-����E�M�M�1J�K�K��?�?�"��I�
����E�O�O�4��
�z�z�V�_�_�,��.�.��L�L�������!<�!D�!D�E��M�M�,���
+0�O�O�E�J�J�'����u�%�%���
��.�.�����2L�����
�s�D�
D=�#D8�8D=c��[R"U5n[U5S:Xa^UcSSKJn UR5n[
USS5UlURRUR0Ul	UR$USSnURU5nUc[R"US9e[X%SXC5nURU5$)zgAdd entry from a path.

The immediate parent must already be versioned.

Returns the new entry object.
rNr��generate_idsr�r6)r�)r
r}rRr�r��gen_root_idr�r=r'r�r1r�NotVersionedErrorrmrL)	rr�rWr'r.�partsr��parent_pathrGs	         r�add_path�Inventory.add_path;s����!�!�'�*���u�:��?���*�&�2�2�4��*�7�B��=�D�I��)�)�+�+�T�Y�Y�7�D�J��9�9�����*�K����[�1�I�� ��.�.�K�@�@�
��B�i��
<���x�x��|�rc��URU5nURU	URb1URUR5RUR	gg)aRemove entry by id.

>>> inv = Inventory()
>>> inv.add(InventoryFile(b'123', 'foo.c', ROOT_ID))
InventoryFile(b'123', 'foo.c', parent_id=b'TREE_ROOT', sha1=None, len=None, revision=None)
>>> inv.has_id(b'123')
True
>>> inv.delete(b'123')
>>> inv.has_id(b'123')
False
N)r@r�r.r�r)rr'rGs   r�delete�Inventory.deleteTsL���^�^�G�
$���J�J�w��
�<�<�#����r�|�|�,�5�5�b�g�g�>�$rc�j�[U[5(d[$URUR:H$)a�Compare two sets by comparing their contents.

>>> i1 = Inventory()
>>> i2 = Inventory()
>>> i1 == i2
True
>>> i1.add(InventoryFile(b'123', 'foo', ROOT_ID))
InventoryFile(b'123', 'foo', parent_id=b'TREE_ROOT', sha1=None, len=None, revision=None)
>>> i1 == i2
False
>>> i2.add(InventoryFile(b'123', 'foo', ROOT_ID))
InventoryFile(b'123', 'foo', parent_id=b'TREE_ROOT', sha1=None, len=None, revision=None)
>>> i1 == i2
True
)rPr�r�r�r�s  rr��Inventory.__eq__es*�� �%��+�+�!�!��z�z�U�[�[�(�(rc�.�URU5(+$r)r�r�s  rr��Inventory.__ne__zs���;�;�u�%�%�%rc��[S5er�r�rKs rr��Inventory.__hash__}r�rc#�# �Ub&URUnUv� URnUbM%gg![an[R"SUS9UeSnAff=f7f�z,Yield the parents of file_id up to the root.N)r7r')r�rrrCr.�rr'rGr�s    rr9�Inventory._iter_file_id_parents�s]����!�
I��Z�Z��(���H��l�l�G�
�!���
I��o�o�4��A�q�H��
I�s)�A�-�A�A�
A�A
�
A�Ac��XR;$r)r�r�s  rrb�Inventory.has_id�s���*�*�$�$rc	�n�URnURn[UR55n[UR55nXT-
nXE-
nU(d
U(dUnOURU5n/n	UH'n
U	R	URU
5SU
S45 M) UH5n
U	R	SURU
5X�RU
545 M7 UHPn
U"U
5nU"U
5nX�LdX�:XaMU	R	URU
5URU
5X�45 MR U	$r_)r@rQrarbrlr�)
rrc�
old_getter�
new_getterrdrerfrgrhrir'�new_ie�old_ies
             rrj�Inventory._make_delta�s"���]�]�
��^�^�
��c�&�&�(�)���d�'�'�)�*��� ���#���G��F��)�)�'�2�F����G��L�L�#�+�+�g�.��g�t�D�E���G��L�L��t�|�|�G�,�g�~�~�g�7N�O�
���G���(�F���(�F�
��6�#3������[�[��)�4�<�<��+@�'�R����rc��URU/n/nU(amUR5nURUR5 URS:Xa)URURR55 U(aMm[U5H!nURU5nURU	M# WRb1URUR5RUR	gSUlg)zXRemove file_id, and children, from the inventory.

:param file_id: A file_id to remove.
r[N)
r�r?rlr'rWrTr�r�r8r@r.rr=)rr'�to_find_delete�	to_deleterGs     rr��Inventory.remove_recursive_id�s���
�*�*�W�-�.���	���#�#�%�B����R�Z�Z�(��w�w�+�%��%�%�b�k�k�&8�&8�&:�;�	�n�
 �	�*�G�����(�B��
�
�7�#�+��<�<�#����r�|�|�,�5�5�b�g�g�>��D�Irc��[U5n[U5(d%[R"SR	U55eUR
UnX4R;a4[R"SR	X0RU555eURU5nX;aD[R"SR	URU5URU555eUR
UnUR
URnURUR	XdRU'X6l
X&l	g)z�Move a file within the inventory.

This can change either the name, or the parent, or both.

This does not move the working file.
z not an acceptable filename: {!r}z{!r} already exists in {!r}z>cannot move directory {!r} into a subdirectory of itself, {!r}N)�ensure_normalized_name�
is_valid_namerrrVr�r�r�r�r.r)rr'�
new_parent_id�new_name�
new_parent�new_parent_idpath�file_ie�
old_parents        r�rename�Inventory.rename�s��*�(�3���X�&�&��/�/�"D�"K�"K�H�"U�V�V��Z�Z�
�.�
��*�*�*��/�/�-�4�4��l�l�=�9���
�!�O�O�M�:���'��/�/�P�W�W��L�L��)�4�<�<�
�+F���
��*�*�W�%���Z�Z�� 1� 1�2�
�
������-�(/���H�%���)�rc�\�URSL=(a XRR:H$r)r=r'r�s  r�is_root�Inventory.is_root�s#���y�y��$�E��I�I�4E�4E�)E�Er)r�r�r=r�r,)#rrrrr��ROOT_IDrr�r�r�r�rqr�rSr�rar�r�r@r�r�r�rLr�r�r�r�r�r9rbrjr�rr"r!r"rrr�r�s����4 '�D�'�"V�{�|BG��4���&��T�&�\�� �
#��8�"(�@��&�2�2?�")�*&�)�#�%� �D�($*�LFrr�c�J�\rSrSr%Sr\R\S'SrSr	Sr
SrSr\
S	5rS
rS#Sjr\S5r\S$S
j5rSrSrSrS\\S\\4SjrSrSrSrSrSr Sr!Sr"S\#4Sjr$Sr%S\&\'\\'4S\(\4Sjr)Sr*\+S 5r,S!r-g")%�CHKInventoryi�a�An inventory persisted in a CHK store.

By design, a CHKInventory is immutable so many of the methods
supported by Inventory - add, rename, apply_delta, etc - are *not*
supported. To create a new CHKInventory, use create_by_apply_delta()
or from_inventory(), say.

Internally, a CHKInventory has one or two CHKMaps:

* id_to_entry - a map from (file_id,) => InventoryEntry as bytes
* parent_id_basename_to_file_id - a map from (parent_id, basename_utf8)
    => file_id as bytes

The second map is optional and not present in early CHkRepository's.

No caching is performed: every method call or item access will perform
requests to the storage layer. As such, keep references to objects you
want to reuse.
�id_to_entryc�r�[RU5 0UlSUl0UlXlSUlgr�)r.r�_fileid_to_entry_cache�
_fully_cached�_path_to_fileid_cache�_search_key_namer�)r�search_key_names  rr�CHKInventory.__init__s5��� � ��&�&(��#�"���%'��"� /����rc�8�[U[5(d[$URR	5nURR	5nUR
R	5nUR
R	5nSX$X54;agX#:H=(a XE:H$)z-Compare two sets by comparing their contents.NF)rPr&r�r'�key�parent_id_basename_to_file_id)rr��this_key�	other_key�this_pid_key�
other_pid_keys      rr��CHKInventory.__eq__s����%��.�.�!�!��#�#�'�'�)���%�%�)�)�+�	��9�9�=�=�?���;�;�?�?�A�
��H�I�E�E���$�F��)F�Frc���URb
URnOSnURRS5nURS:XaJUR(aSnOSnSUR
UUURURURU4-$URS:XaSUR
UUUR4-$URS	:Xa7S
UR
UUURURRS54-$URS:Xa(SUR
UUURUR4-$[S
RUR55e)a�Serialise entry as a single bytestring.

:param Entry: An inventory entry.
:return: A bytestring for the entry.

The BNF:
ENTRY ::= FILE | DIR | SYMLINK | TREE
FILE ::= "file: " COMMON SEP SHA SEP SIZE SEP EXECUTABLE
DIR ::= "dir: " COMMON
SYMLINK ::= "symlink: " COMMON SEP TARGET_UTF8
TREE ::= "tree: " COMMON REFERENCE_REVISION
COMMON ::= FILE_ID SEP PARENT_ID SEP NAME_UTF8 SEP REVISION
SEP ::= "\n"
r�utf8rZ�Y�Nsfile: %s
%s
%s
%s
%s
%d
%sr[sdir: %s
%s
%s
%sr\ssymlink: %s
%s
%s
%s
%sr^stree: %s
%s
%s
%s
%srU)
r.r�encoderWrAr'r/r�r�r�r�r�rV)rr(�
parent_str�name_str�exec_strs     r�_entry_to_bytes�CHKInventory._entry_to_bytess]���?�?�&����J��J��:�:�$�$�V�,���:�:����������6��
�
�������������:��
��Z�Z�;�
&�)��
�
������	-��
��Z�Z�9�
$�1��
�
�������$�$�+�+�F�3�5��
��Z�Z�+�
+�.��
�
�������(�(�2��
��0�7�7��
�
�C�D�Drc�z�[5n[5n0nURU5H�nURS:XaURUR5 URUR
5 UR
UR
[55RUR5 M� URU5nURS5 URS5 U(a�[5nURU5H[nURUR
5 UR
UR
[55RUR5 M] URU5nURU5 U(aM�URU5 URS5 U(a�UVs/sHo�4PM n	n[5nURRU	5n
U
Vs1sHo�SiM	 nnURU5nURU5 URU5HknURS:XaURUR5 UR
UR
[55RUR5 Mm U(aM�X$4$s snfs snf)a%Give a more wholistic view starting with the given file_ids.

For any file_id which maps to a directory, we will include all children
of that directory. We will also include all directories which are
parents of the given file_ids, but we will not include their children.

eg:
  /     # TREE_ROOT
  foo/  # foo-id
    baz # baz-id
    frob/ # frob-id
      fringle # fringle-id
  bar/  # bar-id
    bing # bing-id

if given [foo-id] we will include
    TREE_ROOT as interesting parents
and
    foo-id, baz-id, frob-id, fringle-id
As interesting ids.
r[Nr)rQ�	_getitemsrWrLr'r.�
setdefault�
difference�discardr�r1�	iteritems)
r�file_ids�interestingr��children_of_parent_idr(�remaining_parents�next_parentsr��keysr��item�
next_file_idss
             r�'_expand_fileids_to_parents_and_children�4CHKInventory._expand_fileids_to_parents_and_childrenUs3��,�e��!$��� "���^�^�H�-�E��z�z�[�(�%�)�)�%�-�-�8��O�O�E�O�O�,�!�,�,�U�_�_�c�e�D�H�H����W�	.�(�2�2�8�<��	������!�!�$�'���5�L����(9�:��� � ����1�%�0�0����#�%�H�L�L��M�M��;�!-� 7� 7�� D�����0�1� ��	���8�$����D�!�#�#8�8�"7�Q�D�"7�D�8�$'�E�!��6�6�@�@��F�E�16�7���!�W��M�7�)�4�4�[�A�M����}�-����
�6���:�:��,�)�-�-�e�m�m�<�%�0�0����#�%�H�L�L��M�M��7�$�#��1�1��9��8s�>J3�5J8c��URU5up#[UR5nURRURlUR
UlU(aU(dU$URn[X0R5nU(afUR5nXWnURS:XaUR5nURU5 Xs;aURX75 U(aMfU$)r�r[)
rOr�r�r=r/r�r)rr>rWrqrLrT)	rr�rH�parent_to_childrenr��cache�remaining_childrenr'rGs	         rr��CHKInventory.filter�s���
�8�8�9I�J�	*���$�,�,�'��"�i�i�0�0��
�
�� �,�,����"4��L��+�+��"�#5�l�l�#C�D�� �(�0�0�2�G���B��w�w�+�%��W�W�Y��
�I�I�b�M��,�"�)�)�*<�*E�F�!� ��rc�d�URS5nUSRS5up#USX1S4$)z-Get the file_id, revision_id key out of data.�
r�: r�)�split)�data�sectionsrWr's    r�_bytes_to_utf8name_key�#CHKInventory._bytes_to_utf8name_key�s;��
�:�:�e�$�� ���)�)�%�0�
�����W�q�k�2�2rc��URS5nUSRS5(aT[USSSUSRS5US5nUS	Ul[US
5UlUSS:HUlGOUSRS5(a*[USS
SUSRS5USU5nO�USRS
5(aB[USSSUSRS5US5nUS	RS5Ul
OfUSRS5(a3[USSSUSRS5US5nUS	UlO[SRU55eURUlUSUlUR"S:XaSUlX0R$UR'U$)zDeserialise a serialised entry.rWrsfile: �Nrr8r��r9sdir: s	symlink: �	stree: zNot a serialised entry {!r}rYr)rZ�
startswithr��decoder��intr�rA�CHKInventoryDirectoryrr�rr�r�rVr'r/r.r))rrQr\�results    r�_bytes_to_entry�CHKInventory._bytes_to_entry�s����;�;�u�%���A�;�!�!�)�,�,�"����A�B���!��!3�!3�F�!;�X�a�[��F� (��{�F��"�8�A�;�/�F�� (���t� 3�F��
�a�[�
#�
#�H�
-�
-�*����A�B���!��!3�!3�F�!;�X�a�[�$��F��a�[�
#�
#�L�
1�
1�"����A�B���!��!3�!3�F�!;�X�a�[��F�%-�Q�K�$6�$6�v�$>�F�!�
�a�[�
#�
#�I�
.�
.�"����A�B���!��!3�!3�F�!;�X�a�[��F�)1���F�%��:�A�A�%�H�I�I������"�1�+������s�"�#�F��6<�#�#�F�N�N�3��
rc
��[Rn[UR5nU(aURR5Ul[RRUR5nURR5 URRRnX%l
[R"URRURR!5US9Ul	URR5 URRR#U5 0nUR$b�[R"UR$RUR$R!5US9UlUR$R5 UR$R5 UR$Rn	UR$Rn
U	R#U
R5 U
R&U	lOSUlUR(Ul/n[+U5n[-U5n[/U5n[1U5n[3U5n[5U5n[75n[75n
[75nUGH�unnnnUS:XaUUlUc+SnSnU(aURU	U
R;U5 OIU4nUR=U5nUURU'UR;U"U5SUR>45 UcSnO_U4nURAU5U:wa6[BRD"UUSRGURAU555eUR;U5 URIUUU45 UR$cGMUcSnO"URKU5nURMU5nUcSnSnOURMU5nUnUU:wdGMbUbUUROUSS/5S'UcGM�UUROUSS/5S'GM� U
H�nURKU5nURPS:waM&URRRU5HNnURVU;dM[BRD"URAURV5URVS5e M� URRYU5 U(ag/nUR[5H6ununnUbURIUUU45 M"URIUSS45 M8 UR$RYU5 UR]S	5 UH�unnURKU5RPS:wa'[BRD"URAU5US
5eURaU5U:wdMe[BRD"UUS
RGURaU555e U$![8a GNLf=f![BR^an[BRD"SUS5UeSnAff=f)a�Create a new CHKInventory by applying inventory_delta to this one.

See the inventory developers documentation for the theory behind
inventory deltas.

:param inventory_delta: The inventory delta to apply. See
    Inventory.apply_delta for details.
:param new_revision_id: The revision id of the resulting CHKInventory.
:param propagate_caches: If True, the caches for this inventory are
  copied to and updated for the result.
:return: The new CHKInventory.
��search_key_funcNr�rr�rr[z4Child not deleted or reparented when parent deleted.)r�Nz#Not a directory, but given childrenr�z-Parent is not present in resulting inventory.zParent has wrong path {!r}.)1r
rZr&r,r+rqr
�search_key_registryr�r'�_ensure_root�
_root_node�maximum_sizer��CHKMap�_storer0�set_maximum_sizer1�
_key_widthr�r�r�r�r�r�r�rQrrLr?r.r�rr�rVrlr@�_parent_id_basename_keyrCrWr�r�r'r�r�rErCr1)rr�r�r�rZrhrmrq�parent_id_basename_delta�result_p_id_root�	p_id_root�id_to_entry_deltarOrg�alteredr�r�r'r(�new_key�	new_value�old_keyr1r��
delta_listr0�valuer�r:r�s                              rr��"CHKInventory.create_by_apply_delta�s����
�
���d�3�3�4���+/�+E�+E�+J�+J�+L�F�(�!�5�5�9�9�$�:O�:O�P�����%�%�'��'�'�2�2�?�?��,��$�^�^����#�#���� � �"�+�
���
	���'�'�)����%�%�6�6�|�D�$&� ��-�-�9�3:�>�>��2�2�9�9��2�2�6�6�8� /�4�F�0�

�0�0�=�=�?��.�.�;�;�=�%�C�C�N�N���:�:�E�E�I��-�-�i�.D�.D�E�*3�*>�*>��'�37�F�0��������2�/�B��7��H��7��H��6��G��4�_�E��B�?�S���%��
�%���%��2A�.�H�h����2�~�!(������� �	�#��"�8�8��B����G�$�"�*��"�2�2�5�9�	�:A��,�,�X�6����U�8�_�Q�/����A�B�����"�*���<�<��(�H�4� �2�2� ��=�D�D� �L�L��1�������G�$��$�$�g�w�	�%B�C��3�3�?��#�"�G� $���w� 7�I�"�:�:�9�E�G��#�"�G� $�I�"�:�:�5�A�G� '�I��g�%��*�$�1�;�;�G�d�D�\�R����*�&�1�;�;�G�d�D�\�R���w3B�~�G��N�N�7�+�E��z�z�[�(�����.�.�0���=�=��/� �2�2����U�]�]�3��
�
�N���1�
�	���&�&�'8�9�#�
�J�)A�)G�)G�)I�%��%�g�u��$��%�%�w��U�&;�<��%�%�w��d�&;�<�	*J�

�0�0�<�<�Z�H����
�#�#*��K��

��#�#�F�+�0�0�K�?� �2�2����v�.��=���@��~�~�k�*�f�4��.�.���1�8�8�����9T�U���$+�$�
��A$�����l�?�?�
��.�.���)X�����
�s+�?
X�3AX�
X�X�Y�0Y	�	Yc�n�USRS5(d[S5eUSS:wa[SR[55e0n[	S5nUSS	H�nURS5R
S
S5upxXu;a*[R"SRU[55eXt;a*[R"SRU[55eX�U'M� US
n	USn
URSS5nURS5nURS5(d[SRU55eUSn
U
RS5(d[SRU
55e[U5nX�lX�l
[RRUR 5nUb[R""UU4US9UlOS	Ul[R""UU
4US9UlUR4U:wa%[SRURU55eU$)z�Deserialise a CHKInventory.

:param chk_store: A CHK capable VersionedFiles instance.
:param bytes: The serialised bytes.
:param expected_revision_id: The revision ID we think this inventory is
    for.
:return: A CHKInventory
r6rWz#last line should have trailing eol
r�chkinventory:
z#not a serialised CHKInventory: {!r})�root_id�revision_id�parent_id_basename_to_file_id�search_key_name�id_to_entryrNrXz#Unknown key in inventory: {!r}
{!r}z%Duplicate key in inventory: {!r}
{!r}r�r�r��plainr�ssha1:z;parent_id_basename_to_file_id should be a sha1 key not {!r}r�z)id_to_entry should be a sha1 key not {!r}rlz/Mismatched revision id and expected: {!r}, {!r})�endswithr�rVrQ�	frozenset�rstriprZrrr�rdr&r�r�r
rnr,rrr1r')�klass�	chk_store�lines�expected_revision_id�info�allowed_keys�liner0r�r�r�r-r1r'rhrms                r�deserialise�CHKInventory.deserialise�s@���R�y�!�!�%�(�(��C�D�D���8�)�)��B�I�I�%�P�Q�Q��� �
�
���!�"�I�D����U�+�1�1�%��;�J�C��&��o�o�:�A�A�#�u�M����{��o�o�<�C�C�C��O�����I���>�*���z�"���(�(�#5�x�@��(,���1Q�(R�%�,�7�7��A�A��M�T�T�1���
�
�>�*���%�%�h�/�/��;�B�B�;�O��
��o�.��(�� ��!�5�5�9�9�&�:Q�:Q�R��(�4�3:�>�>��.�0� /�4�F�0�48�F�0�$�^�^��
�N�+�
���

��� �$8�8��A�H�H��&�&�(<���
�
�
rc�V�U"U5nURUlURRUlURnUR
n0n0n	UR
5H2up�UR4nU"U5X�'U"U5n
URX�'M4 URUUU	US9 U$)arCreate a CHKInventory from an existing inventory.

The content of inventory is copied into the chk_store, and a
CHKInventory referencing that is returned.

:param chk_store: A CHK capable VersionedFiles instance.
:param inventory: The inventory to copy.
:param maximum_size: The CHKMap node size limit.
:param search_key_name: The identifier for the search key function
)rq)r�r=r'r�r?rvrE�_populate_from_dicts)r�r��	inventoryrqr-rh�entry_to_bytes�parent_id_basename_key�id_to_entry_dict�parent_id_basename_dictr�r(r0�p_id_keys              r�from_inventory�CHKInventory.from_inventory�s�����'��&�2�2���"���/�/����/�/��!'�!?�!?����"$��%�2�2�4�L�E��=�=�"�C�$2�5�$9��!�-�e�4�H�05�
�
�#�-�	5�	�#�#���#�%�		$�	
��
rc�J�[RRUR5n[RRUUUSUS9n[R"XU5Ul[RRUUUSUS9n[R"XU5Ulg)Nr)rq�	key_widthrmr)r
rnr�r,rr�	from_dictr'r1)rr�r�r�rqrm�root_keys       rr��!CHKInventory._populate_from_dictss���"�5�5�9�9�$�:O�:O�P���>�>�+�+���%��+�,�
��#�>�>�)��O����>�>�+�+��#�%��+�,�
��.5�^�^���.
��*rc�r�URb
URnOSnX!RRS54$)zBCreate a key for a entry in a parent_id_basename_to_file_id index.rr8)r.rr;)rr(r.s   rrv�$CHKInventory._parent_id_basename_key1s2���?�?�&����I��I��:�:�,�,�V�4�5�5rc�:�Uc[R"X5eURRUS5nUbU$UR	[URRU4/55S5$![an[R"X5UeSnAff=f)z'Map a single file_id -> InventoryEntry.Nr)	rrCr)r�rir�r'rF�
StopIteration)rr'rhr�s    rr@�CHKInventory.get_entry9s����?��/�/�$�0�0��,�,�0�0��$�?�����M�	8��'�'��T�%�%�/�/�'���=�>�q�A��
���	8��/�/�$�0�a�7��	8�s�7A4�4
B�>B�BrGr�c��/n/nUHFnURRUS5nUcURU5 M5URU5 MH UVs/sHof4PM nnURR	U5H?up�URU	5nURU5 XPRUR'MA U$s snf)z�Similar to get_entry, but lets you query for multiple.

The returned order is undefined. And currently if an item doesn't
exist, it isn't included in the output.
N)r)r�rlr'rFrir')
rrGrh�	remainingr'r(r��	file_keys�	_file_keyr�s
          rrB�CHKInventory._getitemsHs���(*��"$�	��G��/�/�3�3�G�T�B�E��}�� � ��)��
�
�e�$� �7@�'@�i���i�	�'@� $� 0� 0� :� :�9� E��I��(�(��/�E��M�M�%� �9>�'�'��
�
�6�!F��
��(As�Cc��URRUS5bg[[URRU4/555S:H$)NTr)r)r�rRrSr'rFr�s  rrb�CHKInventory.has_id]sH���&�&�*�*�7�D�9�E���4��(�(�2�2�W�J�<�@�A�B�a�G�Grc��XR:H$rr�r�s  rr"�CHKInventory.is_rootcs���,�,�&�&rc#�# �Ub(URU5nUv� URnUbM'gg![an[R"XS9UeSnAff=f7fr)r@rrrCr.rs    rr9�"CHKInventory._iter_file_id_parentsfs[����!�
I��^�^�G�,���H��l�l�G�
�!���
I��o�o�4�A�q�H��
I�s)�A�/�A�A�
A�A�A�Ac#�`# �URR5HupUSv� M g7f)r�r6N)r'rF)rr0�_s   rra�CHKInventory.iter_all_idsps)����&�&�0�0�2�F�C��b�'�M�3�s�,.c#��# �URR5HLupUSnURRUS5nUcUR	U5nX@RU'Uv� MN g7f)r�rN)r'rFr)r�ri)rr0r(r'rGs     rr��CHKInventory.iter_just_entriesusk����*�*�4�4�6�J�C��!�f�G��,�,�0�0��$�?�B��z��)�)�%�0��79�+�+�G�4��H�
7�s�A,A.c��UR(agURnURR5H*up#USnXA;aUR	U5nXQU'M&XnM, S=pgUR
R5nUGH5up)US:Xa5X�R:wa$[SRX�R55eMAUup�XnX�:XaUc[S5eUnOXnURS:wa$[SRX�R55eURc0UlURS5nX�R;a(URUn
X�:wa[S	U<S
U
<S35eX�R:wa%[SRX�UR55eX\RU'GM8 S
Ulg)z5Make sure all file-ids are in _fileid_to_entry_cache.Nr)rrzaData inconsistency detected. We expected data with key ("","") to match the root id, but {} != {}z!last_parent_ie should not be Noner[z�Data inconsistency detected. An entry in the parent_id_basename_to_file_id map has parent_id {{{}}} but the kind of that object is {!r} not "directory"r�z7Data inconsistency detected. Two entries with basename z! were found in the parent entry {�}z�Data inconsistency detected. In the parent_id_basename_to_file_id map, file_id {{{}}} is listed as having basename {!r}, but in the id_to_entry map it is {!r}T)r*r)r'rFrir1r�r�rV�AssertionErrorrW�	_childrenrer)rrSr0r(r'rG�last_parent_id�last_parent_ie�	pid_items�
child_file_idr.�basename�	parent_ie�existing_ies              rrH�CHKInventory._preload_cache�s��������+�+���*�*�4�4�6�J�C��!�f�G��#��)�)�%�0��!#�g���^��
7�+/�.���6�6�@�@�B�	�"+��C��j� � �L�L�0�$�5�5;�V�M�<�<�5X���
�"%��I��%�B��*�!�)�(�)L�M�M�*�	�!�,�	��~�~��,� �/�06�v�i���/P�	���"�"�*�&(�	�#����w�/�H��.�.�.�'�1�1�(�;���$�$�6�6>�\�B2�2;��b�B���
�7�7�"� �2�39�&�%����3�	��-/����)�[#,�\"��rc	#�# �URRUR5GH�up#nUSnUbGURU5nURU5nURnUR
n	URn
OSnSnSn	Sn
UbGURU5nURU5nURn
UR
nURnOSnSn
SnSnUcSWR4nSnO.UcWRS4nSnOWRWR4nSnSnUSUS:waSnO�USS	:Xa7WRWR:wdURUR:waSnOKUSS
:XaWRWR:waSnO%USS:XaWRWR:waSnX�4nX�4nX�4nU(d'USUS:XaUSUS:XaUSUS:XaGM�UX|4UUUUUU4v� GM� g7f)z�Generate a Tree.iter_changes change list between this and basis.

:param basis: Another CHKInventory.
:return: An iterator over the changes between self and basis, as per
    tree.iter_changes().
rN)FT)TF)TTFrTrZr\r^)r'�iter_changesrir�r.rrArWr�r�r�r�)r�basisr0�basis_value�
self_valuer'�basis_entry�path_in_source�basis_parent�
basis_name�basis_executable�
self_entry�path_in_target�self_parent�	self_name�self_executablerW�	versioned�changed_contentr:rrAs                      rr��CHKInventory.iter_changes�sP���-1�,<�,<�,I�,I����-
�(�C�j��!�f�G��&�#�3�3�K�@��!&���w�!7��*�4�4��(�-�-�
�#.�#9�#9� �!%��#��!�
�#'� ��%�!�1�1�*�=�
�!%���g�!6��(�2�2��&�O�O�	�",�"7�"7��!%��"�� �	�"&���"��j�o�o�.��)�	��#�#�(�(�$�/��)�	�#�(�(�*�/�/�:��(�	�#�O��A�w�$�q�'�!�"&���a��F�"��(�(�K�,A�,A�A�!�+�+�{�/D�/D�D�&*�O���a��I�%��,�,��0J�0J�J�&*�O���a��,�,��0�0�K�4R�4R�R�&*�O�"�0�F��*�D�*�<�J�#��1�I����*���G�t�A�w�&��q�M�Z��]�2����0�������	�	
�A-
�s�G>Hc�,�[UR5$)z.Return the number of entries in the inventory.)rRr'rKs rr��CHKInventory.__len__	s���4�#�#�$�$rc��[U[5(d[RX5$/nURRUR5Hmup4nUSnUbUR
U5nOSnUb1URU5nX�RU'UR
U5n	OSnSn	URXyXh45 Mo U$)r`rN)
rPr&r.rjr'r�r�rir)rl)
rrcrir0�	old_valuer�r'r�r(r�s
          rrj�CHKInventory._make_delta	s����#�|�,�,�"�.�.�t�9�9���*.�*:�*:�*G�*G��O�O�+
�&�C�J��!�f�G��$��;�;�w�/�����%��,�,�Z�8��7<�+�+�G�4��<�<��0�������L�L�(�g�=�>�+
� �rr�c
�v�[U[5(a[R"U5nOUnU/:XaS/n[R"U6nUR
R
US5nUbU$URnUcgURnSnUH�nUcUnOUS-U-nURS5nUR
R
US5n	U	cfXH4/n
URU
5nUH8uup�n	X�:wdX�:wdM[R"SRX�X�55e U	c gX�R
U'U	nM� U$)zSee CommonInventory.path2id().r�NrOr8z-corrupt inventory lookup! {!r} {!r} {!r} {!r})rPr|r
r}rqr+r�r�r1r;rFrrrV)rr�r�rh�
current_id�parent_id_index�cur_pathr��
basename_utf8r'�
key_filterr�r.�	name_utf8s              rr1�CHKInventory.path2id4	sX���g�s�#�#��%�%�g�.�E��E��"�}��$���&�&��0�G��+�+�/�/���>�����M��\�\�
�����<�<�����H���#��#�c�>�H�4��$�O�O�F�3�M��0�0�4�4�X�t�D�G���)�9�:�
�'�1�1�*�=��7<�3�*�Y�G� �.�)�2L�$�o�o�K�R�R� )�y����8=��?��;B�.�.�x�8� �J�+�,�rc��S/nURS:wa�URSUR-5 URSUR-5 URSURR	5S4-5 URSUR
-5 URSURR	5S4-5 U$URSUR
-5 URSUR-5 URb0URSURR	5S4-5 URSURR	5S4-5 U$)	z!Serialise the inventory to lines.r�r�ssearch_key_name: %s
sroot_id: %s
s"parent_id_basename_to_file_id: %s
rsrevision_id: %s
sid_to_entry: %s
)r,rlr�r1r0r�r')rr�s  r�to_lines�CHKInventory.to_lines^	sZ��#�$��� � �H�,��L�L�1�T�5J�5J�K�L��L�L�)�D�L�L�8�9��L�L�6��5�5�9�9�;�A�>�@�A�
�
�L�L�-��0@�0@�@�A��L�L�-��1A�1A�1E�1E�1G��1J�0L�L�M���
�L�L�-��0@�0@�@�A��L�L�)�D�L�L�8�9��1�1�=����:��9�9�=�=�?��B�D�E��
�L�L�-��1A�1A�1E�1E�1G��1J�0L�L�M��rc�8�URUR5$)zGet the root entry.)r@r�rKs rr=�CHKInventory.rootv	s���~�~�d�l�l�+�+r)r)r*r+r,r'r1r�Nr�)rr�).rrrrr�r
rr�__annotations__rr�r?rOr�r�r]rir��classmethodr�r�r�rvr@rr�rSr+rBrbr"r9rar�rHr�rfr�rjrr|rr1r��propertyr=r!r"rrr&r&�s,���(�����G�:E�xG2�R%�N�3��3��DBG�x�t�J��J�X�EM�!��!�F
�.6�
8��(�6�"2��t�N�7K��*H�'�#��
� ="�~S�j%��%��.(�u�S�$�s�)�^�4�(��&�9I�(�T�0�,��,rr&c�6�\rSrSrSrSS/rSr\S5rSr	g)	rgi|	r�r��_chk_inventoryc�J�[RXX#5 SUlX@lgr)r+rr�r�)rr'rr.�
chk_inventorys     rr�CHKInventoryDirectory.__init__�	s!��	����t�?����+�rc��URbUR$URRc[S5e0nURRn[	5nURUR4/S9HuupEnURU45 M [	5nUHPnURRRUSS5n	U	cM1X�U	R'URU5 MR URU5 URRn
U
RU5HIup�URRU5n	X�U	R'X�RRUS'MK XlU$)auAccess the list of children of this directory.

With a parent_id_basename_to_file_id index, loads all the children,
without loads the entire index. Without is bad. A more sophisticated
proxy object might be nice, to allow partial loading of children as
well when specific names are accessed. (So path traversal can be
written in the obvious way but not examine siblings.).
NzIInventories without parent_id_basename_to_file_id are no longer supported)r�r)r�r�r1r�rQrFr'rLr)r�r�difference_updater'ri)rrhr��
child_keys�
_parent_id�
_name_utf8r'�cached�file_id_keyr(r'rQs            rr��CHKInventoryDirectory.children�	sq���>�>�%��>�>�!����<�<�D� �I��
����-�-�K�K���U�
�1@�1J�1J�����(�2K�2
�-�$�Z�g�
�N�N�G�:�&�2
����%�K��'�'�>�>�B�B�;�q�>�SW�X�E�� �%*�u�z�z�"��
�
�;�'�	&�
	�$�$�V�,��)�)�5�5��"-�"7�"7�
�"C��K��'�'�7�7��>�E�!&�5�:�:��IN���6�6�{�1�~�F�#D� ���
r)r�r�N)
rrrrr�r�rr�r�r!r"rrrgrg|	s)��&��.�/�I�,��(��(rrg)r[rZr\r^Nc���UcSSKJn URU5n[U5n[UnU"X1U5$![
an[R"X5UeSnAff=f)z�Create an inventory entry.

:param kind: the type of inventory entry to create.
:param name: the basename of the entry.
:param parent_id: the parent_id of the entry.
:param file_id: the file_id to use. if None, one will be created.
Nrr�)r�r��gen_file_idr�
entry_factoryrr�BadFileKindError)rWrr.r'r��factoryr�s       rrmrm�	si����"��*�*�4�0��!�$�'�D�9���%���7�)�,�,���9��%�%�d�1�q�8��9�s�	9�
A�A�Ac�~�[R"U5upX:waU(aU$[R"U5eU$)z�Normalize name.

:raises InvalidNormalization: When name is not normalized, and cannot be
    accessed on this platform by the normalized path.
:return: The NFC normalised version of name.
)r
�normalized_filenamer�InvalidNormalization)r�	norm_name�
can_accesss   rrr�	s>��$�7�7��=��I�������-�-�d�3�3��Krz	^[^/\\]+$c�>�[[RU55$r)r0�_NAME_RE�matchrs rrr�	s������t�$�%�%rc#��# �[5nUHbn[U5S-nURUS5 [U5U:wa*[R"US=(d USUSS5eUv� Md g7f)zaDecorate a delta and check that the file ids in it are unique.

:return: A generator over delta.
rrrzrepeated file_idN�rQrRrLrr�)ri�idsrM�lengths    rr�r��	st���
�%�C����S��A�������Q����s�8�v���*�*��Q��"�4��7�D��G�-?��
��
��s�A4A6c#��# �[5nUHWn[U5S-nUSnUb:URU5 [U5U:wa[R"XBSS5eUv� MY g7f)zbDecorate a delta and check that the new paths in it are unique.

:return: A generator over delta.
rNr�
repeated pathr�ri�pathsrMr
r�s     rr�r��	�g���

�E�E����U��a����A�w�����I�I�d�O��5�z�V�#��.�.�t�!�W�o�N�N��
����A)A+c#��# �[5nUHWn[U5S-nUSnUb:URU5 [U5U:wa[R"XBSS5eUv� MY g7f)zbDecorate a delta and check that the old paths in it are unique.

:return: A generator over delta.
rrNrrrr
s     rr�r�
rrc#�P# �UH�nUSnUSc9[R"US=(d USUSSRU55e[US[5(d9[R"US=(d USUSSRU55eUv� M� g7f)z[Decorate a delta and check that the ids in it are valid.

:return: A generator over delta.
rYrNrrzentry with file_id None {!r}z!entry with non bytes file_id {!r})rr�rVrPrQ�rirMr(s   rr�r�
s����
���Q�����7�?��*�*��Q��"�4��7��Q��.�5�5�e�<��
�
�$�q�'�5�)�)��*�*��Q��"�4��7��Q��3�:�:�5�A��
�
�
��s�B$B&c#��# �UH[nUSnUbLURUS:wa9[R"US=(d USUSSRU55eUv� M] g7f)ziDecorate a delta and check that the ids in it match the entry.file_id.

:return: A generator over delta.
rYNrrrzmismatched id with {!r})r'rr�rVrs   rr�r�3
so���
���Q������}�}��Q��'��.�.���G�&�t�A�w��Q��1J�1Q�1Q�RW�1X����
��s�A#A%c#��# �UHUnUSnUSnUc!Ub[R"USUSS5eUbUc[R"X!SS5eUv� MW g7f)zeDecorate a delta and check that the new_path and entry are paired.

:return: A generator over delta.
rrYNrzEntry with no new_pathznew_path with no entry)rr�)rirMr�r(s    rr�r�B
ss���
����7���Q������ 1��*�*�4��7�D��G�=U�V�V���E�M��*�*�8�!�W�>V�W�W��
��s�AAc��UR5n[SUR55nUH$up4URUR	55 M& U$)z|Create a new inventory that has the same contents as a specified tree.

:param tree: Revision tree to create inventory from
N)r\r��get_revision_idrLrq)r7ryrFr��	inv_entrys     r�mutable_inventory_from_treerQ
sL��
�&�&�(�G�
�D�$�.�.�0�
1�C�#������	��� �!�$��Jrr)*r$�collectionsr�collections.abcr�typingrrr�rr	r
rr
rQr��InternalBzrErrorrrr$r+r�r�rrr.r�r&rgr�rmr�lazy_compilerrr�r�r�r�r�r�rr"rr�<module>rs��8���$�"�1�1��	���v�.�.���f�o�o��Q
�Q
�h
'��'�Tw�N�w�tY�N�Y�x%�N�%�PY3�Y3�x
YF��YF�xL,�?�L,�^5�.�5�r$���#�	�
�-�(�,�"�"�<�0��&�
� 
� 
� �,��	r

Youez - 2016 - github.com/yon3zu
LinuXploit