
    =                        d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZmZmZ e
rddlmZmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZ ddlmZ dd	l m!Z!m"Z"m#Z#m$Z$ dd
l%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z, ddl-m.Z. ddl/m0Z0m1Z1m2Z2m3Z3m4Z4 ddl5m6Z6 ddl7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZA ddlBZBdZCdZDdZEdZFdZGdZHdZIdZJdZKdgeEgeEeFgeEeGgdgdggZLdZM G d deN      ZOde	ePePf   fdZQd4d d!d"eeP   deRfd#ZSd$ ZTd%eeR   deeReeR   f   fd&ZUd%eeReeR   f   deRfd'ZVd( ZW G d) d*eX      ZY G d+ d,eX      ZZd- Z[ G d. d/eN      Z\ G d0 d1eZ      Z] G d2 d3eZ      Z^y)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                       e Zd ZdZd Zy)InvalidUserIdentityz1User identity is not of the format 'user <email>'c                     || _         y N)identity)selfrD   s     lib/third_party/dulwich/repo.py__init__zInvalidUserIdentity.__init__   s	         N__name__
__module____qualname____doc__rG    rH   rF   rA   rA      s
    ;!rH   rA   returnc                  r   dd l } dd l}| j                         }	 dd l}	 |j	                  |      j
                  }|j                  d      d   }|s|}t        j                  j                  d      }| dj                  ||j                               }||fS # t        $ r d }Y Vw xY w# t        $ r d }Y gw xY w)Nr   ,EMAILz{}@{})getpasssocketgetuserpwdgetpwnampw_gecossplitKeyErrorImportErrorosenvirongetformatgethostname)rS   rT   usernamerV   gecosfullnameemails          rF   _get_default_identityre      s     H
+	+LL*33E {{3'*HJJNN7#E}x););)=>e  	H	  s"   B( B B%$B%(B65B6configr   kindc                 P   d}d}|rpt         j                  j                  d|z   dz         }||j                  d      }t         j                  j                  d|z   dz         }||j                  d      }|	 | j                  dd      }|	 | j                  dd      }t               \  }}||j                  d      }||j                  d      }|j                  d	      r|j                  d
      r|dd }|dz   |z   d
z   S # t        $ r d}Y w xY w# t        $ r d}Y w xY w)aa  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namerd      <   >       <)r\   r]   r^   encoderZ   re   
startswithendswith)rf   rg   rm   rd   user_ucemail_ucdefault_userdefault_emails           rF   get_user_identityr{      sA   * DE**..$!89>>'*D::>>&4-(":;OOG,E|	::i0D }	JJy'2E #8"9L-|""7+}$$W-%.."6a%<%$&&  	D	
  	E	s$   :D D DDD%$D%c                 ~    	 | j                  dd      \  }}d|vrt        |       y# t        $ r t        |       w xY w)zVerify that a user identity is formatted correctly.

    Args:
      identity: User identity bytestring
    Raises:
      InvalidUserIdentity: Raised when identity is invalid
    rs   rq   rp   N)rY   
ValueErrorrA   )rD   fstsnds      rF   check_user_identityr      sP    ,>>%+S 3!(++   ,!(++,s   ' <graftpointsc                     i }| D ]Y  }|j                  dd      }|d   }t        |      dk(  r|d   j                         }ng }|g|z   D ]  }t        |d        |||<   [ |S )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
    Nrq   r      Invalid graftpoint)rY   lenr   )r   graftsline	raw_graftcommitparentsshas          rF   parse_graftpointsr      s}      FJJtQ'	1y>Ql((*GG8g%C23 & !v  MrH   c                     g }| j                         D ]?  \  }}|r'|j                  |dz   dj                  |      z          /|j                  |       A dj                  |      S )a  Convert 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       rF   serialize_graftpointsr     sb     K&,,.v}tyy/AABv&	 /
 ::k""rH   c                    t         j                  dk(  roddl}ddlm}m}m} d} |j                  |||      d|j                  j                  f      }t        | t              rt        j                  |       }  || |      syyy)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bytesr\   fsdecode)pathr   r   r   r   FILE_ATTRIBUTE_HIDDENr   s          rF   _set_filesystem_hiddenr     s     ||w88 !EV//guE!6==#9#9:
 dE";;t$D!$(=> ? rH   c                        e Zd Zi g fdZddZy)ParentsProviderc                 @    || _         || _        t        |      | _        y rC   )storer   setshallows)rE   r   r   r   s       rF   rG   zParentsProvider.__init__.  s    
