
    Zj                        S r SSKrSSKrSSKrSSKrSSKrSSKJrJrJ	r	J
r
JrJrJrJrJrJr  \(       a  SSKJr  SSKJr  SSKJrJrJrJrJrJr  SSKJrJr  \R>                  " S/ S	Q5      r S
r!Sr"Sr#Sr$S r%S r&S r'S r(S r)S r*S\4S jr+S r,SBS\S\\   S\\-   4S jjr. SBS\S\
\/\ 4   S\\-   SS4S jjr0S\-S\-4S jr1 " S S\25      r3S S!S"\\\/\/\-4      S\/4S# jr4S S!S$\3S\/4S% jr5 SCS&\\/   S'\	\//\\/\-4   4   S S!S(\\/   S\\\\\/   \\/   4   \\\-   \\-   4   \\\/   \\/   4   4      4
S) jjr6 SBS*\/S+\-S\\-   4S, jjr7 SDS. jr8S/r9S0 r:S1 r;\:4S2 jr<S-\:4S3 jr=SES4 jr>SES5 jr?S6 r@S7 rASBS$\34S8 jjrB\R                  R                  S95      rES:\/4S; jrFS< rGSBS= jrH SBS \S!   4S> jjrIS? rJSFS@ jrKSA rLg)Gz%Parser for the git index file format.    N)
AnyBinaryIOCallableDictListOptionalTYPE_CHECKINGIterableIteratorTuple)BaseObjectStore)GitFile)BlobS_IFGITLINKS_ISGITLINKTree
hex_to_sha
sha_to_hex)
SHA1Reader
SHA1Writer
IndexEntry)
ctimemtimedevinomodeuidgidsizeshaflagsi 0  i   i @     c                 Z     U R                  SS5      u  pX4$ ! [         a    SU 4s $ f = f)zSplit a /-delimited path into a directory part and a basename.

Args:
  path: The path to split.
Returns:
  Tuple with directory name and basename
   /       )rsplit
