ó
    ‘óýjêy  ã                   ó*  • S r / SQrSSKrSSKrSSKJrJr  SSKJr  SSK	J
r
JrJrJr  SSKJr  \(       a  SS	KJr  SS
KJr  SSKJr  Sr\S-   rS\SSS\4S jrS\S\S\\S4   4S jrSS\S\S\4S jjr " S S5      rSSS\4S jr " S S5      rg)zGit notes handling.)ÚDEFAULT_NOTES_REFÚNOTES_REF_PREFIXÚNotesÚ	NotesTreeÚcreate_notes_treeÚget_note_fanout_levelÚget_note_pathÚsplit_path_for_fanouté    N)ÚIteratorÚSequence)ÚTYPE_CHECKINGé   )ÚBlobÚCommitÚObjectIDÚTree)ÚRef)ÚStackedConfig)ÚBaseObjectStore)ÚRefsContainers   refs/notes/s   commitsÚtreeÚobject_storer   Úreturnc                 ón   ^^• S
S[         S[        S[        4UU4S jjjmT" U 5      nUS:  a  gUS:  a  gg	)ag  Determine the fanout level for a note tree.

Git uses a fanout directory structure for performance with large numbers
of notes. The fanout level determines how many levels of subdirectories
are used.

Args:
    tree: The notes tree to analyze
    object_store: Object store to retrieve subtrees

Returns:
    Fanout level (0 for no fanout, 1 or 2 for fanout)
r
   r   Úlevelr   c                 óZ  >• SnU R                  5        H‚  u  p4nUc   e[        R                  " U5      (       a  US-  nM-  [        R                  " U5      (       d  MJ  US:  d  MR  Uc   e TU   n[	        U[
        5      (       d   eUT" XaS-   5      -  nM„     U$ ! [         a     M•  f = f)z’Count notes in a tree recursively.

Args:
    tree: Tree to count notes in
    level: Current recursion level

Returns:
    Total number of notes
r
   r   é   )ÚitemsÚstatÚS_ISREGÚS_ISDIRÚ
isinstancer   ÚKeyError)	r   r   ÚcountÚnameÚmodeÚshaÚsubtreeÚcount_notesr   s	          €€Ú8/usr/local/lib/python3.13/site-packages/dulwich/notes.pyr)   Ú*get_note_fanout_level.<locals>.count_notesD   s±   ø€ ð ˆØ#Ÿz™zž|‰OˆD˜ØÑ#Ð#Ð#Ü�|Š|˜D×!Ñ!Ø˜‘
’Ü—’˜d×#Ó#¨°­	Ø‘Ð&�ðØ*¨3Ñ/�GÜ% g¬t×4Ñ4Ð4Ð4Ø™[¨¸!±)Ó<Ñ<’Eñ  ,ð ˆøô  ó Úðús   Á,*BÂ
B*Â)B*é   i   r   r   ©r
   )r   Úint)r   r   Ú
note_countr)   s    ` @r*   r   r   4   sI   ù€ ñ œ$ð ¤sð ´3÷ ñ ñ2 ˜TÓ"€Jð �CÓØØ	�eÓ	Øàó    ÚhexshaÚfanout_level.c                 ó¶   • US:X  a  U 4$ / n[        U5       H  nUR                  XS-  US-   S-   5        M!     UR                  XS-  S 5        [        U5      $ )zÄSplit a hex SHA into path components based on fanout level.

Args:
    hexsha: Hex SHA of the object
    fanout_level: Number of directory levels for fanout

Returns:
    Tuple of path components
r
   r   r   N)ÚrangeÚappendÚtuple)r1   r2   Ú
componentsÚis       r*   r	   r	   i   sk   € ð �qÓØˆyÐà€JÜ�<Ö ˆØ×Ñ˜& Q¡¨!¨a©%°1©Ð5Ö6ñ !à×Ñ�f¨AÑ-Ð/Ð0Ô1Ü�ÓÐr0   Ú
object_shac                 ó:   • [        X5      nSR                  U5      $ )zÄGet the path within the notes tree for a given object.

Args:
    object_sha: Hex SHA of the object to get notes for
    fanout_level: Fanout level to use

Returns:
    Path within the notes tree
ó   /)r	   Újoin)r9   r2   r7   s      r*   r   r   }   s   € ô ' zÓ@€JØ�9‰9�ZÓ Ð r0   c            
       óè   • \ rS rSrSrS\SSSS4S jrS\4S	 jrS
\SS4S jr	S\S\
S\S\S\4
S jrS\
S\S-  4S jrS\
S\
S-  4S jrS\
S\
S\4S jrS\
S\S-  4S jrS\\\\4      4S jrSrg)r   é‹   zRepresents a Git notes tree.r   r   r   r   Nc                 óF   • Xl         X l        U R                  5       U l        g)z‰Initialize a notes tree.

Args:
    tree: The tree object containing notes
    object_store: Object store to retrieve note contents from
N)Ú_treeÚ_object_storeÚ_detect_fanout_levelÚ_fanout_level)Úselfr   r   s      r*   Ú__init__ÚNotesTree.__init__Ž   s    € ð Œ
Ø)ÔØ!×6Ñ6Ó8ˆÕr0   c                 ó‚  • U R                   R                  5       (       d  gSnSn/ nU R                   R                  5        H_  u  pEnUc   eUc   e[        R                  " U5      (       a  SnUR	                  U5        M@  [        R
                  " U5      (       d  M]  SnMa     U(       a�  U(       d‰  U R                  R                  R                  nU R                   R                  5        HK  u  pEnUc   eUc   e[        R
                  " U5      (       d  M-  [        U5      U:X  d  M>   [        US5          g   U(       aË  U(       aÄ  [        S U 5       5      nU(       a«  US   n	 U R                   U	   u  p«U R                  U   n[        U[        5      (       d   eSnUR                  5        HM  u  pïnUc   eUc   e[        R                  " U5      (       d  M-  [        U5      S:X  d  M>   [        US5        Sn  O   U(       a  S$ S$ g! [         a     GM0  f = f! [         a     M|  f = f! [         a     gf = f)zUDetect the fanout level used in this notes tree.

Returns:
    Detected fanout level
r
   FTé   c              3   óp   #   • U  H,  n[        U5      S :H  =(       a    [        S U 5       5      v •  M.     g7f)r   c              3   ó*   #   • U  H	  oS ;   v •  M     g7f)s   0123456789abcdefN© )Ú.0Úcs     r*   Ú	<genexpr>Ú;NotesTree._detect_fanout_level.<locals>.<genexpr>.<genexpr>Á   s   é € Ð&NÊÀAÐ,?Ö'?Êùs   ‚N)ÚlenÚall)rL   r%   s     r*   rN   Ú1NotesTree._detect_fanout_level.<locals>.<genexpr>À   s2   é € ð #â%�Dô �D“	˜Q‘×N¤3Ñ&NÉÓ&NÓ#NÔNÚ%ùs   ‚46r   r   )r@   r   r   r!   r5   r    rA   Úobject_formatÚ
hex_lengthrP   r.   Ú
ValueErrorrQ   r"   r   r#   )rD   Ú	has_filesÚhas_dirsÚ	dir_namesr%   r&   r'   rT   Úall_two_char_hexÚsample_dir_nameÚ_sample_modeÚ
sample_shaÚsample_treeÚsub_has_dirsÚsub_nameÚsub_modeÚsub_shas                    r*   rB   ÚNotesTree._detect_fanout_level™   s.  € ð �z‰z×Ñ×!Ñ!Øð ˆ	ØˆØˆ	à#Ÿz™z×/Ñ/Ö1‰OˆD˜ØÑ#Ð#Ð#ØÑ#Ð#Ð#Ü�|Š|˜D×!Ñ!Ø�Ø× Ñ  Ö&Ü—’˜d×#Ó#Ø ’	ñ  2ö žXà×+Ñ+×9Ñ9×DÑDˆJØ#'§:¡:×#3Ñ#3Ö#5‘�˜CØÑ'Ð'Ð'ØÑ'Ð'Ð'Ü—<’< ×%Ó%¬#¨d«)°zÕ*AðÜ˜D "œÙ ñ $6ö ž	Ü"ñ #á%ó#ó  Ðö
  à"+¨A¡,�ðØ/3¯z©z¸/Ñ/JÑ,�LØ"&×"4Ñ"4°ZÑ"@�KÜ% k´4×8Ñ8Ð8Ð8ð $)�LØ7B×7HÑ7HÖ7JÑ3˜¨GØ'Ñ3Ð3Ð3Ø'Ñ3Ð3Ð3ÜŸ<š<¨×1Ó1´c¸(³mÀqÕ6Hð%Ü # H¨bÔ 1Ø/3 Ù %ñ 8Kö !-˜1Ð3°!Ð3ð øôG &ó Ûðûô8 $.ó %Ú $ð%ûô  ó ÙðúsU   Ä+HÅ(A2H1 ÇH1 Ç0H Ç>H1 ÈH1 È
HÈHÈ 
H.È*H1 È-H.È.H1 È1
H>È=H>Únew_fanout_levelc           	      óØ  ^ ^• UT R                   :X  a  g/ nT R                  5        HG  u  p4T R                  U   n[        U[        5      (       d  M+  UR                  X5R                  45        MI     [        5       nT R                  R                  U5        UT l	        UT l         U HÁ  u  p7[        R                  " U5      nT R                  R                  U5        [        X15      n	U	R                  S5      n
S[        S[        [           S[        S[        4U U4S jjmT" T R                  X¨R                   5      T l	        T R                  R                  T R                  5        MÃ     g)zqReorganize the notes tree to use a different fanout level.

Args:
    new_fanout_level: The desired fanout level
Nr;   r   r7   Úblob_shar   c                 óÌ  >• [        U5      S:X  ax  [        5       nU R                  5        H1  u  pEnXAS   :w  d  M  Uc   eUc   eUc   eUR                  XEU5        M3     UR                  US   [        R
                  S-  U5        U$ [        5       nSnU R                  5        HÕ  u  pEnXAS   :X  aª  Ub  Uc   e[        R                  " U5      (       a'  T
R                  U   n[        U[        5      (       d   eO
[        5       nT" X�SS U5      n	T
R                  R                  U	5        UR                  U[        R                  U	R                  5        SnM¸  Ub  Ub  Uc   eUR                  XEU5        M×     U(       d_  [        5       nT" X�SS U5      n	T
R                  R                  U	5        UR                  US   [        R                  U	R                  5        U$ ©zŸUpdate tree with new note entry.

Args:
    tree: Tree to update
    components: Path components
    blob_sha: SHA of the note blob

Returns:
    Updated tree
r   r
   Ni¤  FT©rP   r   r   Úaddr   ÚS_IFREGr!   rA   r"   Ú
add_objectÚS_IFDIRÚid©r   r7   re   Únew_treer%   r&   r'   Úfoundr(   Únew_subtreerD   Úupdate_trees             €€r*   rr   Ú/NotesTree._reorganize_tree.<locals>.update_tree  sÄ  ø€ ô �z“? aÓ'ä#›v�HØ+/¯:©:®<™˜ CØ¨a¡=Õ0Ø#'Ñ#3Ð3Ð#3Ø#'Ñ#3Ð3Ð#3Ø#&¡?Ð2 ?Ø$ŸL™L¨°SÖ9ñ ,8ð —L‘L ¨A¡´·±¸uÑ0DÀhÔOØ#�Oô  $›v�HØ!�EØ+/¯:©:®<™˜ CØ¨a¡=Ó0à#'Ñ#3¸¹ÐGÐ#GÜ#Ÿ|š|¨D×1Ñ1Ø*.×*<Ñ*<¸SÑ*A Ü'1°'¼4×'@Ñ'@Ð @Ñ'@ô +/«& Ù*5°gÈ!È"¸~ÈxÓ*X˜KØ ×.Ñ.×9Ñ9¸+ÔFØ$ŸL™L¨¬t¯|©|¸[¿^¹^ÔLØ$(šEð !%Ñ 0Ø$(Ñ$4Ø$'¡Oðð!4ð %ŸL™L¨°SÖ9ñ) ,8ö, !ä"&£&˜Ù&1°'ÀaÀb¸>È8Ó&T˜Ø×*Ñ*×5Ñ5°kÔBØ Ÿ™ Z°¡]´D·L±LÀ+Ç.Á.ÔQà#�Or0   )rC   Ú
list_notesrA   r"   r   r5   Údatar   rk   r@   Úfrom_stringr   Úsplitr   Úbytesr   rm   )rD   rc   Únotesr9   Únote_shaÚnote_objro   Únote_contentÚ	note_blobÚpathr7   rr   s   `          @r*   Ú_reorganize_treeÚNotesTree._reorganize_treeà   s8  ù€ ð ˜t×1Ñ1Ó1Øð ˆØ$(§O¡OÖ$5Ñ ˆJØ×)Ñ)¨(Ñ3ˆHÜ˜(¤D×)Ó)Ø—‘˜j¯-©-Ð8Ö9ñ %6ô “6ˆØ×Ñ×%Ñ% hÔ/ØˆŒ
Ø-ˆÔó ).Ñ$ˆJä×(Ò(¨Ó6ˆIØ×Ñ×)Ñ)¨)Ô4ä  Ó>ˆDØŸ™ DÓ)ˆJð9$Üð9$Ü(0´©ð9$ÜCKð9$ä÷9$ð 9$ñv % T§Z¡Z°¿\¹\ÓJˆDŒJØ×Ñ×)Ñ)¨$¯*©*Ö5òK ).r0   r%   r&   r'   c                 ó  • [        5       nUR                  5        H*  u  pgnXb:w  d  M  Ub  Ub  Uc   eUR                  XgU5        M,     UR                  X#U5        U R                  R	                  U5        XR
                  L a  XPl        U$ )z¿Update a tree entry and return the updated tree.