HrH   Nc                     	 | j                   |   S # t        $ r Y nw xY w|| j                  v rg S || j                  |   }|j                  S rC   )r   rZ   r   r   r   )rE   	commit_idr   s      rF   get_parentszParentsProvider.get_parents3  sV    	;;y)) 		%I>ZZ	*F~~s    	rC   )rJ   rK   rL   rG   r   rN   rH   rF   r   r   -  s    %'" &
	rH   r   c                      e Zd ZdZdedefdZdefdZdeddfd	Z	d
 Z
d Zd Zd Zd3dZ	 	 d4dZ	 	 d4dZd4dZd5dZdeeef   fdZdefdZd ZdedefdZd Zd5dededee   fdZd Zd Zd Z d6dZ!d  Z"d! Z#d" Z$d5d#Z%d$ Z&d%edefd&Z'd%ed'e(eef   fd(Z)d%efd)Z*d5d*dd+e+defd,Z,d-eeee   f   fd.Z-g fd/ee   ddfd0Z.d1 Z/	 	 	 	 	 	 	 	 	 	 	 	 d7d2Z0y)8BaseRepozBase 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                 <    || _         || _        i | _        i | _        y)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>   )rE   r   r6   s      rF   rG   zBaseRepo.__init__H  s"     )	
rH   rO   c                 ,    t        | j                        )Probe the file-system to determine whether permissions can be trusted.

        Returns: True if permissions can be trusted, False otherwise.
        )NotImplementedError_determine_file_moderE   s    rF   r   zBaseRepo._determine_file_modeX  s    
 "$";";<<rH   bareNc                    ddl m} | j                  dd       t               } |       }|j	                  ddd       | j                         r|j	                  ddd	       n|j	                  ddd
       |j	                  dd|       |j	                  ddd	       |j                  |       | j                  d|j                                | j                  t        j                  j                  dd      d       y)z(Initialize a default set of named files.r   r   descriptions   Unnamed repositorycorerepositoryformatversion0filemodeTFr   logallrefupdatesrf   r?   excluderH   N)dulwich.configr   _put_named_filer   r   r   write_to_filegetvaluer\   r   r   )rE   r   r   fcfs        rF   _init_fileszBaseRepo._init_files_  s    -],ABI\
v0#6$$&FF6:t,FF6:u-
vvt$
v)40
Xqzz|4RWW\\&)<cBrH   c                 ,    t        | j                        )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.
        Returns: An open file object, or None if the file does not exist.
        )r   get_named_filerE   r   s     rF   r   zBaseRepo.get_named_filer  s     "$"5"566rH   c                 ,    t        | j                        )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   rE   r   contentss      rF   r   zBaseRepo._put_named_file  s     "$"6"677rH   c                 ,    t        | j                        )z:Delete a file in the contrl directory with the given name.)r   _del_named_filer   s     rF   r   zBaseRepo._del_named_file  s    !$"6"677rH   c                 ,    t        | j                        )Open the index for this repository.

        Raises:
          NoIndexPresent: If no index is present
        Returns: The matching `Index`
        )r   
open_indexr   s    rF   r   zBaseRepo.open_index  s     "$//22rH   c                     ||j                   j                  }| j                  ||j                         ||      \  }}|j                   j	                  |||       | j                         S )a=  Fetch 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)rE   targetdetermine_wantsr   r   count	pack_datas          rF   fetchzBaseRepo.fetch  sp     "$11EEO//##%	 0 
y 	))%HE}}rH   c                 D    | j                  |||||      }t        |      S )a  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$   )rE   r   graph_walkerr   
get_taggedr   r5   s          rF   r   zBaseRepo.fetch_pack_data  s1    0 $$\8Zu % 
 $G,,rH   c           
      H   |dvrt        d      i }| j                         j                         D ]C  \  }}	 | j                  |   }	t	        |	t
              r|	j                  d   ||t        z   <   |||<   E  ||      }
t	        |
t              st        d	      t        |d
t!                     }t        |dt!                     }|
g k(  r|s|ryg S | j                  j#                  |      }|s|rg }t%        | j                  |      fd}| j                  j'                  | j                  j)                  ||
| j+                         |||            S # t        $ rC t        j                  d|j                  dd      d|j                  d      t               Y ow xY w)a  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 yetrq   zref rk   replacez points at non-present sha asciiz'determine_wants() did not return a listshallow	unshallowN)r   c                 <    j                  | j                  |       S rC   r   id)r   parents_providers    rF   r   z+BaseRepo.fetch_objects.<locals>.get_parents  s    #//		6BBrH   )r   )r   r   r   r   r   r"   objectr+   rZ   warningswarndecodeUserWarninglist	TypeErrorgetattr	frozensetfind_common_revisionsr   	iter_shasfind_missing_objectsget_shallow)rE   r   r   r   r   r   r6   refr   objwantsr   
unshallowshavesr   r   s                  @rF   r   z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   EAF! F!c                 ^    | j                   j                  ||| j                         ||      S )a9  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   )rE   havewantr   r  s        rF   r  zBaseRepo.generate_pack_data  s:       33$$& 4 
 	