ValueError)pathdirnamebasenames       lib/third_party/dulwich/index.py	pathsplitr-   T   s@    #"kk$2 ""  T{s    **c                  `    SR                  U  Vs/ s H  o(       d  M  UPM     sn5      $ s  snf )zJoin a /-delimited path.r$   )join)argsps     r,   pathjoinr2   d   s%    99+Aa+,,+s   
++c                 N    [         R                  " SU R                  S5      5      $ )zkRead a cache time.

Args:
  f: File-like object to read from
Returns:
  Tuple with seconds and nanoseconds
>LL   )structunpackread)fs    r,   read_cache_timer:   i   s     ==q	**r&   c                 >   [        U[        5      (       a  US4nO][        U[        5      (       a(  [        US5      u  p#[        U5      [        US-  5      4nO [        U[        5      (       d  [        U5      eU R                  [        R                  " S/UQ76 5        g)z}Write a cache time.

Args:
  f: File-like object to write to
  t: Time to write (as int, float or tuple with secs and nsecs)
r   g      ?i ʚ;r4   N)	
isinstanceintfloatdivmodtuple	TypeErrorwriter6   pack)r9   tsecsnsecss       r,   write_cache_timerG   t   s}     !SF	Au		q#YEJ./05!!lGGFKK""#r&   c                    U R                  5       n[        U 5      n[        U 5      n[        R                  " SU R	                  S5      5      u  nnnnnn	n
nU R	                  US-  5      nU R                  5       U-
  S-   S-  nU R	                  X-   U R                  5       -
  5        UUUUUUUUU	[        U
5      US-  4$ )zRead an entry from a cache file.

Args:
  f: File-like object to read from
Returns:
  tuple with: device, inode, mode, uid, gid, size, sha, flags
z>LLLLLL20sH.   i  r5    )tellr:   r6   r7   r8   r   )r9   beginoffsetr   r   r   r   r   r   r   r   r    r!   name	real_sizes                 r,   read_cache_entryrP      s     &&(KAEAE 	mQVVN%;<	6656>#DK'!+r1IFFK#qvvx/03 r&   c                    U R                  5       nUu  p4pVpxppn[        X5        [        X5        [        U5      US-  -  nU R                  [        R
                  " SUS-  US-  UU	U
U[        U5      U5	      5        U R                  U5        U R                  5       U-
  S-   S-  nU R                  SX.-   U R                  5       -
  -  5        g)zWrite an index entry to a file.

Args:
  f: File object
  entry: Entry to write, tuple with:
    (name, ctime, mtime, dev, ino, mode, uid, gid, size, sha, flags)
rK   s   >LLLLLL20sHl    r5   rJ       N)rL   rG   lenrB   r6   rC   r   )r9   entryrM   rN   r   r   r   r   r   r   r   r   r    r!   rO   s                  r,   write_cache_entryrU      s     &&(KGLDT%c4eQQI)EGG**sO
	
 GGDMK'!+r1IGGEk-9:;r&   r9   c              #      #    U R                  S5      nUS:w  a  [        SU-  5      e[        R                  " SU R                  S5      5      u  p#US;   d   e[	        U5       H  n[        U 5      v   M     g7f)z4Read an index file, yielding the individual entries.      DIRCzInvalid index file header: %r   >LLr5   )r%   r"   N)r8   AssertionErrorr6   r7   rangerP   )r9   headerversionnum_entriesis        r,   
read_indexr`      sn     VVAYF<vEFF#]]6166%=AWf;q!!  s   A6A8c                 N    0 n[        U 5       H  n[        USS 6 XS   '   M     U$ )zWRead an index file and return it as a dictionary.

Args:
  f: File object to read from
r%   Nr   )r`   r   )r9   retxs      r,   read_index_dictrd      s2     C]!"&aD	 Jr&   entriesr]   c           	          Uc  [         nU R                  S5        U R                  [        R                  " SU[	        U5      5      5        U H  n[        X5        M     g)zWrite an index file.

Args:
  f: File-like object to write to
  version: Version number to write
  entries: Iterable over the entries to write
NrX   rY   )DEFAULT_VERSIONrB   r6   rC   rS   rU   )r9   re   r]   rc   s       r,   write_indexrh      sI     !GGGGGFKKW67! r&   returnc                     / n[        U5       H#  nUR                  U4[        X   5      -   5        M%     [        XUS9  g)z:Write an index file based on the contents of a dictionary.r]   N)sortedappendr@   rh   )r9   re   r]   entries_listrN   s        r,   write_index_dictro      s=     LwTGeGM&::;  1r&   r   c                 "   [         R                  " U 5      (       a  [         R                  $ [         R                  " U 5      (       a  [         R                  $ [        U 5      (       a  [        $ [         R                  S-  nU S-  (       a  US-  nU$ )zCleanup a mode value.

This will return a mode that can be stored in a tree object.

Args:
  mode: Mode to clean up.
Returns:
  mode
i  @   I   )statS_ISLNKS_IFLNKS_ISDIRS_IFDIRr   r   S_IFREG)r   rb   s     r,   cleanup_modery      sj     ||D||	d		||	T		
,,
Ce|uJr&   c                       \ rS rSrSrS r\S 5       rS rSS jr	S	 r
S\4S
 jrS\S\4S jrS\\   4S jrS\S\4S jrS\S\4S jrS\\\\\4      4S jrS rS rS rS rS rS rS rSS jrS rSr g)Indexi  zA Git Index file.c                 ^    Xl         SU l        U R                  5         U R                  5         g)z>Open an index file.

Args:
  filename: Path to the index file
N)	_filename_versionclearr8   )selffilenames     r,   __init__Index.__init__  s"     "

		r&   c                     U R                   $ N)r}   r   s    r,   r)   
