
    =                        S r SSKJ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  \
(       a  SSKJrJr  SSKJr  SSKJrJrJrJrJrJrJr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&J'r'J(r(J)r)J*r*J+r+J,r,  SSK-J.r.  SSK/J0r0J1r1J2r2J3r3J4r4  SSK5J6r6  SSK7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArA  SSKBrBSrCSrDSrESrFSrGSrHSrISrJSrKS/\E/\E\F/\E\G/S/S//rLSrM " S S\N5      rOS\	\P\P4   4S jrQS4S S!S"\\P   S\R4S# jjrSS$ rTS%\\R   S\\R\\R   4   4S& jrUS%\\R\\R   4   S\R4S' jrVS( rW " S) S*\X5      rY " S+ S,\X5      rZS- r[ " S. S/\N5      r\ " S0 S1\Z5      r] " S2 S3\Z5      r^g)5zRepository access.

This module contains the base class for git repositories
(BaseRepo) and an implementation which uses a repository on
local disk (Repo).

    )BytesION)OptionalTupleTYPE_CHECKINGListDictUnionIterable)StackedConfig
ConfigFileIndex)	NoIndexPresentNotBlobErrorNotCommitErrorNotGitRepositoryNotTreeErrorNotTagErrorCommitErrorRefFormatError	HookError)GitFile)DiskObjectStoreMemoryObjectStoreBaseObjectStoreObjectStoreGraphWalker)check_hexshavalid_hexshaBlobCommitShaFileTagTree)pack_objects_to_data)HookPreCommitShellHookPostCommitShellHookCommitMsgShellHookPostReceiveShellHook)BlobNormalizer)
ANNOTATED_TAG_SUFFIXcheck_ref_formatRefsContainerDictRefsContainerInfoRefsContainerDiskRefsContainerread_packed_refsread_packed_refs_with_peeledwrite_packed_refsSYMREFz.gitobjectsrefstagsheadsindex	commondirgitdir	worktreesbrancheshooksinfos   refs/heads/masterc                       \ rS rSrSrS rSrg)InvalidUserIdentity   z1User identity is not of the format 'user <email>'c                     Xl         g Nidentity)selfrF   s     lib/third_party/dulwich/repo.py__init__InvalidUserIdentity.__init__   s         rE   N__name__
__module____qualname____firstlineno____doc__rI   __static_attributes__ rK   rH   rA   rA      s
    ;!rK   rA   returnc                  ~   SS K n SS KnU R                  5       n SS Kn UR	                  U5      R
                  nUR                  S5      S   nU(       d  Un[        R                  R                  S5      nUc  SR                  X!R                  5       5      nXV4$ ! [         a    S n N[f = f! [         a    S n Nmf = f)Nr   ,EMAILz{}@{})getpasssocketgetuserpwdgetpwnampw_gecossplitKeyErrorImportErrorosenvirongetformatgethostname)rX   rY   usernamer[   gecosfullnameemails          rH   _get_default_identityrj      s     H
+	+LL*33E {{3'*HJJNN7#E}x););)=>  	H	  s"   B- B B*)B*-B<;B<configr   kindc                 |   SnSnU(       ar  [         R                  R                  SU-   S-   5      nUb  UR                  S5      n[         R                  R                  SU-   S-   5      nUb  UR                  S5      nUc   U R                  SS5      nUc   U R                  SS5      n[        5       u  pgUc  UR                  S5      nUc  UR                  S5      nUR                  S	5      (       a  UR                  S
5      (       a  USS nUS-   U-   S
-   $ ! [         a    Sn Nf = f! [         a    Sn Nf = f)a)  Determine the identity to use for new commits.

If kind is set, this first checks
GIT_${KIND}_NAME and GIT_${KIND}_EMAIL.

If those variables are not set, then it will fall back
to reading the user.name and user.email settings from
the specified configuration.

If that also fails, then it will fall back to using
the current users' identity as obtained from the host
system (e.g. the gecos field, $EMAIL, $USER@$(hostname -f).

Args:
  kind: Optional kind to return identity for,
    usually either "AUTHOR" or "COMMITTER".

Returns:
  A user identity
NGIT__NAMEutf-8_EMAIL)usernameri      <   >       <)ra   rb   rc   encoder_   rj   
startswithendswith)rk   rl   rr   ri   user_ucemail_ucdefault_userdefault_emails           rH   get_user_identityr      sE   * DE**..$!89>>'*D::>>&4-(":;OOG,E|	::i0D }	JJy'2E #8"9L|""7+}$$W-%.."6"6a%<%$&&  	D	
  	E	s$   D D, D)(D),D;:D;c                      U R                  SS5      u  pSU;  a  [        U 5      eg! [         a    [        U 5      ef = f)zVerify that a user identity is formatted correctly.

Args:
  identity: User identity bytestring
Raises:
  InvalidUserIdentity: Raised when identity is invalid
rx   rv   ru   N)r^   
ValueErrorrA   )rF   fstsnds      rH   check_user_identityr      sN    ,>>%+ 3!(++   ,!(++,s   ( >graftpointsc                     0 nU  H\  nUR                  SS5      nUS   n[        U5      S:X  a  US   R                  5       nO/ nU/U-    H  n[        US5        M     XQU'   M^     U$ )a  Convert a list of graftpoints into a dict

Args:
  graftpoints: Iterator of graftpoint lines

Each line is formatted as:
    <commit sha1> <parent sha1> [<parent sha1>]*

Resulting dictionary is:
    <commit sha1>: [<parent sha1>*]

https://git.wiki.kernel.org/index.php/GraftPoint
Nrv   r      Invalid graftpoint)r^   lenr   )r   graftsline	raw_graftcommitparentsshas          rH   parse_graftpointsr      s{      FJJtQ'	1y>Ql((*GG8g%C23 & !v  MrK   c                     / nU R                  5        HE  u  p#U(       a(  UR                  US-   SR                  U5      -   5        M4  UR                  U5        MG     SR                  U5      $ )zConvert a dictionary of grafts into string

The graft dictionary is:
    <commit sha1>: [<parent sha1>*]

Each line is formatted as:
    <commit sha1> <parent sha1> [<parent sha1>]*

https://git.wiki.kernel.org/index.php/GraftPoint

       
)itemsappendjoin)r   graft_linesr   r   s       rH   serialize_graftpointsr     s`     K&,,.v}tyy/AABv&	 /
 ::k""rK   c                    [         R                  S:X  ax  SSKnSSKJnJnJn  SnUR                  X$U5      " SUR                  R                  45      n[        U [        5      (       a  [        R                  " U 5      n U" X5      (       d  ggg)zMark path as to be hidden if supported by platform and filesystem.

On win32 uses SetFileAttributesW api:
<https://docs.microsoft.com/windows/desktop/api/fileapi/nf-fileapi-setfileattributesw>
win32r   N)BOOLDWORDLPCWSTRr   SetFileAttributesW)sysplatformctypesctypes.wintypesr   r   r   WINFUNCTYPEwindllkernel32
isinstancebytesra   fsdecode)pathr   r   r   r   FILE_ATTRIBUTE_HIDDENr   s          rH   _set_filesystem_hiddenr     s~     ||w88 !#//uE!6==#9#9:
 dE"";;t$D!$>> ? rK   c                   ,    \ rS rSr0 / 4S jrSS jrSrg)ParentsProvideri-  c                 <    Xl         X l        [        U5      U l        g rD   )storer   setshallows)rG   r   r   r   s       rH   rI   ParentsProvider.__init__.  s    
HrK   Nc                      U R                   U   $ ! [         a     Of = fXR                  ;   a  / $ Uc  U R                  U   nUR                  $ rD   )r   r_   r   r   r   )rG   	commit_idr   s      rH   get_parentsParentsProvider.get_parents3  sT    	;;y)) 		%I>ZZ	*F~~s    
)r   r   r   rD   )rM   rN   rO   rP   rI   r   rR   rS   rK   rH   r   r   -  s    %'" &
	rK   r   c                      \ rS rSrSrS\S\4S jrS\4S jr	S\SS	4S
 jr
S rS rS rS rS5S jr  S6S jr  S6S jrS6S jrS7S jrS\\\4   4S jrS\4S jrS rS\S\4S jrS rS7S\S\S\\   4S jjrS rS r S r!S8S  jr"S! r#S" r$S# r%S7S$ jr&S% r'S&\S\4S' jr(S&\S(\)\\4   4S) jr*S&\4S* jr+S7S+SS,\,S\4S- jjr-S.\\\\   4   4S/ jr./ 4S0\\   SS	4S1 jjr/S2 r0            S9S3 jr1S4r2g	):BaseRepoi?  zBase class for a git repository.

:ivar object_store: Dictionary-like object for accessing
    the objects
:ivar refs: Dictionary-like object with the refs in this
    repository
object_storer6   c                 8    Xl         X l        0 U l        0 U l        g)zOpen a repository.

This shouldn't be called directly, but rather through one of the
base classes, such as MemoryRepo or Repo.

Args:
  object_store: Object store to use
  refs: Refs container to use
N)r   r6   _graftpointsr>   )rG   r   r6   s      rH   rI   BaseRepo.__init__H  s     )	
rK   rT   c                 ,    [        U R                  5      e)Probe the file-system to determine whether permissions can be trusted.

Returns: True if permissions can be trusted, False otherwise.
)NotImplementedError_determine_file_moderG   s    rH   r   BaseRepo._determine_file_modeX  s    
 "$";";<<rK   bareNc                    SSK Jn  U R                  SS5        [        5       nU" 5       nUR	                  SSS5        U R                  5       (       a  UR	                  SSS	5        OUR	                  SSS
5        UR	                  SSU5        UR	                  SSS	5        UR                  U5        U R                  SUR                  5       5        U R                  [        R                  R                  SS5      S5        g)z(Initialize a default set of named files.r   r   descriptions   Unnamed repositorycorerepositoryformatversion0filemodeTFr   logallrefupdatesrk   r?   excluderK   N)dulwich.configr   _put_named_filer   r   r   write_to_filegetvaluera   r   r   )rG   r   r   fcfs        rH   _init_filesBaseRepo._init_files_  s    -],ABI\
v0#6$$&&FF6:t,FF6:u-
vvt$
v)40
Xqzz|4RWW\\&)<cBrK   c                 ,    [        U R                  5      e)al  Get a file from the control dir with a specific name.

Although the filename should be interpreted as a filename relative to
the control dir in a disk-based Repo, the object returned need not be
pointing to a file in that location.

Args:
  path: The path to the file, relative to the control dir.
Returns: An open file object, or None if the file does not exist.
)r   get_named_filerG   r   s     rH   r   BaseRepo.get_named_filer  s     "$"5"566rK   c                 ,    [        U R                  5      e)Write a file to the control dir with the given name and contents.

Args:
  path: The path to the file, relative to the control dir.
  contents: A string to write to the file.
)r   r   rG   r   contentss      rH   r   BaseRepo._put_named_file  s     "$"6"677rK   c                 ,    [        U R                  5      e)z:Delete a file in the contrl directory with the given name.)r   _del_named_filer   s     rH   r   BaseRepo._del_named_file  s    !$"6"677rK   c                 ,    [        U R                  5      e)tOpen the index for this repository.

Raises:
  NoIndexPresent: If no index is present
Returns: The matching `Index`
)r   
open_indexr   s    rH   r   BaseRepo.open_index  s     "$//22rK   c                     Uc  UR                   R                  nU R                  UUR                  5       UUS9u  pVUR                   R	                  XVU5        U R                  5       $ )zFetch objects into another repository.

Args:
  target: The target repository
  determine_wants: Optional function to determine what refs to
    fetch.
  progress: Optional progress function
  depth: Optional shallow fetch depth
Returns: The local refs
)progressdepth)r   determine_wants_allfetch_pack_dataget_graph_walkeradd_pack_dataget_refs)rG   targetdetermine_wantsr   r   count	pack_datas          rH   fetchBaseRepo.fetch  sl     "$11EEO//##%	 0 
 	))%HE}}rK   c                 :    U R                  XX4US9n[        U5      $ )aV  Fetch the pack data required for a set of revisions.

Args:
  determine_wants: Function that takes a dictionary with heads
    and returns the list of heads to fetch.
  graph_walker: Object that can iterate over the list of revisions
    to fetch and has an "ack" method that will be called to acknowledge
    that a revision is present.
  progress: Simple progress function that will be called with
    updated progress strings.
  get_tagged: Function that returns a dict of pointed-to sha ->
    tag sha for including tags.
  depth: Shallow fetch depth
Returns: count and iterator over pack data
)r   )fetch_objectsr$   )rG   r   graph_walkerr   
get_taggedr   r5   s          rH   r   BaseRepo.fetch_pack_data  s-    0 $$8u % 
 $G,,rK   c                   ^ US;  a  [        S5      e0 nU R                  5       R                  5        HF  u  px U R                  U   n	[	        U	[
        5      (       a  U	R                  S   Xg[        -   '   XU'   MH     U" U5      n
[	        U
[        5      (       d  [        S	5      e[        US
[!        5       5      n[        US[!        5       5      nU
/ :X  a  U(       d  U(       a  g/ $ U R                  R#                  U5      nU(       d  U(       a  / n[%        U R                  US9mU4S jnU R                  R'                  U R                  R)                  UU
U R+                  5       UUUS95      $ ! [         aG    [        R                  " SUR                  SS5      < SUR                  S5      < 3[        5         GM  f = f)aj  Fetch the missing objects required for a set of revisions.

Args:
  determine_wants: Function that takes a dictionary with heads
    and returns the list of heads to fetch.
  graph_walker: Object that can iterate over the list of revisions
    to fetch and has an "ack" method that will be called to acknowledge
    that a revision is present.
  progress: Simple progress function that will be called with
    updated progress strings.
  get_tagged: Function that returns a dict of pointed-to sha ->
    tag sha for including tags.
  depth: Shallow fetch depth
Returns: iterator over objects, with __len__ implemented
)Nr   zdepth not supported yetrv   zref rp   replacez points at non-present sha asciiz'determine_wants() did not return a listshallow	unshallowN)r   c                 <   > TR                  U R                  U 5      $ rD   r   id)r   parents_providers    rH   r   +BaseRepo.fetch_objects.<locals>.get_parents  s    #//		6BBrK   )r   )r   r   r   r   r   r"   objectr+   r_   warningswarndecodeUserWarninglist	TypeErrorgetattr	frozensetfind_common_revisionsr   	iter_shasfind_missing_objectsget_shallow)rG   r   r   r   r   r   r6   refr   objwantsr   
unshallowshavesr   r  s                  @rH   r   BaseRepo.fetch_objects  s   . 	!%&?@@--/HC '', c3''7:zz!}D334S	 0  %%&&EFF<IK@\;	D
B; :I
 !!77E z E*4+<+<xP	C   **22  "' 3 	
 		
]  zz'95szz'7JL
 s   E00AG Gc                 X    U R                   R                  UUU R                  5       UUS9$ )a	  Generate pack data objects for a set of wants/haves.

Args:
  have: List of SHA1s of objects that should not be sent
  want: List of SHA1s of objects that should be sent
  ofs_delta: Whether OFS deltas can be included
  progress: Optional progress reporting method
)r   r   	ofs_delta)r   generate_pack_datar  )rG   havewantr   r  s        rH   r  BaseRepo.generate_pack_data  s:       33$$& 4 
 	
rK   c                    UcJ  U R                   R                  S5      R                  5        Vs/ s H  nX R                  ;   d  M  UPM     nn[	        U R                  5      n[        XR                  U R                  5       S9$ s  snf )zRetrieve a graph walker.

A graph walker is used by a remote repository (or proxy)
to find out which objects are present in this repository.

Args:
  heads: Repository heads to use (optional)
Returns: A graph walker object

   refs/heads)r   )r6   as_dictvaluesr   r   r   r   r  )rG   r8   r   r  s       rH   r   BaseRepo.get_graph_walker0  s     =  99,,];BBDDC+++ D  
 +4+<+<=%//9I9I9K
 	
s   BBc                 6    U R                   R                  5       $ )zNGet dictionary with all refs.

Returns: A ``dict`` mapping ref names to SHA1s
)r6   r  r   s    rH   r   BaseRepo.get_refsE  s    
 yy  ""rK   c                      U R                   S   $ )z#Return the SHA1 pointed at by HEAD.   HEAD)r6   r   s    rH   headBaseRepo.headL  s    yy!!rK   c                 X   [        U5      S;   d   eU R                  U5      n[        X25      (       dw  U[        L a  [	        U5      eU[
        L a  [        U5      eU[        L a  [        U5      eU[        L a  [        U5      e[        SUR                  < SUR                  < 35      eU$ )N   (   zType invalid: z != )r   
get_objectr   r    r   r   r   r#   r   r"   r   	Exception	type_name)rG   r   clsrets       rH   _get_objectBaseRepo._get_objectP  s    3x8###ooc"###f}$S))"3''"3''!#&&03s}}M  
rK   r   c                      U R                   U   $ )zRetrieve the object with the specified SHA.

Args:
  sha: SHA to retrieve
Returns: A ShaFile object
Raises:
  KeyError: when the object can not be found
r   )rG   r   s     rH   r+  BaseRepo.get_objectb  s       %%rK   c                 \    [        U R                  U R                  U R                  5       S9$ )N)r   r   )r   r   r   r  r   s    rH   r  BaseRepo.parents_providerm  s-    $$%%'
 	
rK   r   c                 @    U R                  5       R                  X5      $ )a  Retrieve the parents of a specific commit.

If the specific commit is a graftpoint, the graft parents
will be returned instead.

Args:
  sha: SHA of the commit for which to retrieve the parents
  commit: Optional commit matching the sha
Returns: List of parents
)r  r   )rG   r   r   s      rH   r   BaseRepo.get_parentst  s     $$&223??rK   c                 ,    [        U R                  5      e)XRetrieve the config object.

Returns: `ConfigFile` object for the ``.git/config`` file.
)r   
get_configr   s    rH   r;  BaseRepo.get_config  s    
 "$//22rK   c                 ,    [        U R                  5      e)z~Retrieve the description for this repository.

Returns: String with the description of the repository
    as set by the user.
)r   get_descriptionr   s    rH   r>  BaseRepo.get_description       "$"6"677rK   c                 ,    [        U R                  5      e)oSet the description for this repository.

Args:
  description: Text to set as description for this repository.
)r   set_descriptionrG   r   s     rH   rC  BaseRepo.set_description  r@  rK   r   c                 f    SSK Jn  U R                  5       /UR                  " 5       -   nU" X"S   S9$ )zReturn a config stack for this repository.

This stack accesses the configuration for both this repository
itself (.git/config) and the global configuration, which usually
lives in ~/.gitconfig.

Returns: `Config` instance for this repository
r   )r   )writable)r   r   r;  default_backends)rG   r   backendss      rH   get_config_stackBaseRepo.get_config_stack  s3     	1OO%&)G)G)IIX<<rK   c                     U R                  S5      nUc
  [        5       $ U   [        S U 5       5      sSSS5        $ ! , (       d  f       g= f)zBGet the set of shallow commits.

Returns: Set of shallow commits.
r   Nc              3   @   #    U  H  oR                  5       v   M     g 7frD   )strip).0r   s     rH   	<genexpr>'BaseRepo.get_shallow.<locals>.<genexpr>  s     2zz||s   )r   r   )rG   r   s     rH   r  BaseRepo.get_shallow  s;    
 	*95L222 QQs	   =
Ac           
          U R                  5       nU(       a  UR                  U5        U(       a  UR                  U5        U R                  SSR	                  U Vs/ s H  oDS-   PM	     sn5      5        gs  snf )zUpdate the list of shallow objects.

Args:
  new_shallow: Newly shallow objects
  new_unshallow: Newly no longer shallow objects
r   rK   r   N)r  updatedifference_updater   r   )rG   new_shallownew_unshallowr   r   s        rH   update_shallowBaseRepo.update_shallow  s_     ""$NN;'%%m4Y1Q#+1Q(RS1Qs   A6c                     U R                   R                  U5      nUb  U$ U R                  R                  U R                   U   5      R                  $ )zGet the peeled value of a ref.

Args:
  ref: The refname to peel.
Returns: The fully-peeled SHA1 of a tag object, after peeling all
    intermediate tags; if the original ref does not point to a tag,
    this will equal the original SHA1.
)r6   
get_peeledr   peel_shar   )rG   r  cacheds      rH   r[  BaseRepo.get_peeled  sH     %%c*M  ))$))C.9<<<rK   c                    ^  SSK Jn  Uc  T R                  5       /n[        U[        5      (       a  U/nU 4S jUS'   U" T R
                  U/UQ70 UD6$ )a  Obtain a walker for this repository.

Args:
  include: Iterable of SHAs of commits to include along with their
    ancestors. Defaults to [HEAD]
  exclude: Iterable of SHAs of commits to exclude along with their
    ancestors, overriding includes.
  order: ORDER_* constant specifying the order of results.
    Anything other than ORDER_DATE may result in O(n) memory usage.
  reverse: If True, reverse the order of output, requiring O(n)
    memory.
  max_entries: The maximum number of entries to yield, or None for
    no limit.
  paths: Iterable of file or subtree paths to show entries for.
  rename_detector: diff.RenameDetector object for detecting
    renames.
  follow: If True, follow path across renames/copies. Forces a
    default rename_detector.
  since: Timestamp to list commits after.
  until: Timestamp to list commits before.
  queue_cls: A class to use for a queue of commits, supporting the
    iterator protocol. The constructor takes a single argument, the
    Walker.
Returns: A `Walker` object
r   )Walkerc                 <   > TR                  U R                  U 5      $ rD   r   )r   rG   s    rH   <lambda>%BaseRepo.get_walker.<locals>.<lambda>  s    t/?/?		6/RrK   r   )dulwich.walkr`  r%  r   strr   )rG   includeargskwargsr`  s   `    rH   
get_walkerBaseRepo.get_walker  sU    4 	(?yy{mGgs##iG R}d''B4B6BBrK   c                 D   [        U[        5      (       d!  [        S[        U5      R                  -  5      e[        U5      S;   a   U R                  U   $  U R                  U R                  U      $ ! [        [        4 a     N/f = f! [         a    [        U5      ef = f)zRetrieve a Git object by SHA1 or ref.

Args:
  name: A Git object SHA1 or a ref name
Returns: A `ShaFile` object, such as a Commit or Blob
Raises:
  KeyError: when the specified ref or object does not exist
z$'name' must be bytestring, not %.80sr(  )r   r   r	  typerM   r   r   r_   r   r6   r   rG   rs   s     rH   __getitem__BaseRepo.__getitem__  s     $&&6d9L9LL  t9 ((..	!$$TYYt_55 j)   	!4. 	!s   A3 B	 3BB	Brs   c                     [        U5      S:X  d  [        U5      S:X  a3  [        U5      (       a#  XR                  ;   =(       d    XR                  ;   $ XR                  ;   $ )z]Check if a specific Git object or ref is present.

Args:
  name: Git object SHA1 or ref name
r)  r*  )r   r   r   r6   rm  s     rH   __contains__BaseRepo.__contains__	  sK     t9?s4yB<3E3E,,,A		0AA99$$rK   valuec                    UR                  S5      (       d  US:X  a^  [        U[        5      (       a  UR                  U R                  U'   g[        U[
        5      (       a  X R                  U'   g[        U5      e[        U5      e)z^Set a ref.

Args:
  name: ref name
  value: Ref value - either a ShaFile object, or a hex sha
   refs/r$  N)rz   r   r!   r   r6   r   r	  r   )rG   rs   rs  s      rH   __setitem__BaseRepo.__setitem__  se     ??8$$%))"'((		$E5))"'		$&&T""rK   c                 l    UR                  S5      (       d  US:X  a  U R                  U	 g[        U5      e)z7Remove a ref.

Args:
  name: Name of the ref to remove
ru  r$  N)rz   r6   r   rm  s     rH   __delitem__BaseRepo.__delitem__%  s/     ??8$$		$T""rK   rk   rl   c                     [        U5      $ )z.Determine the identity to use for new commits.)r   )rG   rk   rl   s      rH   _get_user_identityBaseRepo._get_user_identity0  s     !((rK   updated_graftpointsc                     UR                  5        H  u  p#U/U-    H  n[        US5        M     M      U R                  R                  U5        g)zcAdd or modify graftpoints

Args:
  updated_graftpoints: Dict of commit shas to list of parent shas
r   N)r   r   r   rT  )rG   r~  r   r   r   s        rH   _add_graftpointsBaseRepo._add_graftpoints5  sL      388:OFx')S"67 *  ; 	  !45rK   	to_removec                 0    U H  nU R                   U	 M     g)z;Remove graftpoints

Args:
  to_remove: List of commit shas
N)r   )rG   r  r   s      rH   _remove_graftpointsBaseRepo._remove_graftpointsC  s     C!!#& rK   c                     U R                  U5      nUc  / $ U   UR                  5        Vs/ s H)  o3R                  5       (       d  M  UR                  5       PM+     snsS S S 5        $ s  snf ! , (       d  f       g = frD   )r   	readlinesrN  )rG   rs   r   r   s       rH   _read_headsBaseRepo._read_headsL  sW    %9I-.[[]K]TjjlLDJJL]K QK Qs"   A-A(A(A-(A--
A;c           
      :   SSK n[        5       nUc1  U R                  5       nUR                  U R                  5      Ul        O [        U5      S:w  a  [        S5      eXl         U(       d  U R                  S   R                  5         U R                  5       nUc  U R                  S5      nUc
  [        USS9n[!        U5        X.l        Uc  UR                   " 5       n[%        U5      Ul        Uc  SnX^l        Uc
  [        US	S9nX>l        [!        U5        Uc  Un[%        U5      Ul        Uc  UnX~l        U	c   UR1                  S
S5      n	U	b  Xl        Uc  [        S5      e U(       a  Xl        O6U R                  S   R                  U5      Ul        UR4                  c  Xl        U
c"  Xl        U R                  R9                  U5        Ox U R:                  U
   nU/U-   Ul        U R                  R9                  U5        U R:                  R=                  U
UUR>                  SU-   UUUS9nU(       d  [        U
< S35      eU RC                  S5         U R                  S   R                  5         UR>                  $ ! [         a  n[        U5      eSnAf[         a     GNf = f! [         a     GNjf = f! [         a  n[        U5      eSnAf[         a
    Xl         GN=f = f! [         aP    Xl        U R                  R9                  U5        U R:                  RA                  U
UR>                  SU-   UUUS9n GNf = f! [         a3  n[D        RF                  " SU-  [H        5         SnAUR>                  $ SnAf[         a     UR>                  $ f = f)aQ  Create a new commit.

If not specified, `committer` and `author` default to
get_user_identity(..., 'COMMITTER')
and get_user_identity(..., 'AUTHOR') respectively.

Args:
  message: Commit message
  committer: Committer fullname
  author: Author fullname
  commit_timestamp: Commit timestamp (defaults to now)
  commit_timezone: Commit timestamp timezone (defaults to GMT)
  author_timestamp: Author timestamp (defaults to commit
    timestamp)
  author_timezone: Author timestamp timezone
    (defaults to commit timestamp timezone)
  tree: SHA1 of the tree root to use (if not specified the
    current index will be committed).
  encoding: Encoding
  ref: Optional ref to commit to (defaults to current branch)
  merge_heads: Merge heads (defaults to .git/MERGE_HEADS)
  no_verify: Skip pre-commit and commit-msg hooks

Returns:
  New commit SHA1
r   Nr*  z%tree must be a 40-byte hex sha string
pre-commitMERGE_HEADS	COMMITTER)rl   AUTHOR)i18ncommitEncodingzNo commit message specified
commit-msgs   commit: )message	committer	timestamptimezonez changed during commitpost-commitzpost-commit hook failed: %s)%timer    r   r   r   treer   r   r>   executer   r   r_   rJ  r  r   r   r  intcommit_timecommit_timezoneauthorauthor_timeauthor_timezonerc   encodingr  r   
add_objectr6   set_if_equalsr   
add_if_newr   r  r  r  )rG   r  r  r  commit_timestampr  author_timestampr  r  r  r  merge_heads	no_verifyr  cr9   erk   old_headoks                       rH   	do_commitBaseRepo.do_commitS  s{   R 	H<OO%E\\$"3"34AF4yB !HIIF	

<(002 &&(**=9K)&{CII&##yy{,-"O+>&vH=FF##/,-"-O+!::i1AB !J?:;;
	 #	 JJ|4<<WE	99$ 'I ;#I((+99S>%J4	!!,,Q/YY,,DD''1'., - (  ""EFF]+	JJ}%--/ ttC  	!a.  		@    	!a.  	 I	 *  
'	!!,,Q/YY))DD''1'., * 
(  	JMM7!;[II tt  	tt	s   $$J ;J* %J; 36J; A!K* M 
J'JJ'&J'*
J87J8;
K'KK'&K'*AMM
NM??NN)r   r>   r   r6   )NNNNNrD   )rT   r   )NNNNNNNNNr$  NF)3rM   rN   rO   rP   rQ   r   r-   rI   boolr   r   r   r   r   r   r   r   r   r  r   r   r   r   r%  r0  r!   r+  r  r    r   r   r;  r>  rC  rJ  r  rX  r[  ri  rn  rq  r	   rv  ry  re  r|  r  r  r  r  rR   rS   rK   rH   r   r   ?  s   _ M  =d =C C C&78836 -D U
n
"
*#$ue|, #"e "$	&e 	& 	&
@u @f @U @388=	3T=#CJ!.	% 	%4 	%# #eGUN.C #"	# 	#) ) )u )
6DU9K4L 6 <> 'T%[ '$ 'L XrK   r   c                     U R                  5       nUR                  S5      (       d  [        S5      eU[        S5      S R	                  S5      $ )zRead a ``.git`` file.

The first line of the file should start with "gitdir: "

Args:
  f: File-like object to read from
Returns: A path
zgitdir: z&Expected file to start with 'gitdir: 'N
)readrz   r   r   rstrip)r   css     rH   read_gitfiler    sG     
B==$$ABBc*o ''--rK   c                       \ rS rSrSrS rSrg)UnsupportedVersioni  zUnsupported repository version.c                     Xl         g rD   version)rG   r  s     rH   rI   UnsupportedVersion.__init__   s    rK   r  NrL   rS   rK   rH   r  r    s
    )rK   r  c                   $   \ rS rSrSrS S jrS r\S!S j5       rS r	S r
S	 rS
 rS rS"S jrS rS#S jrS rS r    S$S jrS"S jrS%S jrS rS rS r\S"S j5       r\S&S j5       r\S'S j5       r\S(S j5       r\rS rS rS r S r!Sr"g))Repoi  zA git repository backed by local disk.

To open an existing repository, call the contructor with
the path of the repository.

To create a new repository, use the Repo.init class method.
Nc           	      	   [         R                  R                  U[        5      nUGc  [         R                  R	                  U5      (       dF  [         R                  R                  [         R                  R                  U[        5      5      (       a  SnO[         R                  R                  [         R                  R                  U[        5      5      (       aI  [         R                  R                  [         R                  R                  U[        5      5      (       a  SnO[        S[        US9-  5      eX0l
        USL ax  [         R                  R	                  U5      (       aM  [        US5       n[        U5      nS S S 5        SU l
        [         R                  R                  UW5      U l        OX@l        OXl        U R                  [        5      nUbp  U   [         R                  R                  U R!                  5       [         R"                  " UR%                  5       R'                  S5      5      5      U l        S S S 5        OU R                  U l        Xl        U R+                  5       n [-        UR/                  SS5      5      n	U	S	:w  a  [3        U	5      eUcG  [4        R6                  " [         R                  R                  U R9                  5       [        5      U5      n[;        U R9                  5       U R                  U R<                  S
9n
[>        RA                  XU
5        0 U l!        U R                  [         R                  R                  SS5      U R9                  5       S9nU(       a/  U   U RB                  RE                  [G        U5      5        S S S 5        U R                  SU R9                  5       S9nU(       a/  U   U RB                  RE                  [G        U5      5        S S S 5        [I        U R!                  5       5      U RJ                  S'   [M        U R!                  5       5      U RJ                  S'   [O        U R!                  5       5      U RJ                  S'   [Q        U R!                  5       5      U RJ                  S'   g ! , (       d  f       GN= f! , (       d  f       GNW= f! [0         a    S	n	 GN7f = f! , (       d  f       GN3= f! , (       d  f       N= f)NFT'No git repository was found at %(path)sr   rs   
r   r   r   loggerr?   r   )basedirr   r  r  r  zpost-receive))ra   r   r   
CONTROLDIRisfileisdir	OBJECTDIRREFSDIRr   dictr   openr  _controldirr   	COMMONDIR
controldirr   r  r  
_commondirr;  r  rc   r_   r  r   from_configr:   r0   _write_reflogr   rI   r   rT  r   r&   r>   r(   r'   r)   )rG   rootr   r   hidden_pathr   r   r:   rk   format_versionr6   
graft_files               rH   rI   Repo.__init__  sr   ggll44<{++GGMM"'',,{I"FGG''--T9 =>>GGMM"'',,tW"=>>&=$O  	5=ww~~k**+s+q'?D ,!	#%77<<d#; #. #''	2	 "$'',,OO%KK	 0 7 7 @A#  #..DO	"	 F4M!NON Q$^44*66T^^-y96L !NNd..t7I7I
 	$d3((GGLL*DNN4D ) 

 !!(()::)FG ((DNN<L(M
!!(()::)FG  $6doo6G#H

< #5doo6G#H

< $78I$J

=!%9$//:K%L

>"c ,+   	N	$  sC   5RA%R$3R6 8%S	%S
R!$
R36SS	
S
S)c                 L   SSK Jn  [        R                  R	                  U R                  5       S[        R                  " U5      5      n	 [        R                  " [        R                  R                  U	5      5        Uc!  U R                  5       n
U R                  U
5      n[        U5        Uc  [        [        R                  " 5       5      nUc  Sn[        U	S5       nUR!                  U" X#XEXg5      S-   5        S S S 5        g ! [         a     Nf = f! , (       d  f       g = f)Nrv   )format_reflog_linelogsr   abr   )reflogr  ra   r   r   r  r   makedirsdirnameFileExistsErrorrJ  r|  r   r  r  r  write)rG   r  old_shanew_shar  r  r  r  r  r   rk   r   s               rH   r  Repo._write_reflogQ  s     	/ww||DOO-vr{{37GH	KK-. **,F//7II&DIIK(IH$GG"iH    		 s   3D D
DD
D#c                    Sn[         R                  R                  U5      nU(       a	   U " U5      $ [        S[        US9-  5      e! [         a$    [         R                  R	                  U5      u  p2 Of = fU(       a  MX  NP)zIterate parent directories to discover a repository

Return a Repo object for the first parent directory that looks like a
Git repository.

Args:
  start: The directory to start discovery from (defaults to '.')
Tr  r  )ra   r   abspathr   r^   r  )r.  start	remainingr   s       rH   discoverRepo.discoverk  sw     	wwu%64y  5%8HH
 	
 $ 6"$''--"5i6 is   A +A54A5c                     U R                   $ )z)Return the path of the control directory.)r  r   s    rH   r  Repo.controldir  s    rK   c                     U R                   $ )zReturn the path of the common directory.

For a main working tree, it is identical to controldir().

For a linked working tree, it is the control directory of the
main working tree.)r  r   s    rH   r:   Repo.commondir  s     rK   c                 T   [         R                  R                  U R                  S5      n[        US5       nUR	                  S5        SSS5        [         R
                  " U5      n [         R                  " XR                  [        R                  -  5        [         R
                  " U5      n[         R                  " U5        UR                  UR                  :g  nUR                  [        R                  -  S:g  nU=(       a    U$ ! , (       d  f       N= f! [         a     gf = f)r   z.probe-permissionsw NFr   )ra   r   r   r  r  lstatchmodst_modestatS_IXUSRPermissionErrorunlink)rG   fnamer   st1st2mode_differsst2_has_execs          rH   r   Repo._determine_file_mode  s    
 TYY(<=%GGBK  hhuo	HHUKK$,,67 hhuo
		%{{ckk1dll2q8,,   		s   D	(1D 	
D
D'&D'c                    UR                  [        R                  R                  5      n[	        [        R                  R                  U R                  5       U5      S5       nUR                  U5        SSS5        g! , (       d  f       g= f)r   wbN)lstripra   r   sepr   r   r  r  )rG   r   r   r   s       rH   r   Repo._put_named_file  sU     {{277;;'RWW\\$//"3T:DAQGGH BAAs   "A==
Bc                      [         R                  " [         R                  R                  U R	                  5       U5      5        g ! [
         a     g f = frD   )ra   r  r   r   r  FileNotFoundErrorr   s     rH   r   Repo._del_named_file  s;    	IIbggll4??#4d;<  		s   AA 
AAc                     Uc  U R                  5       nUR                  [        R                  R                  5      n [        [        R                  R                  X!5      S5      $ ! [         a     gf = f)a  Get a file from the control dir with a specific name.

Although the filename should be interpreted as a filename relative to
the control dir in a disk-based Repo, the object returned need not be
pointing to a file in that location.

Args:
  path: The path to the file, relative to the control dir.
  basedir: Optional argument that specifies an alternative to the
    control dir.
Returns: An open file object, or None if the file does not exist.
Nrb)r  r  ra   r   r   r  r   r  )rG   r   r  s      rH   r   Repo.get_named_file  s\     ?oo'G{{277;;'	W3T::  		s   (A' '
A43A4c                 f    [         R                  R                  U R                  5       [        5      $ )zReturn path to the index file.)ra   r   r   r  INDEX_FILENAMEr   s    rH   
index_pathRepo.index_path  s    ww||DOO-~>>rK   c                 x    SSK Jn  U R                  5       (       d
  [        5       eU" U R	                  5       5      $ )r   r   r   )dulwich.indexr   	has_indexr   r
  )rG   r   s     rH   r   Repo.open_index  s/     	(~~ ""T__&''rK   c                 $    U R                   (       + $ )zCheck if an index is present.r   r   s    rH   r  Repo.has_index  s     99}rK   c                    [         R                  " U R                  5      n[        U[        5      (       d  U/nSSKJnJnJn  U R                  5       nU R                  5       nU GH7  n[        U[        5      (       d  [         R                  " U5      n[         R                  R                  U5      (       a  [        SU-  5      eU" U5      n	[         R                  R                  X(5      n
 [         R                  " U
5      n[         R"                  " UR$                  5      (       d*  [         R&                  " UR$                  5      (       d   Xi	 M  U" X5      nUR+                  X5      nU R,                  R/                  U5        U" XR0                  S5      Xi'   GM:     UR5                  5         g! [(         a     GM[  f = f! [2         a     Xi	  GMp  ! [(         a      GM  f = ff = f)zXStage a set of paths.

Args:
  fs_paths: List of paths, relative to the repository path
r   )blob_from_path_and_statindex_entry_from_stat_fs_to_tree_pathz;path %r should be relative to repository root, not absoluteN)ra   fsencoder   r   r  r  r  r  r  r   get_blob_normalizerr   isabsr   r   r  r  S_ISREGr  S_ISLNKr_   checkin_normalizer   r  r   OSErrorr  )rG   fs_pathsroot_path_bytesr  r  r  r9   blob_normalizerfs_path	tree_path	full_pathstblobs                rH   stage
Repo.stage  s    ++dii0(D)) zH	
 	
 !224Ggu--++g.ww}}W%% 46=>  )1I_>IMXXi( ||BJJ//RZZ8P8P!, 39AD*<<TKD%%006'<R!'LE$9  : 	 $   ( 	s<   .GF22
G G
G)G
G%G)$G%%G)c                    U(       d  U R                  XS9nO!U(       a  [        S5      eU R                  XS9nU R                  U5        U R                  n[        U[        5      (       d  [        R                  " U5      nSU-   nUR                  R                  SU-   U R                  R                  S5      US9  UR                  R                  SU R                  R                  S5      US9   UR                  R                  [        U R                  [           US9  UR                  5       n	U	R!                  SS	U5        U	R!                  SS
S5        U	R#                  5         U R                  R%                  S5      u  pU
(       aF  UbC  UR                  R'                  SU
S   US9  XS'   Uc  U(       + nU(       a  UR)                  5         U$ ! [         a     Nf = f)a  Clone this repository.

Args:
  target_path: Target path
  mkdir: Create the target directory
  bare: Whether to create a bare repository
  origin: Base name for refs in target repository
    cloned from this repository
Returns: Created repository as `Repo`
)mkdirz"checkout and bare are incompatibles   clone: from s   refs/remotes/r  )r  s	   refs/tags)remoteoriginurlr   z#+refs/heads/*:refs/remotes/origin/*r$  rw   )initr   	init_barer   r   r   r   ra   r  r6   import_refsr  r  DEFAULT_REFr_   r;  r   write_to_pathfollowset_symbolic_refreset_index)rG   target_pathr)  r   r+  checkoutr   encoded_pathref_messagetarget_config
head_chainhead_shas               rH   clone
Repo.clone  s   $ YY{Y8F !EFF^^K^=F

6yy,..;;|4L%4v%IIm, 	  	

 	$))++L9; 	  	
	KK""TYY{3[ # 
 ))+.|D 1	

 	##%  $yy//8
(.KK((*R.+(V&7O#8""$/  		s   20G 
G! G!c           	      X   SSK JnJnJn  Uc  U S   R                  nU R                  5       nUR                  SS[        R                  S:g  5      nUR                  SS[        R                  S:H  5      (       a  UnOUnU" U R                  U R                  5       U R                  UUUS9$ )	zjReset the index back to a specific tree.

Args:
  tree: Tree SHA to reset to, None for current HEAD tree.
r   )build_index_from_treevalidate_path_element_defaultvalidate_path_element_ntfsr$  s   cores   filemodents   core.protectNTFS)honor_filemodevalidate_path_element)r  r?  r@  rA  r  r;  get_booleanra   rs   r   r
  r   )rG   r  r?  r@  rA  rk   rC  rD  s           rH   r4  Repo.reset_indexX  s    	
 	
 <=%%D"++G["''T/Rg':BGGtOLL$>!$A!$IIOO)"7
 	
rK   c                     SSK Jn  [        R                  R	                  U R
                  S5      n UR                  " U5      $ ! [         a    U" 5       nX#l        Us $ f = f)r:  r   r   rk   )r   r   ra   r   r   r  	from_pathr  )rG   r   r   r/  s       rH   r;  Repo.get_configu  sW    
 	.ww||D,,h7	''--  	,CHJ	s   A A A c                     [         R                  R                  U R                  S5      n [	        US5       nUR                  5       sSSS5        $ ! , (       d  f       g= f! [         a     gf = f)zcRetrieve the description of this repository.

Returns: A string describing the repository or None.
r   r  N)ra   r   r   r  r   r  r  )rG   r   r   s      rH   r>  Repo.get_description  sU    
 ww||D,,m<	t$vvx %$$  		s.   A# A	A# 
A A#  A# #
A0/A0c                      SU R                   -  $ )Nz<Repo at %r>r  r   s    rH   __repr__Repo.__repr__  s    		))rK   c                 (    U R                  SU5        g)rB  r   N)r   rD  s     rH   rC  Repo.set_description  s     	]K8rK   c                 p   [          H8  n[        R                  " [        R                  R                  " U/UQ76 5        M:     Uc8  [
        R                  " [        R                  R	                  U[        5      5      nU " XUS9nUR                  R                  S[        5        UR                  U5        U$ )N)r   r   r$  )BASE_DIRECTORIESra   r)  r   r   r   r-  r  r6   r3  r0  r   )r.  r   r  r   r   dr/  s          rH   _init_maybe_bareRepo._init_maybe_bare  s    !AHHRWW\\*1q12 "*//Z0STL$=!!';7
rK   c                     U(       a  [         R                  " U5        [         R                  R                  U[        5      n[         R                  " U5        [        U5        U R                  XS5      $ )zCreate a new repository.

Args:
  path: Path in which to create the repository
  mkdir: Whether to create the directory
Returns: `Repo` instance
F)ra   r)  r   r   r  r   rT  )r.  r   r)  r  s       rH   r-  	Repo.init  sM     HHTNWW\\$
3

z*##De<<rK   c                 @   U(       a  [         R                  " U5        Uc  [         R                  R                  U5      n[         R                  R	                  UR                  5       [        5      n[         R                  R	                  XS5      n[         R                  R	                  U[        5      n[        US5       nUR                  S[         R                  " U5      -   S-   5        SSS5         [         R                  " U5         [         R                  " U5        [        [         R                  R	                  U[        5      S5       nUR                  [         R                  " U5      S-   5        SSS5        [        [         R                  R	                  U[        5      S5       nUR                  S5        SSS5        [        [         R                  R	                  US5      S5       nUR                  UR                  5       S-   5        SSS5        U " U5      n	U	R                  5         U	$ ! , (       d  f       GNS= f! [         a     GNLf = f! [         a     GNFf = f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       N~= f)zCreate a new working directory linked to a repository.

Args:
  path: Path in which to create the working tree.
  main_repo: Main repository to reference
  identifier: Worktree identifier
  mkdir: Whether to create the directory
Returns: `Repo` instance
Nr  s   gitdir: r   s   ../..
HEAD)ra   r)  r   basenamer   r  	WORKTREESr  r  r  r  r  GITDIRr  r%  r4  )
r.  r   	main_repo
identifierr)  main_worktreesdirworktree_controldir
gitdirfiler   r  s
             rH   _init_new_working_directory Repo._init_new_working_directory  s    HHTN))$/JGGLL)=)=)?K ggll+<IWW\\$
3
*d#qGGK"++.A"BBUJK $	HH&'	HH() "'',,2F;TBaGGBKK
+e34 C"'',,2I>EGGJ F"'',,2F;TBaGGINN$u,- CI	% $#  		  		BBEEBBsT   ,H96I I )I-0I>4#J9
I
II
I*)I*-
I;>
J
Jc                 ^    U(       a  [         R                  " U5        U R                  XSUS9$ )zCreate a new bare repository.

``path`` should already exist and be an empty directory.

Args:
  path: Path to create bare repository in
Returns: a `Repo` instance
Tr3  )ra   r)  rT  )r.  r   r)  r   s       rH   r.  Repo.init_bare  s*     HHTN##D<#PPrK   c                 8    U R                   R                  5         g)z*Close any files opened by this repository.N)r   closer   s    rH   rg  
Repo.close  s    !rK   c                     U $ rD   rS   r   s    rH   	__enter__Repo.__enter__  s    rK   c                 $    U R                  5         g rD   )rg  )rG   exc_typeexc_valexc_tbs       rH   __exit__Repo.__exit__  s    

rK   c                 :    0 n[        U R                  5       U5      $ )zReturn a BlobNormalizer object)r*   rJ  )rG   git_attributess     rH   r  Repo.get_blob_normalizer  s     d335~FFrK   )r  r  r   r   r   r  ).rD   )rT   r   )TFs   originN)rT   r   )F)NF)FN)#rM   rN   rO   rP   rQ   rI   r  classmethodr  r  r:   r   r   r   r   r
  r   r  r&  r<  r4  r;  r>  rM  rC  rT  r-  rb  r.  createrg  rj  rp  r  rR   rS   rK   rH   r  r    s    BMH4 
 
( -.	.?(0j @D
:
*9   = = # #J Q Q F"GrK   r  c                   h    \ rS rSrSrS rS rS rS rS r	S r
S	 rSS jrS rS r\S 5       rSrg
)
MemoryRepoi  zRepo that stores refs, objects, and named files in memory.

MemoryRepos are always bare: they have no working tree and no index, since
those have a stronger dependency on the filesystem.
c                     SSK Jn  / U l        [        0 U R                  S9n[
        R                  U [        5       U5        0 U l        SU l	        U" 5       U l
        S U l        g )Nr   r   r  T)r   r   _reflogr.   _append_reflogr   rI   r   _named_filesr   _config_description)rG   r   refs_containers      rH   rI   MemoryRepo.__init__  sT    -*2d6I6IJ$ 1 3^D	!| rK   c                 :    U R                   R                  U5        g rD   )r{  r   )rG   rg  s     rH   r|  MemoryRepo._append_reflog  s    D!rK   c                     Xl         g rD   r  rD  s     rH   rC  MemoryRepo.set_description  s    'rK   c                     U R                   $ rD   r  r   s    rH   r>  MemoryRepo.get_description  s       rK   c                 (    [         R                  S:g  $ )r   r   )r   r   r   s    rH   r   MemoryRepo._determine_file_mode  s    
 ||w&&rK   c                      X R                   U'   g)r   N)r}  r   s      rH   r   MemoryRepo._put_named_file   s     #+$rK   c                 @     U R                   U	 g ! [         a     g f = frD   )r}  r_   r   s     rH   r   MemoryRepo._del_named_file)  s'    	!!$' 		s    
Nc                 X    U R                   R                  US5      nUc  g[        U5      $ )al  Get a file from the control dir with a specific name.

Although the filename should be interpreted as a filename relative to
the control dir in a disk-baked Repo, the object returned need not be
pointing to a file in that location.

Args:
  path: The path to the file, relative to the control dir.
Returns: An open file object, or None if the file does not exist.
N)r}  rc   r   )rG   r   r  r   s       rH   r   MemoryRepo.get_named_file/  s0     $$((t4x  rK   c                     [        5       e)zoFail to open index for this repo, since it is bare.

Raises:
  NoIndexPresent: Raised when no index is present
)r   r   s    rH   r   MemoryRepo.open_index?  s     rK   c                     U R                   $ )z;Retrieve the config object.

Returns: `ConfigFile` object.
)r~  r   s    rH   r;  MemoryRepo.get_configG  s    
 ||rK   c                     U " 5       nU H  nUR                   R                  U5        M      UR                  5        H   u  pVUR                  R	                  XV5        M"     UR                  SS9  U$ )zCreate a new bare repository in memory.

Args:
  objects: Objects for the new repository,
    as iterable
  refs: Refs as dictionary, mapping names
    to object SHA1s
Tr  )r   r  r   r6   r  r   )r.  r5   r6   r/  r  refnamer   s          rH   r.  MemoryRepo.init_bareN  s`     eC'',  JJLLGHH- )T"
rK   )r~  r  r}  r{  r   rD   )rM   rN   rO   rP   rQ   rI   r|  rC  r>  r   r   r   r   r   r;  rv  r.  rR   rS   rK   rH   ry  ry    sM    	!"(!'+!   rK   ry  rD   )_rQ   ior   ra   r   r  r  typingr   r   r   r   r   r	   r
   r   r   r   r  r   dulwich.errorsr   r   r   r   r   r   r   r   r   dulwich.filer   dulwich.object_storer   r   r   r   dulwich.objectsr   r   r   r    r!   r"   r#   dulwich.packr$   dulwich.hooksr%   r&   r'   r(   r)   dulwich.line_endingr*   dulwich.refsr+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r  r  r  r  REFSDIR_TAGSREFSDIR_HEADSr	  r  r\  r[  rR  r0  r,  rA   re  rj   r   r   r   r   r   r   r  r   r   r  r  r  ry  rS   rK   rH   <module>r     s  .  	 
   N N N 9#
 
 
     /    
	
			 LIlmIH  #!) !uS#X 0/'o /'Xc] /'e /'d, %	%e
B#tE4;,>'? #E #*.f $l
v l
^. wG8 wGt` `rK   