rH   c                    |D| j                   j                  d      j                         D cg c]  }|| j                  v r| }}t	        | j                        }t        ||j                  | j                               S c c}w )a  Retrieve 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   )rE   r8   r   r   s       rF   r   zBaseRepo.get_graph_walker0  s     =  99,,];BBDDC$+++ D  
 +4+<+<=%#//9I9I9K
 	
s   Bc                 6    | j                   j                         S )z^Get dictionary with all refs.

        Returns: A ``dict`` mapping ref names to SHA1s
        )r6   r  r   s    rF   r   zBaseRepo.get_refsE  s    
 yy  ""rH   c                      | j                   d   S )z#Return the SHA1 pointed at by HEAD.   HEAD)r6   r   s    rF   headzBaseRepo.headL  s    yy!!rH   c                 @   t        |      dv sJ | j                  |      }t        ||      sq|t        u rt	        |      |t
        u rt        |      |t        u rt        |      |t        u rt        |      t        d|j                  d|j                        |S )N   (   zType invalid: z != )r   
get_objectr   r    r   r   r   r#   r   r"   r   	Exception	type_name)rE   r   clsrets       rF   _get_objectzBaseRepo._get_objectP  s    3x8###ooc"#s#f}$S))"3''"3''!#&&03s}}M  
rH   r   c                      | j                   |   S )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   )rE   r   s     rF   r  zBaseRepo.get_objectb  s       %%rH   c                 b    t        | j                  | j                  | j                               S )N)r   r   )r   r   r   r   r   s    rF   r   zBaseRepo.parents_providerm  s-    $$%%'
 	
rH   r   c                 B    | j                         j                  ||      S )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   )rE   r   r   s      rF   r   zBaseRepo.get_parentst  s      $$&223??rH   c                 ,    t        | j                        )hRetrieve the config object.

        Returns: `ConfigFile` object for the ``.git/config`` file.
        )r   
get_configr   s    rF   r!  zBaseRepo.get_config  s    
 "$//22rH   c                 ,    t        | j                        )zRetrieve the description for this repository.

        Returns: String with the description of the repository
            as set by the user.
        )r   get_descriptionr   s    rF   r#  zBaseRepo.get_description       "$"6"677rH   c                 ,    t        | j                        )Set the description for this repository.

        Args:
          description: Text to set as description for this repository.
        )r   set_descriptionrE   r   s     rF   r'  zBaseRepo.set_description  r$  rH   r   c                 n    ddl m} | j                         g |j                         z   } |||d         S )a  Return 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)rE   r   backendss      rF   get_config_stackzBaseRepo.get_config_stack  s8     	1OO%&)G)G)G)IIX<<rH   c                     | j                  d      }|