Index.path$  s    ~~r&   c                 R    U R                   R                  < SU R                  < S3$ )N())	__class____name__r}   r   s    r,   __repr__Index.__repr__(  s    >>22DNNCCr&   ri   Nc                     [        U R                  S5      n [        U5      n[        XR                  U R
                  S9  UR                  5         g! UR                  5         f = f)z(Write current contents of index to disk.wbrk   N)r   r}   r   ro   _bynamer~   close)r   r9   s     r,   rB   Index.write+  sE    DNND)	1AQdmmDGGIAGGIs   )A A$c                    [         R                  R                  U R                  5      (       d  g[	        U R                  S5      n [        U5      n[        U5       H  n[        USS 6 XS   '   M     UR                  [         R                  R                  U R                  5      UR                  5       -
  S-
  5        UR                  5         UR                  5         g! UR                  5         f = f)z)Read current contents of index from disk.Nrbr%   r      )osr)   existsr}   r   r   r`   r   r8   getsizerL   	check_shar   )r   r9   rc   s      r,   r8   
Index.read4  s    ww~~dnn--DNND)	1A]'12/qT
 # FF277??4>>2QVVX=BCKKMGGIAGGIs   B	C! !C3c                 ,    [        U R                  5      $ )z%Number of entries in this index file.)rS   r   r   s    r,   __len__Index.__len__C  s    4<<  r&   rN   c                      U R                   U   $ )zuRetrieve entry by relative path.

Returns: tuple with (ctime, mtime, dev, ino, mode, uid, gid, size, sha,
    flags)
r   r   rN   s     r,   __getitem__Index.__getitem__G  s     ||D!!r&   c                 ,    [        U R                  5      $ )z%Iterate over the paths in this index.)iterr   r   s    r,   __iter__Index.__iter__O  s    DLL!!r&   r)   c                     X   R                   $ )z6Return the (git object) SHA1 for the object at a path.)r    r   r)   s     r,   get_sha1Index.get_sha1S  s    z~~r&   c                     X   R                   $ )z4Return the POSIX file mode for the object at a path.r   r   s     r,   get_modeIndex.get_modeW  s    zr&   c              #   l   #    U  H*  nX   nXR                   [        UR                  5      4v   M,     g7f)z=Iterate over path, sha, mode tuples for use with commit_tree.Nr    ry   r   )r   r)   rT   s      r,   iterobjectsIndex.iterobjects[  s.     DJE		<

#;;; s   24c                 V    SS K nUR                  S[        5        U R                  5       $ )Nr   zUse iterobjects() instead.)warningswarnPendingDeprecationWarningr   )r   r   s     r,   	iterblobsIndex.iterblobsa  s$    24MN!!r&   c                     0 U l         g)z$Remove all contents from this index.Nr   r   s    r,   r   Index.clearg  s	    r&   c                 ~    [        U[        5      (       d   e[        U5      S:X  d   e[        U6 U R                  U'   g )N
   )r<   bytesrS   r   r   )r   rN   rc   s      r,   __setitem__Index.__setitem__k  s7    $&&&&1v||'^Tr&   c                 L    [        U[        5      (       d   eU R                  U	 g r   )r<   r   r   r   s     r,   __delitem__Index.__delitem__q  s!    $&&&&LLr&   c                 6    U R                   R                  5       $ r   r   itemsr   s    r,   	iteritemsIndex.iteritemsu      ||!!##r&   c                 6    U R                   R                  5       $ r   r   r   s    r,   r   Index.itemsx  r   r&   c                 >    UR                  5        H	  u  p#X0U'   M     g r   )r   )r   re   rN   values       r,   updateIndex.update{  s    "==?KDJ +r&   c              #      ^ #    U 4S jn[        T R                  R                  5       UUUUS9 H  u  pVnXVU4v   M     g7f)aG  Find the differences between the contents of this index and a tree.

Args:
  object_store: Object store to use for retrieving tree contents
  tree: SHA1 of the root tree
  want_unchanged: Whether unchanged files should be reported
Returns: Iterator over tuples with (oldpath, newpath), (oldmode,
    newmode), (oldsha, newsha)
c                 P   > TU    nUR                   [        UR                  5      4$ r   r   )r)   rT   r   s     r,   lookup_entry-Index.changes_from_tree.<locals>.lookup_entry  s$    JE99l5::666r&   )want_unchangedN)changes_from_treer   keys)r   object_storetreer   r   rN   r   r    s   `       r,   r   Index.changes_from_tree  sJ     	7 "3LL)"
T s##"
s   =A c                 4    [        XR                  5       5      $ )zrCreate a new tree from an index.

Args:
  object_store: Object store to save the tree in
Returns:
  Root tree SHA
commit_treer   )r   r   s     r,   commitIndex.commit  s     <)9)9);<<r&   )r   r}   r~   )ri   NF)!r   
__module____qualname____firstlineno____doc__r   propertyr)   r   rB   r8   r=   r   r   r   r   r   r   r   r   r
   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__ r&   r,   r{   r{     s    
  D! !" "* ""(5/ "U u U s <XeE5#,=&>? <",$$$0=r&   r{   r   r   blobsc                    ^ ^^	^
 S0 0m
UU
4S jmU H   u  p#n[        U5      u  pVT" U5      nXC4Xv'   M"     U	U U
4S jm	T	" S5      $ )zCommit a new tree.

Args:
  object_store: Object store to add trees to
  blobs: Iterable over blob path, sha, mode entries
Returns:
  SHA1 of the created tree.
r&   c                    > U T;   a  TU    $ [        U 5      u  pT" U5      n[        U[        5      (       d   e0 nXCU'   UTU '   U$ r   )r-   r<   r   )r)   r*   r+   rD   newtreeadd_treetreess        r,   r   commit_tree.<locals>.add_tree  sW    5=;%dOW(E****(dr&   c                 $  > [        5       nTU    R                  5        HR  u  p#[        U[        5      (       a"  [        R
                  nT" [        X5      5      nOUu  pEUR                  X$U5        MT     TR                  U5        UR                  $ r   )
r   r   r<   dictrs   rw   r2   add
add_objectid)	r)   r   r+   rT   r   r    
build_treer   r   s	         r,   r   commit_tree.<locals>.build_tree  sv    v$T{002OH%&&|| $!9:#HHXS)  3 	%wwr&   )r-   )r   r   r)   r    r   	tree_pathr+   r   r   r   r   s   `       @@@r,   r   r     sS     "IE	 !4'o		" !

 c?r&   indexc                 4    [        XR                  5       5      $ )zCreate a new tree from an index.

Args:
  object_store: Object store to save the tree in
  index: Index file
Note: This function is deprecated, use index.commit() instead.
Returns: Root tree sha.
r   )r   r   s     r,   commit_indexr     s     |%6%6%899r&   namesr   r   c              #   p  #    [        U 5      nUbT  UR                  U5       H?  u  pgn U" U5      u  pUR                  U5        U(       d
  X:w  d  X:w  a  Xf4Xz4X44v   M?  MA     U H  n U" U5      u  pSU4SU
4SU	44v   M     g! [         a    US4US4US44v    M  f = f! [         a     MK  f = f7f)a  Find the differences between the contents of a tree and
a working copy.

Args:
  names: Iterable of names in the working copy
  lookup_entry: Function to lookup an entry in the working copy
  object_store: Object store to use for retrieving tree contents
  tree: SHA1 of the root tree, or None for an empty tree
  want_unchanged: Whether unchanged files should be reported
Returns: Iterator over tuples with (oldpath, newpath), (oldmode, newmode),
    (oldsha, newsha)
N)setiter_tree_contentsremoveKeyError)r   r   r   r   r   other_namesrN   r   r    	other_sha
other_modes              r,   r   r     s     4 e*K!-!@!@!FTO*6t*<'
 ""4(!Y%59K <$);c=MNN :L "G 	H&24&8#Y $<$
!3dI5FGG   @d|dD\C;??@  		sK   &B6
B7B6+
B%5B6B"B6!B""B6%
B3/B62B33B6hex_shar!   c                     Uc  [        U R                  5      n[        U R                  U R                  U R
                  U R                  UU R                  U R                  U R                  UU5
      $ )zCreate a new index entry from a stat value.

Args:
  stat_val: POSIX stat_result instance
  hex_sha: Hex sha of the object
  flags: Index flags
)
ry   st_moder   st_ctimest_mtimest_devst_inost_uidst_gidst_size)stat_valr  r!   r   s       r,   index_entry_from_statr    sf     |H,,- r&   Tc                     [         R                  " U5      nU R                  5       n[        R
                  " U5      (       aj  U(       a  [         R                  " U5        [        R                  S:X  a"  UR                  U5      nUR                  U5      n[         R                  " Xb5        OUbN  UR                  [        U5      :X  a5  [        US5       nUR                  5       U:X  a  UsSSS5        $  SSS5        [        US5       nUR                  U5        SSS5        U(       a  [         R                   " X!5        [         R                  " U5      $ ! [         a    Sn GNNf = f! , (       d  f       Nz= f! , (       d  f       Ne= f)a3  Build a file or symlink on disk based on a Git object.

Args:
  obj: The git object
  mode: File mode
  target_path: Path to write to
  honor_filemode: An optional flag to honor core.filemode setting in
    config file, default is core.filemode=True, change executable bit
Returns: stat object for the file
Nwin32r   r   )r   lstatFileNotFoundErroras_raw_stringrs   rt   unlinksysplatformdecodesymlinkr  rS   openr8   rB   chmod)blobr   target_pathhonor_filemodetree_encodingoldstatcontentsr9   s           r,   build_file_from_blobr   '  s"   ((;' !!#H||DIIk"<<7"}5H%,,];K


8)7??c(m#Ck4(A668x'" )(' ) +t$GGH % HH['88K  3   )( %$s)   E E*
E;E'&E'*
E8;
F	)   .git   .s   ..r&   c                 0    U R                  5       [        ;  $ r   )lowerINVALID_DOTNAMES)elements    r,   validate_path_element_defaultr'  U  s    ==?"222r&   c                 f    U R                  S5      R                  5       nU[        ;   a  gUS:X  a  gg)Ns   . Fs   git~1T)rstripr$  r%  )r&  strippeds     r,   validate_path_element_ntfsr+  Y  s3    ~~e$**,H##8r&   c                 V    U R                  S5      nU H  nU" U5      (       a  M    g   g)z2Default path validator that just checks for .git/.r$   FT)split)r)   element_validatorpartsr1   s       r,   validate_pathr0  b  s-    JJtE ##  r&   c                    [        U5      n[        U [        5      (       d  [        R                  " U 5      n UR                  U5       GH  n[        UR                  U5      (       d  M!  [        XR                  5      n[        R                  R                  [        R                  R                  U5      5      (       d3  [        R                  " [        R                  R                  U5      5        [        UR                  5      (       aQ  [        R                  R                  U5      (       d  [        R                  " U5        [        R                   " U5      n	O"X'R"                     n
[%        XR                  XS9n	U(       a  [        UR                  5      (       a  UR                  U	R&                  U	R(                  U	R*                  U	R,                  U	R.                  U	R0                  U	R2                  U	R4                  U	R6                  4
nU	R9                  U5      n	[;        XR"                  S5      XgR                  '   GM     UR=                  5         g)ai  Generate and materialize index from a tree

Args:
  tree_id: Tree to materialize
  root_path: Target dir for materialized index files
  index_path: Target path for generated index
  object_store: Non-empty object store holding tree contents
  honor_filemode: An optional flag to honor core.filemode setting in
    config file, default is core.filemode=True, change executable bit
  validate_path_element: Function to validate path elements to check
    out; default just refuses .git and .. directories.

Note: existing index is wiped and contents are not merged
    in a working dir. Suitable only for fresh clones.
)r  r   N)r{   r<   r   r   fsencoder   r0  r)   _tree_to_fs_pathr   r*   makedirsr   r   isdirmkdirr  r    r   r  r  st_nlinkr	  r
  r  st_atimer  r  r   r  rB   )	root_path
index_pathr   tree_idr  validate_path_elementr   rT   	full_pathstobjst_tuples               r,   build_index_from_treerA  l  s   0 *Ei''KK	*	009UZZ)>??$Y

;	ww~~bggooi899KK	23 uzz""77==++#)$B yy)C%ZZB
 UZZ!8!8
 

								

H h'B1"iiCjjM :P 
KKMr&   c                    [        U [        5      (       d   e[        5       n[        R                  " U5      (       at  [
        R                  S:X  aB  [        R                  " U 5      n [        R                  " U 5      R                  U5      Ul        U$ [        R                  " U 5      Ul         U$ [        U S5       nUR                  5       Ul        SSS5        U$ ! , (       d  f       U$ = f)Create a blob from a path and a stat object.

Args:
  fs_path: Full file system path to file
  st: A stat object
Returns: A `Blob` object
r  r   N)r<   r   r   rs   rt   r  r  r   fsdecodereadlinkencodedatar  r8   )fs_pathr   r  r  r9   s        r,   blob_from_path_and_moderI    s     gu%%%%6D||D<<7"kk'*GG,33MBDI K	 G,DI K '4 ADI !K ! Ks   =C
C,c                 .    [        XR                  U5      $ )rC  )rI  r  )rH  r>  r  s      r,   blob_from_path_and_statrK    s     #7JJFFr&   c                     SSK Jn  SSKJn  [	        U [
        5      (       d  [        R                  " U 5      n  U" U 5      n UR                  5       $ ! U a     gf = f! [         a     gf = f)zRead the head commit of a submodule.

Args:
  path: path to the submodule
Returns: HEAD sha, None if not a valid head/repository
r   )NotGitRepository)RepoN)
dulwich.errorsrM  dulwich.reporN  r<   strr   rD  headr   )r)   rM  rN  repos       r,   read_submodule_headrT    sm     0! dC  {{4 Dzyy{    s#   A A AA
A+*A+c                     [         R                  R                  [         R                  R                  U S5      5      (       a  [	        U 5      nUR
                  U:w  a  g gg)a  Check if a directory has changed after getting an error.

When handling an error trying to create a blob from a path, call this
function. It will check if the path is a directory. If it's a directory
and a submodule, check the submodule head to see if it's has changed. If
not, consider the file as changed as Git tracked a file and not a
directory.

Return true if the given path should be considered as changed and False
otherwise or if the path is not a directory.
r!  TF)r   r)   r   r/   rT  r    )r   rT   rR  s      r,   _has_directory_changedrV    sN     
ww~~bggll9g677"9-99   r&   c              #   |  #    [        U[        5      (       d  [        R                  " U5      nU R	                  5        H  u  p4[        X5      n [        R                  " U5      n[        R                  " UR                  5      (       a  [        X45      (       a  Uv   Mb  [        R                  " UR                  5      (       d'  [        R                  " UR                  5      (       d  M  [        XV5      nUb  U" Xs5      nUR                  UR                  :w  a  Uv   M  M     g! [          a    Uv    M  f = f7f)zWalk through an index and check for differences against working tree.

Args:
  index: index to check
  root_path: path in which to find files
Returns: iterator over paths with unstaged changes
N)r<   r   r   r2  r   r3  r  rs   rv   r  rV  S_ISREGrt   rK  r   r    r  )r   r9  filter_blob_callbackr   rT   r=  r>  r  s           r,   get_unstaged_changesrZ    s      i''KK	*	!OO-	$Y:		 )$B||BJJ''));;#O<<

++DLL4L4L*99D#/+D< ww%))# $+ .  ! 	 O	sD   AD<AD'D< A
D'*D<,D'%D<'D95D<8D99D<asciir   c                     [        U[        5      (       d   e[        S:w  a  UR                  S[        5      nOUn[        R
                  R                  X5      $ )zConvert a git tree path to a file system path.

Args:
  root_path: Root filesystem path
  tree_path: Git tree path as bytes

Returns: File system path.
r$   )r<   r   os_sep_bytesreplacer   r)   r/   )r9  r   sep_corrected_paths      r,   r3  r3  .  sK     i''''t&..t\B&77<<	66r&   c                     [        U [        5      (       d  [        R                  " U 5      nOU n[        S:w  a  UR                  [        S5      nU$ UnU$ )zuConvert a file system path to a git tree path.

Args:
  fs_path: File system path.

Returns:  Git tree path as bytes
r$   )r<   r   r   r2  r]  r^  )rH  fs_path_bytesr   s      r,   _fs_to_tree_pathrb  ?  sS     gu%%G,t!)),=	  "	r&   c                 h   [        U [        5      (       d   e[        R                  " U 5      n[        R
                  " UR                  5      (       aa  [        R                  R                  [        R                  R                  U S5      5      (       a  [        U 5      nUc  g[        X#S[        S9$ g[        R                  " UR                  5      (       d%  [        R                  " UR                  5      (       a5  [        X5      nUb  UR!                  U5        [        X$R"                  S5      $ g)aC  Create an index from a filesystem path.

This returns an index value for files, symlinks
and tree references. for directories and
non-existant files it returns None

Args:
  path: Path to create an index entry for
  object_store: Optional object store to
    save new blobs in
Returns: An index entry; None for directories
r!  Nr   r   )r<   r   r   r  rs   rv   r  r)   r   r/   rT  r  r   rX  rt   rK  r   r   )r)   r   r>  rR  r  s        r,   index_entry_from_pathrd  R  s     dE""""	$B||BJJ77>>"'',,tW566&t,D|(1;GG||BJJ4<<

#;#;&t0###D)$R!44r&   c              #      #    U  H  n[        X5      n [        XBS9nX54v   M     g! [        [        4 a    Sn Nf = f7f)zIterate over current versions of index entries on disk.

Args:
  paths: Paths to iterate over
  root_path: Root path to access from
  store: Optional store to save new blobs in
Returns: Iterator over path, index_entry
r   N)r3  rd  r  IsADirectoryError)pathsr9  r   r)   r1   rT   s         r,   iter_fresh_entriesri  r  sO      Y-	)!GE k  "#45 	E	s   ?	'
?<?<?c              #      #    SSK nUR                  [        S5        [        XSS9 H  nUS   c  XS   	 M  Uv   M     g7f)a2  Iterate over versions of blobs on disk referenced by index.

Don't use this function; it removes missing entries from index.

Args:
  index: Index file
  root_path: Root path to access from
  include_deleted: Include deleted entries with sha and
    mode set to None
Returns: Iterator over path, sha, mode
r   NzUse iter_fresh_objects instead.T)include_deletedr%   )r   r   r   iter_fresh_objects)r   r9  r   rT   s       r,   iter_fresh_blobsrm    sD      MM+-NO#EdK8AhK	 Ls   >A c              #      #    [        XUS9 HE  u  pEUc  U(       a	  USS4v   M  M  [        U6 nXER                  [        UR                  5      4v   MG     g7f)a  Iterate over versions of objecs on disk referenced by index.

Args:
  root_path: Root path to access from
  include_deleted: Include deleted entries with sha and
    mode set to None
  object_store: Optional object store to report new items to
Returns: Iterator over path, sha, mode
rf  N)ri  r   r    ry   r   )rh  r9  rk  r   r)   rT   s         r,   rl  rl    sY      *%V=D$&&  &E		<

#;;; Ws   AAc                 4    [        X5       H	  u  p#X U'   M     g)zRefresh the contents of an index.

This is the equivalent to running 'git commit -a'.

Args:
  index: Index to update
  root_path: Root filesystem path
N)ri  )r   r9  r)   rT   s       r,   refresh_indexrp    s     *%;d <r&   r   r   )Tutf-8)rq  )FN)Mr   collectionsr   rs   r6   r  typingr   r   r   r   r   r   r	   r
   r   r   dulwich.object_storer   dulwich.filer   dulwich.objectsr   r   r   r   r   r   dulwich.packr   r   
namedtupler   FLAG_STAGEMASK
FLAG_VALIDFLAG_EXTENDEDrg   r-   r2   r:   rG   rP   rU   r`   rd   r=   rh   r   ro   ry   objectr{   r   r   r   r  r   r%  r'  r+  r0  rA  rI  rK  rT  rV  rZ  seprF  r]  r3  rb  rd  ri  rm  rl  rp  r   r&   r,   <module>r~     s  * ,  	   
   4    ##
" 
 # -
+$"%P<>"( "	 8  d3i  (3-  & "	2	2%#$	2 c]	2 
		2s s ,J=F J=Z)#),4U5%;L5M,N)
)X	:0 	: 	:5 	:" /HE?/HE7E%*$556/H $/H 5/	/H 	huox./hsmXc]*+huox./	1/Hf AE%(088 AH(!V / 3 +H  7DN.G02"  " J vv}}W%75 7"&B CG$,->$?(,<&
r&   