Args:
    tree: The tree to update
    name: Name of the entry
    mode: File mode
    sha: SHA of the object

Returns:
    The updated tree
)r   r   ri   rA   rk   r@   )	rD   r   r%   r&   r'   ro   Úexisting_nameÚexisting_modeÚexisting_shas	            r*   Ú_update_tree_entryÚNotesTree._update_tree_entry?  s�   € ô “6ˆØ:>¿*¹*¾,Ñ6ˆM¨,ØÕ$à!Ñ-Ø%Ñ1Ø$Ñ0ðð1ð —‘˜]¸<ÖHñ ;Gð 	�‰�T Ô%Ø×Ñ×%Ñ% hÔ/ð —:‘:ÒØ!ŒJàˆr0   r9   c                 ó¨  • [        XR                  5      nUR                  S5      nU R                  nUSS  HO  n XE   u  pg[        R
                  " U5      (       d    gU R                  U   n[        U[        5      (       d   eUnMQ      XCS      u  pg[        R                  " U5      (       d  gU$ ! [         a       gf = f! [         a     gf = f)z¤Get the SHA of the note blob for an object.

Args:
    object_sha: SHA of the object to get notes for

Returns:
    SHA of the note blob, or None if no note exists
r;   Néÿÿÿÿ)r   rC   rw   r@   r   r!   rA   r"   r   r#   r    )	rD   r9   r~   r7   Úcurrent_treeÚ	componentr&   r'   Úobjs	            r*   Ú_get_note_shaÚNotesTree._get_note_sha_  sÕ   € ô ˜Z×);Ñ);Ó<ˆØ—Z‘Z Ó%ˆ
à—z‘zˆØ# C R›ˆIðØ(Ñ3‘	�Ü—|’| D×)Ñ)ÙØ×(Ñ(¨Ñ-�Ü! #¤t×,Ñ,Ð,Ð,Ø"’ñ )ð	Ø$°¡^Ñ4‰IˆDÜ—<’< ×%Ñ%ØØˆJøô ó Úðûô ó 	Ùð	ús/   ¼!B3Á(B3Â$C Â1C Â3
CÃ CÃ
CÃCc                 ó´   • U R                  U5      nUc  g U R                  U   n[        U[        5      (       d  gUR                  nU$ ! [
         a     gf = f)z�Get the note content for an object.

Args:
    object_sha: SHA of the object to get notes for

Returns:
    Note content as bytes, or None if no note exists
N)rŒ   rA   r"   r   ru   r#   )rD   r9   rz   r{   ru   s        r*   Úget_noteÚNotesTree.get_note  sb   € ð ×%Ñ% jÓ1ˆØÑØð	Ø×)Ñ)¨(Ñ3ˆHÜ˜h¬×-Ñ-ØØ"Ÿ-™-ˆDØˆKøÜó 	Ùð	ús   —$A
 ¼A
 Á

AÁAr|   c                 ó4  ^ ^• [         R                  " U5      nT R                  R                  U5        [	        T R
                  T R                  5      nUT R                  :w  a  T R                  U5        [        UT R                  5      nUR                  S5      nS[        S[        [           S[        S[        4U U4S jjmT" T R
                  XcR                  5      nT R                  R                  U5        UT l        T R                  5       T l        U$ )z¹Set or update a note for an object.

Args:
    object_sha: SHA of the object to annotate
    note_content: Content of the note

Returns:
    New tree object with the note added/updated
r;   r   r7   re   r   c                 óÄ  >• [        U5      S:X  at  [        5       nU R                  5        H-  u  pEnXAS   :w  d  M  Ub  Ub  Uc   eUR                  XEU5        M/     UR                  US   [        R
                  S-  U5        U$ [        5       nSnU R                  5        HÕ  u  pEnXAS   :X  aª  Ub  Uc   e[        R                  " U5      (       a'  T
R                  U   n[        U[        5      (       d   eO
[        5       nT" X�SS U5      n	T
R                  R                  U	5        UR                  U[        R                  U	R                  5        SnM¸  Ub  Ub  Uc   eUR                  XEU5        M×     U(       d_  [        5       nT" X�SS U5      n	T
R                  R                  U	5        UR                  US   [        R                  U	R                  5        U$ rg   rh   rn   s             €€r*   rr   Ú'NotesTree.set_note.<locals>.update_tree­  s­  ø€ ô �:‹ !Ó#ä›6�Ø'+§z¡z¦|‘O�D Ø¨!™}Õ,Ø#Ñ/°DÑ4DÈÉÐXÐXØ Ÿ™ T°Ö5ñ (4ð —‘˜Z¨™]¬D¯L©L¸5Ñ,@À(ÔKØ�ô  ›6�Ø�Ø'+§z¡z¦|‘O�D Ø¨!™}Ó,à#Ñ/°C±OÐCÐCÜŸ<š<¨×-Ñ-Ø&*×&8Ñ&8¸Ñ&=˜GÜ#-¨g´t×#<Ñ#<Ð<Ñ#<ô '+£f˜GÙ&1°'ÀaÀb¸>È8Ó&T˜Ø×*Ñ*×5Ñ5°kÔBØ Ÿ™ T¬4¯<©<¸¿¹ÔHØ $šà#Ñ/°DÑ4DÈÉÐXÐXØ Ÿ™ T°Ö5ñ! (4ö$ ä"›f�GÙ"-¨gÀ!À"°~ÀxÓ"P�KØ×&Ñ&×1Ñ1°+Ô>Ø—L‘L ¨A¡´·±¸k¿n¹nÔMà�r0   )r   rv   rA   rk   r   r@   rC   r   r   rw   r   r   rx   r   rm   rB   )	rD   r9   r|   r}   Údesired_fanoutr~   r7   ro   rr   s	   `       @r*   Úset_noteÚNotesTree.set_note•  sõ   ù€ ô ×$Ò$ \Ó2ˆ	Ø×Ñ×%Ñ% iÔ0ô /¨t¯z©z¸4×;MÑ;MÓNˆØ˜T×/Ñ/Ó/Ø×!Ñ! .Ô1ô ˜Z¨×);Ñ);Ó<ˆØ—Z‘Z Ó%ˆ
ð3	 Üð3	 Ü$,¬U¡Oð3	 Ü?Gð3	 ä÷3	 ð 3	 ñj ˜tŸz™z¨:·|±|ÓDˆØ×Ñ×%Ñ% hÔ/ØˆŒ
Ø!×6Ñ6Ó8ˆÔØˆr0   c                 óv  ^ ^• T R                  U5      c  g[        UT R                  5      nUR                  S5      nS[        S[
        [           S[        S-  4UU 4S jjmT" T R                  U5      nUc
  [	        5       nT R                  R                  U5        UT l        T R                  5       T l        U$ )z«Remove a note for an object.

Args:
    object_sha: SHA of the object to remove notes from

Returns:
    New tree object with the note removed, or None if no note existed
Nr;   r   r7   r   c                 óô  >• [        U5      S:X  aj  [        5       nSnU R                  5        H/  u  pEnXAS   :w  a  Ub  Ub  Uc   eUR                  XEU5        M-  SnM1     U(       d  g[        U5      S:”  a  U$ S$ [        5       nSnU R                  5        HÄ  u  pEnUb  Ub  Uc   eXAS   :X  a™  [        R
                  " U5      (       a~  TR                  U   n[        U[        5      (       d   eT
" X�SS 5      n	U	bF  TR                  R                  U	5        UR                  U[        R                  U	R                  5        SnM²  UR                  XEU5        MÆ     U(       d  g[        U5      S:”  a  U$ S$ )zŽRemove note entry from tree.

Args:
    tree: Tree to remove from
    components: Path components

Returns:
    Updated tree or None if empty
r   Fr
   NT)rP   r   r   ri   r   r!   rA   r"   rk   rl   rm   )r   r7   ro   rp   r%   r&   r'   Úmodifiedr(   rq   Úremove_from_treerD   s             €€r*   rš   Ú/NotesTree.remove_note.<locals>.remove_from_treeù  sj  ø€ ô �:‹ !Ó#ä›6�Ø�Ø'+§z¡z¦|‘O�D Ø¨!™}Ó,Ø#Ñ/°DÑ4DÈÉÐXÐXØ Ÿ™ T°Ö5à $šñ (4ö Øô $' x£=°1Ó#4�xÐ>¸$Ð>ô  ›6�Ø �Ø'+§z¡z¦|‘O�D ØÑ+°Ñ0@ÀSÁ_ÐTÐTØ¨!™}Ó,´·²¸d×1CÑ1Cà"&×"4Ñ"4°SÑ"9˜Ü)¨'´4×8Ñ8Ð8Ð8Ù&6°wÈ1È2ÀÓ&O˜Ø&Ñ2Ø ×.Ñ.×9Ñ9¸+ÔFØ$ŸL™L¨¬t¯|©|¸[¿^¹^ÔLØ#'šà Ÿ™ T°Ö5ñ (4ö  Øô $' x£=°1Ó#4�xÐ>¸$Ð>r0   )rŒ   r   rC   rw   r   r   rx   r@   rA   rk   rB   )rD   r9   r~   r7   ro   rš   s   `    @r*   Úremove_noteÚNotesTree.remove_noteè  s´   ù€ ð ×Ñ˜jÓ)Ñ1Øô ˜Z¨×);Ñ);Ó<ˆØ—Z‘Z Ó%ˆ
ð0	?¤4ð 0	?´X¼e±_ð 0	?ÌÐPTÉ÷ 0	?ð 0	?ñd $ D§J¡J°
Ó;ˆØÑÜ“vˆHà×Ñ×%Ñ% hÔ/ØˆŒ
Ø!×6Ñ6Ó8ˆÔØˆr0   c           
   #   ó¬   ^ ^#   •  SS[         S[        S[        [        [        [        4      4U U4S jjjmT" T R
                  5       Sh  v•N   g N7f)zKList all notes in this tree.

Yields:
    Tuples of (object_sha, note_sha)
r   Úprefixr   c              3   óh  >#   • U R                  5        H—  u  p#nUb  Ub  Uc   e[        R                  " U5      (       a;  TR                  U   n[	        U[
        5      (       d   eT" XQU-   5       Sh  v•N   Mg  [        R                  " U5      (       d  M„  X-   n[        U5      U4v •  M™     g N;7f)z—Walk the notes tree recursively.

Args:
    tree: Tree to walk
    prefix: Path prefix for current level

Yields:
    Tuples of (object_sha, note_sha)
N)r   r   r!   rA   r"   r   r    r   )	r   rŸ   r%   r&   r'   r(   Úfull_hexrD   Ú	walk_trees	          €€r*   r¢   Ú'NotesTree.list_notes.<locals>.walk_tree;  s¡   øé € ð $(§:¡:¦<‘�˜CØÑ'¨DÑ,<ÀÁÐPÐPÜ—<’< ×%Ñ%Ø"×0Ñ0°Ñ5�GÜ% g¬t×4Ñ4Ð4Ð4Ù(¨¸4±-Ó@×@Ò@Ü—\’\ $×'Ó'à%™}�HÜ# HÓ-¨sÐ3Ô3ò $0ñ
 Aùs   ƒA1B2Á4B0Á5B2ÂB2N)r0   )r   rx   r   r6   r   r@   )rD   r¢   s   `@r*   rt   ÚNotesTree.list_notes4  sP   ùé € ð ),ñ	4Üð	4Ü %ð	4ä”eœH¤hÐ.Ñ/Ñ0÷	4ñ 	4ñ. ˜TŸZ™ZÓ(×(Ó(ùs   „AAÁAÁA)rC   rA   r@   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   rE   r.   rB   r   rx   r   r…   rŒ   r�   r•   rœ   r   r6   rt   Ú__static_attributes__rK   r0   r*   r   r   ‹   sø   † Ù&ð	9˜Tð 	9Ð1Bð 	9Àtô 	9ðE cô EðN]6°ð ]6¸ô ]6ð~ØðØ %ðØ-0ðØ7?ðà	ôð@¨ð °(¸T±/ô ð@ 5ð ¨U°T©\ô ð,Q 5ð Q¸ð QÀ$ô QðfJ eð J°°t±ô JðX)˜H U¨8°XÐ+=Ñ%>Ñ?÷ )r0   r   c                 ó<   • [        5       nU R                  U5        U$ )zuCreate an empty notes tree.

Args:
    object_store: Object store to add the tree to

Returns:
    Empty tree object
)r   rk   )r   r   s     r*   r   r   U  s   € ô ‹6€DØ×Ñ˜DÔ!Ø€Kr0   c                   óV  • \ rS rSrSr      SS jr  SS\S-  SSS\4S	 jjr  SS
\S\S-  SSS\S-  4S jjr	     SS
\S\S\S-  S\S-  S\S-  S\S-  SSS\4S jjr
     SS
\S\S-  S\S-  S\S-  S\S-  SSS\S-  4S jjr  SS\S-  SSS\\\\4      4S jjrSrg)r   ic  z.High-level interface for Git notes operations.r   Nc                 ó   • Xl         X l        g)z„Initialize Notes.

Args:
    object_store: Object store to read/write objects
    refs_container: Refs container to read/write refs
N©rA   Ú_refs)rD   r   Úrefs_containers      r*   rE   ÚNotes.__init__f  s   € ð *ÔØ#�
r0   Ú	notes_refÚconfigzStackedConfig | Nonec                 óZ   • Uc  Ub  UR                  SS5      nUc  [        n[        U5      $ )z¿Get the notes reference to use.

Args:
    notes_ref: The notes ref to use, or None to use the default
    config: Config to read notes.displayRef from

Returns:
    The notes reference name
)s   notess
   displayRef)Úgetr   r   )rD   r²   r³   s      r*   Úget_notes_refÚNotes.get_notes_refr  s5   € ð ÑØÑ!Ø"ŸJ™J {°MÓB�	ØÑ Ü-�	Ü�9‹~Ðr0   r9   c                 ó\  • U R                  X#5      n U R                  U   nU R                  U   n[	        U[
        5      (       a  U R                  UR                     nOUn[	        U[        5      (       d  g[        X`R                  5      nUR                  U5      $ ! [         a     gf = f)a
  Get the note for an object.

Args:
    object_sha: SHA of the object to get notes for
    notes_ref: The notes ref to use, or None to use the default
    config: Config to read notes.displayRef from

Returns:
    The note content as bytes, or None if no note exists
N)
r¶   r¯   r#   rA   r"   r   r   r   r   r�   )rD   r9   r²   r³   Únotes_commit_shaÚ	notes_objÚ
notes_treeÚnotes_tree_objs           r*   r�   ÚNotes.get_note‡  sª   € ð  ×&Ñ& yÓ9ˆ	ð	Ø#Ÿz™z¨)Ñ4Ðð
 ×&Ñ&Ð'7Ñ8ˆ	ô �i¤×(Ñ(Ø×+Ñ+¨I¯N©NÑ;‰Jð #ˆJä˜*¤d×+Ñ+Øä" :×/AÑ/AÓBˆØ×&Ñ& zÓ2Ð2øô# ó 	Ùð	ús   “B Â
B+Â*B+r|   ÚauthorÚ	committerÚmessagec                 óò  • SSK Jn  U R                  X75      n U R                  U   n	U R                  U	   n
[        U
[        5      (       a  U R                  U
R                     nOU
n[        U[        5      (       d  [        U R                  5      n[        X°R                  5      nUR                  X5      nUc
  Ub  U" USS9nUc  SnUc  UnUc  Sn[        5       nUR                  Ul        XNl        X^l        [!        ["        R"                  " 5       5      =Ul        Ul        S=Ul        Ul        SUl        Xnl         U R                  U   nU R                  U   n[        U[        5      (       a  U/Ul        U R                  R3                  U5        UR                  U R                  U'   UR                  $ ! [         a    [        U R                  5      n GNLf = f! [         a
    / Ul         Nyf = f)	aÈ  Set or update a note for an object.

Args:
    object_sha: SHA of the object to annotate
    note_content: Content of the note
    notes_ref: The notes ref to use, or None to use the default
    author: Author identity (defaults to committer)
    committer: Committer identity (defaults to config)
    message: Commit message for the notes update
    config: Config to read user identity and notes.displayRef from

Returns:
    SHA of the new notes commit
r   ©Úget_user_identityÚ	COMMITTER©Úkindó   Git User <user@example.com>s   Notes added by 'git notes add'r
   ó   UTF-8)ÚreporÃ   r¶   r¯   rA   r"   r   r   r   r   r#   r   r•   rm   r¾   r¿   r.   ÚtimeÚcommit_timeÚauthor_timeÚcommit_timezoneÚauthor_timezoneÚencodingrÀ   Úparentsrk   )rD   r9   r|   r²   r¾   r¿   rÀ   r³   rÃ   r¹   rº   r»   r¼   ro   ÚcommitÚ
parent_shaÚparents                    r*   r•   ÚNotes.set_note­  sÖ  € õ0 	,à×&Ñ& yÓ9ˆ	ð	?Ø#Ÿz™z¨)Ñ4ÐØ×*Ñ*Ð+;Ñ<ˆIô ˜)¤V×,Ñ,Ø!×/Ñ/°	·±Ñ?‘
ð '�
ä˜j¬$×/Ñ/Ü.¨t×/AÑ/AÓB�
ô
 # :×/AÑ/AÓBˆØ!×*Ñ*¨:ÓDˆð Ñ Ñ!3Ù)¨&°{ÑCˆIØÑØ6ˆIØ‰>ØˆFØ‰?Ø7ˆGä“ˆØ—k‘kˆŒØŒØ$ÔÜ25´d·i²i³kÓ2BÐBˆÔ˜VÔ/Ø:;Ð;ˆÔ Ô!7Ø"ˆŒØ Œð	 ØŸ™ IÑ.ˆJØ×'Ñ'¨
Ñ3ˆFÜ˜&¤&×)Ñ)Ø", �”ð 	×Ñ×%Ñ% fÔ-Ø &§	¡	ˆ�
‰
�9Ñà�y‰yÐøôM ó 	?Ü*¨4×+=Ñ+=Ó>‹Jð	?ûô@ ó 	 ØˆFŽNð	 ús$   ™A9F< Å;G" Æ<GÇGÇ"G6Ç5G6c                 óx  • SSK Jn  U R                  X&5      n U R                  U   nU R                  U   n	[        U	[        5      (       a  U R                  U	R                     n
OU	n
[        U
[        5      (       d  g [        X R                  5      nUR                  U5      nUc  gUc
  Ub  U" USS9nUc  SnUc  UnUc  Sn[        5       nUR                  Ul        X=l        XMl        [        [         R                   " 5       5      =Ul        Ul        S=Ul        Ul        S	Ul        X]l        U R                  U   nU R                  U   n[        U[        5      (       a  U/Ul        U R                  R1                  U5        UR                  U R                  U'   UR                  $ ! [         a     gf = f)
aÁ  Remove a note for an object.

Args:
    object_sha: SHA of the object to remove notes from
    notes_ref: The notes ref to use, or None to use the default
    author: Author identity (defaults to committer)
    committer: Committer identity (defaults to config)
    message: Commit message for the notes removal
    config: Config to read user identity and notes.displayRef from

Returns:
    SHA of the new notes commit, or None if no note existed
r   rÂ   NrÄ   rÅ   rÇ   s#   Notes removed by 'git notes remove'r
   rÈ   )rÉ   rÃ   r¶   r¯   rA   r"   r   r   r   r#   r   rœ   rm   r¾   r¿   r.   rÊ   rË   rÌ   rÍ   rÎ   rÏ   rÀ   rÐ   rk   )rD   r9   r²   r¾   r¿   rÀ   r³   rÃ   r¹   rº   r»   r¼   ro   rÑ   rÒ   rÓ   s                   r*   rœ   ÚNotes.remove_noteÿ  s­  € õ, 	,à×&Ñ& yÓ9ˆ	ð	Ø#Ÿz™z¨)Ñ4ÐØ×*Ñ*Ð+;Ñ<ˆIô ˜)¤V×,Ñ,Ø!×/Ñ/°	·±Ñ?‘
ð '�
ä˜j¬$×/Ñ/Øð 0ô # :×/AÑ/AÓBˆØ!×-Ñ-¨jÓ9ˆØÑØð Ñ Ñ!3Ù)¨&°{ÑCˆIØÑØ6ˆIØ‰>ØˆFØ‰?Ø<ˆGä“ˆØ—k‘kˆŒØŒØ$ÔÜ25´d·i²i³kÓ2BÐBˆÔ˜VÔ/Ø:;Ð;ˆÔ Ô!7Ø"ˆŒØ Œð —Z‘Z 	Ñ*ˆ
Ø×#Ñ# JÑ/ˆÜ�fœf×%Ñ%Ø(˜\ˆFŒNà×Ñ×%Ñ% fÔ-Ø &§	¡	ˆ�
‰
�9Ñà�y‰yÐøôK ó 	Ùð	ús   ™A$F, Æ,
F9Æ8F9c                 óþ  • U R                  X5      n U R                  U   nU R                  U   n[	        U[
        5      (       a  U R                  UR                     nOUn[	        U[        5      (       d  / $ [        XPR                  5      n/ nUR                  5        HG  u  p‰U R                  U	   n
[	        U
[        5      (       d  M+  UR                  XŠR                  45        MI     U$ ! [         a    / s $ f = f)zÒList all notes in a notes ref.

Args:
    notes_ref: The notes ref to use, or None to use the default
    config: Config to read notes.displayRef from

Returns:
    List of tuples of (object_sha, note_content)
)r¶   r¯   r#   rA   r"   r   r   r   r   rt   r   r5   ru   )rD   r²   r³   r¹   rº   r»   r¼   Úresultr9   rz   r{   s              r*   rt   ÚNotes.list_notesN  sð   € ð ×&Ñ& yÓ9ˆ	ð	Ø#Ÿz™z¨)Ñ4Ðð
 ×&Ñ&Ð'7Ñ8ˆ	ô �i¤×(Ñ(Ø×+Ñ+¨I¯N©NÑ;‰Jð #ˆJä˜*¤d×+Ñ+ØˆIä" :×/AÑ/AÓBˆØ/1ˆØ$2×$=Ñ$=Ö$?Ñ ˆJØ×)Ñ)¨(Ñ3ˆHÜ˜(¤D×)Ó)Ø—‘˜z¯=©=Ð9Ö:ñ %@ð ˆøô- ó 	ØŠIð	ús   “C- Ã-C<Ã;C<r®   )r   r   r°   r   r   N)NN)NNNNN)r¥   r¦   r§   r¨   r©   rE   rx   r   r¶   r�   r•   rœ   Úlistr6   r   rt   rª   rK   r0   r*   r   r   c  sÀ  † Ù8ð
$Ø-ð
$Ø?Nð
$à	ô
$ð #'Ø)-ñà˜4‘<ðð 'ðð 
õ	ð0 #'Ø)-ñ	$3àð$3ð ˜4‘<ð$3ð 'ð	$3ð
 
�‰õ$3ðT #'Ø#Ø"&Ø $Ø)-ñPàðPð ðPð ˜4‘<ð	Pð
 ˜‘ðPð ˜4‘<ðPð ˜‘ðPð 'ðPð 
õPðj #'Ø#Ø"&Ø $Ø)-ñMàðMð ˜4‘<ðMð ˜‘ð	Mð
 ˜4‘<ðMð ˜‘ðMð 'ðMð 
�‰õMðb #'Ø)-ñ'à˜4‘<ð'ð 'ð'ð 
ˆe�H˜e�OÑ$Ñ	%÷	'ð 'r0   r   r-   ) r©   Ú__all__r   rÊ   Úcollections.abcr   r   Útypingr   Úobjectsr   r   r   r   Úrefsr   r³   r   r   r   r   r   r   r.   r   rx   r6   r	   r   r   r   r   rK   r0   r*   Ú<module>rà      sË   ðñ, ò	€ó Û ß .Ý  ç 1Ó 1Ý æÝ%Ý-Ý#à!Ð Ø$ zÑ1Ð ð2 ð 2Ð4Eð 2È#ô 2ðj %ð °sð ¸uÀUÈCÀZÑ?Pô ñ(!˜eð !°3ð !¸uõ !÷G)ñ G)ðTÐ$5ð ¸$ô ÷Rò Rr0   