t               S |5  t        d |D              cddd       S # 1 sw Y   yxY w)zRGet the set of shallow commits.

        Returns: Set of shallow commits.
        r   Nc              3   <   K   | ]  }|j                           y wrC   )strip).0r   s     rF   	<genexpr>z'BaseRepo.get_shallow.<locals>.<genexpr>  s     2tzz|s   )r   r   )rE   r   s     rF   r   zBaseRepo.get_shallow  s;    
 	*95L222 QQs	   <Ac           
          | j                         }|r|j                  |       |r|j                  |       | j                  ddj	                  |D cg c]  }|dz   	 c}             yc c}w )zUpdate the list of shallow objects.

        Args:
          new_shallow: Newly shallow objects
          new_unshallow: Newly no longer shallow objects
        r   rH   r   N)r   updatedifference_updater   r   )rE   new_shallownew_unshallowr   r   s        rF   update_shallowzBaseRepo.update_shallow  sa     ""$NN;'%%m4Y1Q##+1Q(RS1Qs   A*c                     | j                   j                  |      }||S | j                  j                  | j                   |         j                  S )a  Get 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   )rE   r   cacheds      rF   r:  zBaseRepo.get_peeled  sH     %%c*M  ))$))C.9<<<rH   c                      ddl m} | j                         g}t        |t              r|g} fd|d<    | j
                  |g|i |S )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                 <    j                  | j                  |       S rC   r   )r   rE   s    rF   <lambda>z%BaseRepo.get_walker.<locals>.<lambda>  s    t/?/?		6/RrH   r   )dulwich.walkr>  r  r   strr   )rE   includeargskwargsr>  s   `    rF   
get_walkerzBaseRepo.get_walker  sR    4 	(?yy{mGgs#iG R}d''B4B6BBrH   c                 2   t        |t              s!t        dt        |      j                  z        t        |      dv r	 | j                  |   S 	 | j                  | j                  |      S # t        t        f$ r Y .w xY w# t        $ r t        |      w xY w)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   typerJ   r   r   rZ   r}   r6   r   rE   rn   s     rF   __getitem__zBaseRepo.__getitem__  s     $&6d9L9LL  t9 ((..	!$$TYYt_55 j)   	!4. 	!s    A, B ,A>=A>Brn   c                     t        |      dk(  st        |      dk(  r)t        |      r|| j                  v xs || j                  v S || j                  v S )zuCheck if a specific Git object or ref is present.

        Args:
          name: Git object SHA1 or ref name
        r  r  )r   r   r   r6   rI  s     rF   __contains__zBaseRepo.__contains__	  sN     t9?s4yB<3E4,,,A		0AA499$$rH   valuec                     |j                  d      s|dk(  rUt        |t              r|j                  | j                  |<   yt        |t
              r|| j                  |<   yt        |      t        |      )z~Set a ref.

        Args:
          name: ref name
          value: Ref value - either a ShaFile object, or a hex sha
           refs/r  N)ru   r   r!   r   r6   r   r   r}   )rE   rn   rM  s      rF   __setitem__zBaseRepo.__setitem__  s^     ??8$%)"'((		$E5)"'		$&&T""rH   c                 `    |j                  d      s|dk(  r| j                  |= yt        |      )zORemove a ref.

        Args:
          name: Name of the ref to remove
        rO  r  N)ru   r6   r}   rI  s     rF   __delitem__zBaseRepo.__delitem__%  s,     ??8$		$T""rH   rf   rg   c                     t        |      S )z.Determine the identity to use for new commits.)r{   )rE   rf   rg   s      rF   _get_user_identityzBaseRepo._get_user_identity0  s     !((rH   updated_graftpointsc                     |j                         D ]  \  }}|g|z   D ]  }t        |d         | j                  j                  |       y)z{Add or modify graftpoints

        Args:
          updated_graftpoints: Dict of commit shas to list of parent shas
        r   N)r   r   r   r4  )rE   rU  r   r   r   s        rF   _add_graftpointszBaseRepo._add_graftpoints5  sN      388:OFGx')S"67 *  ; 	  !45rH   	to_removec                 ,    |D ]  }| j                   |=  y)zSRemove graftpoints

        Args:
          to_remove: List of commit shas
        N)r   )rE   rX  r   s      rF   _remove_graftpointszBaseRepo._remove_graftpointsC  s     C!!#& rH   c                     | j                  |      }|g S |5  |j                         D cg c]#  }|j                         s|j                         % c}cd d d        S c c}w # 1 sw Y   y xY wrC   )r   	readlinesr0  )rE   rn   r   r   s       rF   _read_headszBaseRepo._read_headsL  sW    %9I-.[[]K]TdjjlDJJL]K QK Qs"   A$AAA$A$$A-c           	         ddl }t               }|1| j                         }|j                  | j                        |_        n t        |      dk7  rt        d      ||_        	 |s| j                  d   j                          | j                         }|| j                  d      }|t        |d      }t!        |       ||_        | |j                          }t%        |      |_        |d}||_        |t        |d	      }||_        t!        |       ||}t%        |      |_        ||}||_        |		 |j1                  d
d      }	|	|	|_        |t        d      	 |r||_        n6| j                  d   j                  |      |_        |j4                  ||_        |
#||_        | j                  j9                  |       nu	 | j:                  |
   }|g|z   |_        | j                  j9                  |       | j:                  j=                  |
||j>                  d|z   |||      }|st        |
d      | jC                  d       	 | j                  d   j                          |j>                  S # t        $ r}t        |      d}~wt        $ r Y w xY w# t        $ r Y _w xY w# t        $ r}t        |      d}~wt        $ r ||_        Y 6w xY w# t        $ rT ||_        | j                  j9                  |       | j:                  jA                  |
|j>                  d|z   |||      }Y w xY w# t        $ r2}tE        jF                  d|z  tH               Y d}~|j>                  S d}~wt        $ r Y |j>                  S w xY w)a  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)rg   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   rZ   r-  r]  r{   r   rg  intcommit_timecommit_timezoneauthorauthor_timeauthor_timezoner^   encodingrf  r   
add_objectr6   set_if_equalsr   
add_if_newr   r   r   r   )rE   rf  rg  rq  commit_timestamprp  author_timestamprs  rl  rt  r   merge_heads	no_verifyrk  cr9   erf   old_headoks                       rF   	do_commitzBaseRepo.do_commitS  s   R 	H<OO%E\\$"3"34AF4yB !HIIAF	

<(002 &&(**=9K)&{CII&#(tyy{,-"O+>&vH=FF##/,-"-O+!::i1AB !AJ?:;;
	 #	 JJ|4<<WE	99$ 'AI ;#AI((+99S>%J4	!!,,Q/YY,,DD''1'., - (  ""EFF]+	JJ}%--/ ttC  	!a.  		@    	!a.  	 AI	 *  
'	!!,,Q/YY))DD''1'., * 
(  	JMM7!;[II tt  	tt	s   #I5 7J  A J, A$K L: 5	J>J		JJ	J)(J),	K5K  KKAL76L7:	N
M00N
	N
)NNNNNrC   )rO   r   )NNNNNNNNNr  NF)1rJ   rK   rL   rM   r   r-   rG   boolr   r   r   r   r   r   r   r   r   r  r   r   r   r   r  r  r!   r  r   r    r   r   r!  r#  r'  r-  r   r8  r:  rF  rJ  rL  r	   rP  rR  rB  rT  rW  rZ  r]  r  rN   rH   rF   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rH   r   c                     | j                         }|j                  d      st        d      |t        d      d j	                  d      S )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
)readru   r}   r   rstrip)r   css     rF   read_gitfiler    sD     
B==$ABBc*o ''--rH   c                       e Zd ZdZd Zy)UnsupportedVersionzUnsupported repository version.c                     || _         y rC   )version)rE   r  s     rF   rG   zUnsupportedVersion.__init__   s	    rH   NrI   rN   rH   rF   r  r    s
    )rH   r  c                      e Zd ZdZddZd Zedd       Zd Zd Z	d Z
d	 Zd
 Zd dZd Zd!dZd Zd Z	 	 	 	 d"dZd dZd#dZd Zd Zd Zed d       Zed$d       Zed%d       Zed&d       ZeZd Zd Zd Zd Z y)'RepozA 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           	      |	   t         j                  j                  |t              }| t         j                  j	                  |      sAt         j                  j                  t         j                  j                  |t                    rd}nt         j                  j                  t         j                  j                  |t                    rDt         j                  j                  t         j                  j                  |t                    rd}nt        dt        |      z        || _
        |du rtt         j                  j	                  |      rMt        |d      5 }t        |      }d d d        d| _
        t         j                  j                  |      | _        n|| _        n|| _        | j                  t              }|o|5  t         j                  j                  | j!                         t        j"                  |j%                         j'                  d                  | _        d d d        n| j                  | _        || _        | j+                         }	 t-        |j/                  dd            }	|	d	k7  rt3        |	      |Ft5        j6                  t         j                  j                  | j9                         t              |      }t;        | j9                         | j                  | j<                  
      }
t>        jA                  | ||
       i | _!        | j                  t         j                  j                  dd      | j9                               }|r/|5  | jB                  jE                  tG        |             d d d        | j                  d| j9                               }|r/|5  | jB                  jE                  tG        |             d d d        tI        | j!                               | jJ                  d<   tM        | j!                               | jJ                  d<   tO        | j!                               | jJ                  d<   tQ        | j!                               | jJ                  d<   y # 1 sw Y   xY w# 1 sw Y   KxY w# t0        $ r d	}	Y )w xY w# 1 sw Y   !xY w# 1 sw Y   xY w)NFT'No git repository was found at %(path)sr   rs   
r   r   r   loggerr?   r   )basedirr   r_  re  rj  zpost-receive))r\   r   r   
CONTROLDIRisfileisdir	OBJECTDIRREFSDIRr   dictr   openr  _controldirr   	COMMONDIR
controldirr   r  r  
_commondirr!  rn  r^   rZ   r  r   from_configr:   r0   _write_reflogr   rG   r   r4  r   r&   r>   r(   r'   r)   )rE   rootr   r   hidden_pathr   r   r:   rf   format_versionr6   
graft_files               rF   rG   zRepo.__init__  sm   ggll44<{+GGMM"'',,{I"FG''--T9 =>GGMM"'',,tW"=>&=$O  	5=ww~~k*+s+q'?D ,!	#%77<<d#; #. #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   Q9A$RR !%R%3%R29RRR"!R"%R/2R;c                 :   ddl m} t        j                  j	                  | j                         dt        j                  |            }		 t        j                  t        j                  j                  |	             |!| j                         }
| j                  |
      }t        |       |t        t        j                               }|d}t        |	d      5 }|j!                   |||||||      dz          d d d        y # t        $ r Y w xY w# 1 sw Y   y xY w)Nrq   )format_reflog_linelogsr   abr   )reflogr  r\   r   r   r  r   makedirsdirnameFileExistsErrorr-  rT  r   rn  rk  r  write)rE   r   old_shanew_sharg  rh  ri  rf  r  r   rf   r   s               rF   r  zRepo._write_reflogQ  s     	/ww||DOO-vr{{37GH	KK-. **,F//7II&DIIK(IH$GG"WiHg    		 s   
2D  D	DDDc                     d}t         j                  j                  |      }|r		  | |      S t        dt        |      z        # t        $ r% t         j                  j	                  |      \  }}Y nw xY w|rUM)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  )r\   r   abspathr   rY   r  )r  start	remainingr   s       rF   discoverzRepo.discoverk  sv     	wwu%64y  5%8HH
 	
 $ 6"$''--"5i6 s   A +A32A3c                     | j                   S )z)Return the path of the control directory.)r  r   s    rF   r  zRepo.controldir  s    rH   c                     | j                   S )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    rF   r:   zRepo.commondir  s     rH   c                 8   t         j                  j                  | j                  d      }t        |d      5 }|j	                  d       ddd       t        j
                  |      }	 t        j                  ||j                  t        j                  z         t        j
                  |      }t        j                  |       |j                  |j                  k7  }|j                  t        j                  z  dk7  }|xr |S # 1 sw Y   xY w# t        $ r Y yw xY w)r   z.probe-permissionsw NFr   )r\   r   r   r  r  lstatchmodst_modestatS_IXUSRPermissionErrorunlink)rE   fnamer   st1st2mode_differsst2_has_execs          rF   r   zRepo._determine_file_mode  s    
 TYY(<=%GGBK  hhuo	HHUCKK$,,67 hhuo
		%{{ckk1dll2q8,,   		s   D'1D D
	DDc                    |j                  t        j                  j                        }t	        t        j                  j                  | j                         |      d      5 }|j                  |       ddd       y# 1 sw Y   yxY w)r   wbN)lstripr\   r   sepr   r   r  r  )rE   r   r   r   s       rF   r   zRepo._put_named_file  sU     {{277;;'RWW\\$//"3T:DAQGGH BAAs   "A==Bc                     	 t        j                  t         j                  j                  | j	                         |             y # t
        $ r Y y w xY wrC   )r\   r  r   r   r  FileNotFoundErrorr   s     rF   r   zRepo._del_named_file  s;    	IIbggll4??#4d;<  		s   AA 	AAc                     || j                         }|j                  t        j                  j                        }	 t        t        j                  j                  ||      d      S # t        $ r Y yw xY w)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  r\   r   r  r  r   r  )rE   r   r  s      rF   r   zRepo.get_named_file  s^     ?oo'G{{277;;'	Wd3T::  		s   )A' '	A32A3c                 f    t         j                  j                  | j                         t              S )zReturn path to the index file.)r\   r   r   r  INDEX_FILENAMEr   s    rF   
index_pathzRepo.index_path  s    ww||DOO-~>>rH   c                 n    ddl m} | j                         s
t                || j	                               S )r   r   r   )dulwich.indexr   	has_indexr   r  )rE   r   s     rF   r   zRepo.open_index  s,     	(~~ ""T__&''rH   c                     | j                    S )zCheck if an index is present.r   r   s    rF   r  zRepo.has_index  s     99}rH   c                    t        j                  | j                        }t        |t              s|g}ddlm}m}m} | j                         }| j                         }|D ]#  }t        |t              st        j                  |      }t         j                  j                  |      rt        d|z         ||      }	t         j                  j                  ||      }
	 t        j                  |
      }t!        j"                  |j$                        s$t!        j&                  |j$                        s	 ||	=  ||
|      }|j+                  ||      }| j,                  j/                  |        |||j0                  d      ||	<   & |j5                          y# t(        $ r Y Dw xY w# t2        $ r 	 ||	= n# t(        $ r Y nw xY wY hw xY w)zpStage 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)r\   fsencoder   r   r   r  r  r  r  r   get_blob_normalizerr   isabsr}   r   r  r  S_ISREGr  S_ISLNKrZ   checkin_normalizer   ru  r   OSErrorr  )rE   fs_pathsroot_path_bytesr  r  r  r9   blob_normalizerfs_path	tree_path	full_pathstblobs                rF   stagez
Repo.stage  s    ++dii0(D) zH	
 	
 !224Ggu-++g.ww}}W% 46=>  )1I_g>IMXXi( ||BJJ/RZZ8P!), 39bAD*<<T7KD%%006'<R!'LE)$9  : 	 $   i( 	sH   F'2F	F$#F$'	G1F54G5	G>G GGGc                    |s| j                  ||      }n |rt        d      | j                  ||      }| j                  |       | j                  }t        |t              st        j                  |      }d|z   }|j                  j                  d|z   | j                  j                  d      |       |j                  j                  d| j                  j                  d      |       	 |j                  j                  t        | j                  t           |       |j                         }	|	j!                  dd	|       |	j!                  dd
d       |	j#                          | j                  j%                  d      \  }
}|
r?|=|j                  j'                  d|
d   |       ||d<   || }|r|j)                          |S # t        $ r Y w xY w)aB  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
  )rf  s	   refs/tags)remoteoriginurlr   z#+refs/heads/*:refs/remotes/origin/*r  rr   )initr}   	init_barer   r   r   r   r\   r  r6   import_refsr  rw  DEFAULT_REFrZ   r!  r   write_to_pathfollowset_symbolic_refreset_index)rE   target_pathr  r   r  checkoutr   encoded_pathref_messagetarget_config
head_chainhead_shas               rF   clonez
Repo.clone  s   $ YY{%Y8F !EFF^^Ku^=F

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

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

 	##%  $yy//8
H(.KK((*R.+(V&F7O#8""$/  		s   03G
 
	GGc                 R   ddl m}m}m} || d   j                  }| j                         }|j                  ddt        j                  dk7        }|j                  ddt        j                  dk(        r|}n|} || j                  | j                         | j                  |||      S )	zReset 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  r  rl  r!  get_booleanr\   rn   r   r  r   )rE   rl  r  r  r  rf   r  r  s           rF   r  zRepo.reset_indexX  s    	
 	
 <=%%D"++G["''T/Rg':BGGtOL$>!$A!$IIOO)"7
 	
rH   c                     ddl m} t        j                  j	                  | j
                  d      }	  |j                  |      S # t        $ r  |       }||_        |cY S w xY w)r   r   r   rf   )r   r   r\   r   r   r  	from_pathr  )rE   r   r   r  s       rF   r!  zRepo.get_configu  s[    
 	.ww||D,,h7	':''--  	,CCHJ	s   A A A c                     t         j                  j                  | j                  d      }	 t	        |d      5 }|j                         cddd       S # 1 sw Y   yxY w# t        $ r Y yw xY w)zsRetrieve the description of this repository.

        Returns: A string describing the repository or None.
        r   r  N)r\   r   r   r  r   r  r  )rE   r   r   s      rF   r#  zRepo.get_description  sU    
 ww||D,,m<	t$vvx %$$  		s.   A A	A AA A 	A*)A*c                      d| j                   z  S )Nz<Repo at %r>r  r   s    rF   __repr__zRepo.__repr__  s    		))rH   c                 (    | j                  d|       y)r&  r   N)r   r(  s     rF   r'  zRepo.set_description  s     	]K8rH   c                 l   t         D ]5  }t        j                  t        j                  j                  |g|        7 |7t        j                  t        j                  j	                  |t                    } | |||      }|j                  j                  dt               |j                  |       |S )N)r   r   r  )BASE_DIRECTORIESr\   r  r   r   r   r  r  r6   r  r  r   )r  r   r  r   r   dr  s          rF   _init_maybe_barezRepo._init_maybe_bare  s    !AHHRWW\\*1q12 "*//Z0STL$T=!!';7
rH   c                     |rt        j                  |       t         j                  j                  |t              }t        j                  |       t        |       | j                  ||d      S )zCreate a new repository.

        Args:
          path: Path in which to create the repository
          mkdir: Whether to create the directory
        Returns: `Repo` instance
        F)r\   r  r   r   r  r   r  )r  r   r  r  s       rF   r  z	Repo.init  sO     HHTNWW\\$
3

z*##D*e<<rH   c                     |rt        j                  |       |t         j                  j                  |      }t         j                  j	                  |j                         t              }t         j                  j	                  ||      }t         j                  j	                  |t              }t        |d      5 }|j                  dt        j                  |      z   dz          ddd       	 t        j                  |       	 t        j                  |       t        t         j                  j	                  |t              d      5 }|j                  t        j                  |      dz          ddd       t        t         j                  j	                  |t              d      5 }|j                  d       ddd       t        t         j                  j	                  |d      d      5 }|j                  |j                         dz          ddd        | |      }	|	j                          |	S # 1 sw Y   KxY w# t        $ r Y Dw xY w# t        $ r Y >w xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   hxY w)a6  Create 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)r\   r  r   basenamer   r  	WORKTREESr  r  r  r  r  GITDIRr  r  r  )
r  r   	main_repo
identifierr  main_worktreesdirworktree_controldir
gitdirfiler   r  s
             rF   _init_new_working_directoryz Repo._init_new_working_directory  s    HHTN))$/JGGLL)=)=)?K ggll+<j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   ;+H//H< I (I&I(*#I4/H9<	I	I		III%(I14I=c                 Z    |rt        j                  |       | j                  ||d|      S )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
        Tr  )r\   r  r  )r  r   r  r   s       rF   r  zRepo.init_bare  s,     HHTN##D$<#PPrH   c                 8    | j                   j                          y)z*Close any files opened by this repository.N)r   closer   s    rF   r!  z
Repo.close  s    !rH   c                     | S rC   rN   r   s    rF   	__enter__zRepo.__enter__  s    rH   c                 $    | j                          y rC   )r!  )rE   exc_typeexc_valexc_tbs       rF   __exit__zRepo.__exit__  s    

rH   c                 :    i }t        | j                         |      S )zReturn a BlobNormalizer object)r*   r-  )rE   git_attributess     rF   r  zRepo.get_blob_normalizer  s     d335~FFrH   r  ).rC   )rO   r   )TFs   originN)rO   r   )F)NF)FN)!rJ   rK   rL   rM   rG   r  classmethodr  r  r:   r   r   r   r   r  r   r  r  r   r  r!  r#  r  r'  r  r  r  r  creater!  r#  r(  r  rN   rH   rF   r  r    s    BMH4 
 
( -.	.?(0j @D
:
*9   = = # #J Q Q F"GrH   r  c                   ^    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
dd
Zd Zd Zed        Zy	)
MemoryRepozRepo 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                     ddl m} g | _        t        i | j                        }t
        j                  | t               |       i | _        d| _	         |       | _
        d | _        y )Nr   r   r  T)r   r   _reflogr.   _append_reflogr   rG   r   _named_filesr   _config_description)rE   r   refs_containers      rF   rG   zMemoryRepo.__init__  sT    -*2d6I6IJ$ 1 3^D	!| rH   c                 :    | j                   j                  |       y rC   )r1  r   )rE   rD  s     rF   r2  zMemoryRepo._append_reflog  s    D!rH   c                     || _         y rC   r5  r(  s     rF   r'  zMemoryRepo.set_description  s
    'rH   c                     | j                   S rC   r9  r   s    rF   r#  zMemoryRepo.get_description  s       rH   c                 (    t         j                  dk7  S )r   r   )r   r   r   s    rF   r   zMemoryRepo._determine_file_mode  s    
 ||w&&rH   c                 "    || j                   |<   y)r   N)r3  r   s      rF   r   zMemoryRepo._put_named_file   s     #+$rH   c                 >    	 | j                   |= y # t        $ r Y y w xY wrC   )r3  rZ   r   s     rF   r   zMemoryRepo._del_named_file)  s'    	!!$' 		s    	Nc                 V    | j                   j                  |d      }|yt        |      S )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-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)r3  r^   r   )rE   r   r  r   s       rF   r   zMemoryRepo.get_named_file/  s0     $$((t4x  rH   c                     t               )zFail to open index for this repo, since it is bare.

        Raises:
          NoIndexPresent: Raised when no index is present
        )r   r   s    rF   r   zMemoryRepo.open_index?  s     rH   c                     | j                   S )zKRetrieve the config object.

        Returns: `ConfigFile` object.
        )r4  r   s    rF   r!  zMemoryRepo.get_configG  s    
 ||rH   c                      |        }|D ]  }|j                   j                  |        |j                         D ]!  \  }}|j                  j	                  ||       # |j                  d       |S )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   ru  r   r6   rw  r   )r  r5   r6   r  r   refnamer   s          rF   r  zMemoryRepo.init_bareN  sd     eC'',  JJLLGSHH- )T"
rH   rC   )rJ   rK   rL   rM   rG   r2  r'  r#  r   r   r   r   r   r!  r,  r  rN   rH   rF   r/  r/    sM    	!"(!'+!   rH   r/  rC   )_rM   ior   r\   r   r  rk  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  r  r  r  rA   rB  re   r   r{   r   r   r   r   r   r   r   r  r  r  r/  rN   rH   rF   <module>rO     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` `rH   