+
    jHàjÝ§  ã                  óB  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
HtHtHtHt ^ RIHtHtHtHt ^ RIHt ]P,                  ! ]4      tRDt]tREtRFtR R ltR	 R
 ltRR/R R lltR R lt R R lt!R R lt"R R lt#R R lt$R R lt%RGt&R R lt'R R lt(RR/R R llt)R  R! lt*R" R# lt+R$ R% lt, ! R& R'4      t-R( R) lt.R* R+ lt/R, R- lt0R. R/ lt1R0 R1 lt2^t3R2t4R3 R4 lt5R5t6RHt7R6 R7 lt8R8 R9 lt9R: R; lt:R< R= lt;R> R? lt<R@ RA lt=RB RC lt>R# )Ia  Stale git lock-file and aborted-fetch pack-debris recovery for update/check paths.

A killed ``git fetch`` can leave ``.git/shallow.lock`` behind (every later fetch fails with "Unable to
create '.../shallow.lock': File exists") and ``tmp_pack_*`` files git itself never cleans up.)ÚannotationsN)ÚPath)ÚCallableÚIterableÚListÚOptional)ÚNO_LAZY_FETCH_ENVÚbounded_probe_runÚnoninteractive_git_envÚwindows_hide_flags)Úrun_gitc               ó   € V ^8„  d   QhRR/# )é   ÚreturnÚbool© )Úformats   "Ú7/home/ubuntu/.hermes/hermes-agent/hermes_cli/gitlock.pyÚ__annotate__r   +   s   € ÷ ñ ˜4ñ ó    c                 ó^  €  \         P                  R8X  d   . R
OM. ROp \        P                  ! V RRRR^
\	        4       RR7      p\         P                  R8X  d   RVP
                  P                  4       9   # VP                  ^ 8H  #   \         d    \        P                  RRR	7        R# i ; i)u¸   True when a ``git`` process is running â€” the check that stops us yanking a lock a live fetch holds.

A failed probe logs and returns False; the age floor in the sweep still applies.
ÚntTúutf-8ÚreplaceF)Úcapture_outputÚtextÚencodingÚerrorsÚtimeoutÚcreationflagsÚcheckzgit.exez1git process probe failed; assuming no git running©Úexc_info)Útasklistz/FIzIMAGENAME eq git.exez/FOÚCSV)Úpgrepz-xÚgit)ÚosÚnameÚ
subprocessÚrunr   ÚstdoutÚlowerÚ
returncodeÚ	ExceptionÚloggerÚdebug)ÚargvÚprocs     r   Ú_git_proc_runningr3   +   sž   € ð
ô
 —7‘7˜d”?ó JÚ(>ð 	ä�~Š~˜d°4¸dÈWÐ]fØ')Ô9KÓ9MÐUZô\ˆä�7‰7�dŒ?Ø §¡× 1Ñ 1Ó 3Ñ3Ð3Ø�‰ !Ñ#Ð#øÜô Ü�‰ÐHÐSWˆÔXÚðús   ‚A4B Á7B Â"B,Â+B,c               ó4   € V ^8„  d   QhRRRRRRRRR	R
RRRR/# )r   Ú	directoryr   Ú
candidateszCallable[[], Iterable[Path]]Úmin_age_secondsúOptional[int]Údefault_ageÚintÚskip_msgÚstrÚlog_removedzCallable[[Path, int], None]r   ú	list[str]r   )r   s   "r   r   r   @   sC   € ÷ ñ ˜Dð Ð.Jð Ð`mð Ø!ðØ-0ðØ?ZðØ_hñr   c               ó²  € V P                  4       '       g   . # \        4       '       d   \        P                  V4       . # \        P                  ! 4       Ve   TMT,
          p. pV! 4        F¨  p VP                  4       '       d�   VP                  4       ;p	P                  V8  dl   \        P                  R8X  d    \        P                  ! VR4       VP                  4        VP                  \        V4      4       V! W‰P                  4       K¦  K¨  Kª  	  V#   \         d     LSi ; i  \         d"   p
\        P!                  RYŠ4        Rp
?
Kæ  Rp
?
ii ; i)zSShared guard + age-floor sweep. Never raises; skips anything it cannot stat/unlink.Nr   i¶  z!Could not clear %s (skipping): %s)Úis_dirr3   r/   r0   ÚtimeÚis_fileÚstatÚst_mtimer'   r(   ÚchmodÚOSErrorÚunlinkÚappendr<   Úst_sizeÚwarning)r5   r6   r7   r9   r;   r=   ÚcutoffÚremovedÚentryÚstÚexcs   &&$$$$     r   Ú_sweep_stalerP   @   s  € ð ×Ñ×ÒØˆ	Ü×ÒÜ�‰�XÔØˆ	Ü�YŠY‹[¨Ò/J™OÐP[Õ\€FØ€GÙ–ˆð	LØ�}‰}�Š¨%¯*©*«,Ð$6 B×#@Ñ#@À6Ô#IÜ—7‘7˜d”?ðÜŸš ¨Ô.ð —‘”Ø—‘œs 5›zÔ*Ù˜E§:¡:Ö.ñ $J‰ñ ð$ €Nøô #ô Ùðûô
 ô 	Lô �N‰NÐ>À×KÒKûð	Lús=   Á/AD*Â<DÃ<D*ÄD'Ä$D*Ä&D'Ä'D*Ä*EÄ5EÅEr7   c               ó$   € V ^8„  d   QhRRRRRR/# ©r   Ú	repo_rootr   r7   r8   r   r>   r   )r   s   "r   r   r   _   s"   € ÷ ñ  Tð ¸}ð ÐXañ r   c          	     ó\   a€ \        V 4      R,          o\        SV3R lV\        RR R7      # )a,  Remove abandoned ``.git`` lock files under ``repo_root``; returns the removed paths.

Removes only when older than the age floor AND no git process is running. Never raises: a lock we cannot
stat/unlink is skipped (it may have been re-created between the age check and the unlink; skipping is safe).
ú.gitc                 óH   <€ \          U u. uF  p SV ,          NK  	  up # u up i ©N)Ú
LOCK_NAMES)r(   Úgit_dirs    €r   Ú<lambda>Ú'clear_stale_git_locks.<locals>.<lambda>g   s   ø€ µZÓ@±Z¨T˜' DŸ.˜.±ZÒ@ùÒ@s   Šz.git process running; skipping stale-lock sweepc                ó.   € \         P                  R V 4      # )zRemoved stale git lock %s©r/   Úinfo)ÚpÚ_sizes   &&r   rZ   r[   j   s   € ¤V§[¡[Ð1LÈaÔ%Pr   ©r7   r9   r;   r=   )r   rP   ÚSTALE_LOCK_MIN_AGE_SECONDS)rS   r7   rY   s   &$@r   Úclear_stale_git_locksrc   _   s2   ø€ ô �9‹o Õ&€GÜØÔ@Ø'Ô5OØAÙPô	ð r   c               ó    € V ^8„  d   QhRRRR/# ©r   rS   r   r   r   r   )r   s   "r   r   r   n   s   € ÷ Añ A tð A°ñ Ar   c                ó<  € ^ RI HpHpHp \	        V 4      pV! V4      pVR,          pVP                  4       '       d   V! V4      P                  4       '       d   R# \        V4      '       g   R# \        P                  R8X  d   \        V4      RJd   R# V! WTRR7      # )aê  Drop ``.git/index.lock`` when the git that took it is proven gone, whatever its age.

A git killed while it held the index lock (an update's tree killed by the user, a probe killed
by its own timeout) leaves it behind, and every later merge/stash/reset refuses with "File
exists". The age floor above keeps such a lock for 10 minutes, so the next ``hermes update``
died at its fast-forward (#132089; the Windows crash cell ``mid_fetch``).

Two conditions, both required. A killed update run must be behind the lock
(:func:`_killed_update_owns`): necessary, never sufficient, since a user's ``git commit`` can take
the lock after that run died. And no git of ANY form may be working in this checkout: a
``git commit`` waiting in the editor has closed its lock fd, so an absent fd proves nothing, and
it runs as ``git``, a dashed ``git-commit``, an alias or ``git.exe``. Linux reads every process's
cwd, path arguments and ``GIT_DIR`` through /proc (``_early_recovery._held_open`` with
``any_git``); macOS keeps the lock while any git runs (``ps`` cannot say where); Windows scans
with psutil (:func:`_windows_git_in_checkout`). Whatever cannot be read keeps the lock. An
interrupted tree move owns its own lock judgement, so its marker defers to that repair.
)Ú_git_dirÚ_release_dead_index_lockÚinterrupted_pull_markerú
index.lockFr   T)Úany_git)
Úhermes_cli._early_recoveryrg   rh   ri   r   ÚexistsÚ_killed_update_ownsr'   r(   Ú_windows_git_in_checkout)rS   rg   rh   ri   ÚrootrY   Úlocks   &      r   Úrelease_dead_index_lockrr   n   s   € ÷$ gÑfä�	‹?€DÙ�t‹n€GØ�\Õ!€DØ�;‰;�=Š=Ñ3°DÓ9×@Ñ@×BÒBÙÜ˜t×$Ò$ÙÜ	‡w�w�$„Ô3°DÓ9ÀÓFÙÙ# G¸4Ô@Ð@r   c               ó    € V ^8„  d   QhRRRR/# )r   ÚvalueÚobjectr   zOptional[float]r   )r   s   "r   r   r   Ž   s   € ÷ ñ ˜ð  Oñ r   c                ó�   € ^ RI H p  VP                  \        V 4      4      P                  4       #   \        \
        3 d     R# i ; i)é    )ÚdatetimeN)rx   Úfromisoformatr<   Ú	timestampÚ	TypeErrorÚ
ValueError)rt   rx   s   & r   Ú_receipt_timer}   Ž   s?   € Ý!ðØ×%Ñ%¤c¨%£jÓ1×;Ñ;Ó=Ð=øÜ”zÐ"ô Úðús   ˆ'0 °AÁAc               ó    € V ^8„  d   QhRRRR/# )r   rq   r   r   r   r   )r   s   "r   r   r   —   s   € ÷ -gñ -g˜dð -g tñ -gr   c                ó@  € ^ RI p^ RIHp  V P                  4       P                  p. p TP                  4        Ff  pTP                  R4       FN  p TP                  TP                  RR7      4      p\        T\        4      '       g   K=  TP                  T4       KP  	  Kh  	  TP                  4       p\        T\        4      '       d   TP                  T4       / p	T F§  p\        TP!                  R4      4      p
T
e   Y£8”  d   K)  \#        TP!                  R4      ;'       g    \%        T4      4      pT	P!                  T4      pTe8   T^,          P!                  R	4      R9   g   KŠ  TP!                  R	4      R9  g   K¢  Y§3Y›&   K©  	  T	'       g   R# \'        T	P)                  4       R
 R7      w  rÞTP!                  R	4      R9   ;'       d    TP+                  T4      '       * #   \
         d     R# i ; i  \
        \        3 d     EK½  i ; i  \
         d     ELyi ; i)aÀ  The last update run that started before ``lock`` was written died unfinished, its processes gone.

Read from the durable per-run records (read-only), not only ``latest.json``: a retry that kept
the then-live lock and failed replaced ``latest.json``, and the killed run's evidence must
still stand once the lock's git is gone. A run that started after the lock was written cannot
have left it, so a later run never discharges an earlier killed one.
N)Úupdate_receiptFzupdate_*.jsonú	utf-8-sig©r   Ú
started_atÚ	update_idÚoutcomec                ó   € V ^ ,          # )rw   r   )r*   s   &r   rZ   Ú%_killed_update_owns.<locals>.<lambda>Ã   s   € ¸¸A¾r   )Úkey)ÚrunningÚinterrupted)ÚjsonÚ
hermes_clir€   rC   rD   rF   Ú_receipt_dirsÚglobÚloadsÚ	read_textr|   Ú
isinstanceÚdictrH   Úread_latest_receiptr}   Úgetr<   ÚidÚmaxÚvaluesÚ_owner_alive)rq   r‹   r€   ÚwrittenÚrecordsr5   ÚpathÚrecordÚlatestÚrunsÚstartedrˆ   ÚheldÚ_startedÚlasts   &              r   rn   rn   —   sÍ  € ó å)ðØ—)‘)“+×&Ñ&ˆð €Gð
Ø'×5Ñ5Ö7ˆIØ!Ÿ™ Ö7�ðØ!ŸZ™Z¨¯©À¨Ó(LÓM�Fô ˜f¤d×+Ô+Ø—N‘N 6Ö*ó 8ñ 8ð ×/Ñ/Ó1€FÜ�&œ$×ÒØ�‰�vÔØ*,€DÛˆÜ §
¡
¨<Ó 8Ó9ˆØŠ?˜gÔ/ÙÜ�&—*‘*˜[Ó)×7Ð7¬R°«ZÓ8ˆØ�x‰x˜‹}ˆàŠ<˜D �GŸK™K¨	Ó2Ð6PÖPØ &§
¡
¨9Ó 5Ð=WÖ WØ Ð)ˆD‹Iñ ÷ ÙÜ˜Ÿ™›Ñ,>Ô?�N€HØ�8‰8�IÓÐ"<Ñ<×fÐfÀ^×E`ÑE`ÐaeÓEfÔAfÐføô? ô Úðûô  ¤Ð,ô Ûðûô ô ÚðúsL   ŒG# ©'H Á!G5Á2H Â
H Ç#G2Ç1G2Ç5HÈH È
HÈH ÈHÈHc               ó    € V ^8„  d   QhRRRR/# )r   rp   r   r   zbool | Noner   )r   s   "r   r   r   Ç   s   € ÷ !ñ ! 4ð !¨Kñ !r   c                ó°  € ^ RI HpHpHpHpHpHp  ^ RIpT! Y! \        T 4      4      4      p TP                  . RO4       EFg  p	T	P                  p
T
P                  R4      \        P                  ! 4       8X  d   K;  T
P                  R4      ;'       g    R Uu. uF  q»'       g   K  \        T4      NK  	  ppT! T
P                  R4      ;'       g    R4      f    T'       d   T! T^ ,          4      '       g   K¹  T! T;'       g    T
P                  R4      ;'       g    R.4      T9   d   Kì  T
P                  R4      pT! T;'       g    T
P                  R4      ;'       g    R	.YÚP                  R4      T4      '       d    R
# T'       d   EKN  T	P!                  4       '       g   EKg   R# 	  R#   \         d     R# i ; iu upi   \"         d     R# i ; i)aá  Whether any git (``git.exe``, a dashed ``git-<sub>.exe``) works in ``root``; None when unknowable.

Works in: its cwd, a path argument or a ``GIT_DIR``-style variable is inside the checkout or
its git dir, compared by path components (``hermes-backup`` is not inside ``hermes``). Scoped to
the checkout: a system-wide check would keep the lock whenever any editor or terminal elsewhere
runs git, which on Windows is most of the time. A git whose cwd cannot be read keeps the lock.
)Ú_NEVER_LOCKSÚ_checkout_placesrg   Ú_git_programÚ_git_subcommand_ofÚgit_works_inNÚpidr(   ÚcwdÚcmdlineÚenvironÚ r&   TF)rª   r(   r«   r¬   r­   r   )rl   r¥   r¦   rg   r§   r¨   r©   ÚpsutilÚImportErrorr   Úprocess_iterr^   r”   r'   Úgetpidr<   Ú
is_runningr.   )rp   r¥   r¦   rg   r§   r¨   r©   r¯   Úplacesr2   r^   ÚaÚargsr«   s   &             r   ro   ro   Ç   s„  € ÷)÷ )ðÛñ ˜d H¬T°$«ZÓ$8Ó9€FðØ×'Ñ'Ò(T×UˆDØ—9‘9ˆDØ�x‰x˜‹¤"§)¢)£+Ô-ÙØ$(§H¡H¨YÓ$7×$=Ð$=¸2Ð$=ÓCÑ$=˜qÃ”F”C˜–FÑ$=ˆDÐCÙ˜DŸH™H VÓ,×2Ð2°Ó3Ò;ÇTÉlÐ[_Ð`aÕ[b×NcÒNcÙÙ! $×"BÐ"B¨4¯8©8°FÓ+;×+AÐ+A¸rÐ*BÓCÀ|ÔSÙØ—(‘(˜5“/ˆCÙ˜D×?Ð? T§X¡X¨fÓ%5×%>Ð%>¸Ð$?ÀÇhÁhÈyÓFYÐ[a×bÒbÚß’3˜4Ÿ?™?×,Õ,Úñ Vñ  øô) ô Úðüò Døô ô Úðúsƒ   ’F/ ®A%G ÂG Â	GÂ'GÂ6G ÃG Ã#G Ã8G ÄG Ä*G Å	G Å" G ÆG ÆG Æ(G Æ+G Æ/F>Æ=F>ÇG ÇGÇGc               ó    € V ^8„  d   QhRRRR/# )r   rS   r   r   r   )r   s   "r   r   r   ë   s   € ÷ Sñ S˜ð S $ñ Sr   c                óˆ   € \        V 4      R ,          pVP                  4       '       d   TM
\        V 4      R,          R,          # )rU   ÚobjectsÚpack)r   r@   )rS   rY   s   & r   Ú	_pack_dirr»   ë   s2   € Ü�9‹o Õ&€GØ—~‘~×'Ò'‰G¬T°)«_À	ÕIÈFÕRÐRr   c               ó    € V ^8„  d   QhRRRR/# ©r   rS   r   r   r:   r   )r   s   "r   r   r   ð   s   € ÷ ñ ¨Dð °Sñ r   c                ó˜  € ^ p\        V 4      P                  R4       F;  pVP                  R4      p \        VR4      ;_uu_ 4        V^,          pRRR4       K=  	  V'       d   \        P                  RW4       V#   + '       g   i     Kp  ; i  \         d     K�  \
         d"   p\        P                  RY$4        Rp?K§  Rp?ii ; i)a"  Give every pack without a ``.promisor`` marker one; returns how many were marked.

git 2.53+ ``index-pack --promisor`` hands objects that sit outside promisor packs to
pack-objects, which BUG()s on the missing objects they lead to (#124272). Unmarked packs in a
partial clone come from a filtered fetch that turned a full or depth-limited clone partial (the
old packs keep no marker) and from checkouts that lost their markers. The marker only tells git
that objects those packs link to may be fetched on demand; nothing is rewritten or deleted.
zpack-*.packz	.promisorÚxbNz-Could not mark %s as a partial-clone pack: %sz.Marked %d pack(s) in %s as partial-clone packs)	r»   rŽ   Úwith_suffixÚopenÚFileExistsErrorrF   r/   rJ   r^   )rS   Úmarkedrº   ÚmarkerrO   s   &    r   Úmark_unmarked_packs_promisorrÅ   ð   sª   € ð €FÜ˜)Ó$×)Ñ)¨-Ö8ˆØ×!Ñ! +Ó.ˆð	WÜ�f˜d×#Õ#Ø˜!•�÷ $Ñ#ñ 9÷ Ü�‰ÐDÀfÔXØ€M÷ $×#Ð#ûäô 	ÚÜô 	Wä�N‰NÐJÈD×VÒVûð	WúsA   ²BÁ
A<ÁBÁ<BÂBÂBÂC	ÂC	Â'C	Â(CÃC	c               ó    € V ^8„  d   QhRRRR/# ©r   rS   r   r   ÚNoner   )r   s   "r   r   r     s   € ÷ Oñ O¨dð O°tñ Or   c                óv  € \        V 4       \         Fz  w  r \        R.RRRV.\        V 4      RRRR^\	        4       R7	      P
                  P                  4       pW28X  d   KP  \        R.RRW.\        V 4      RRRRR^\	        4       R	7
       K|  	  R#   \         d    \        P                  R
YT 4        K¥  i ; i)aH  Keep git from writing a commit-graph in a partial clone, from gc, fetch or maintenance.

Idempotent (a value already in place is not rewritten, so concurrent git never meets a config
lock from this) and never raises: a read-only config must not turn fetch recovery into a
traceback, matching mark_unmarked_packs_promisor above.
r&   Úconfigú--localú--getTr   r   ©r«   r   r   r   r   r   r   )r«   r    r   r   r   r   r   r   zCould not set %s=%s in %sN)
Ú!_migrate_earlier_maintenance_keysÚ_TREE0_MAINTENANCE_OFFr   r<   r   r+   Ústripr.   r/   rJ   )rS   rˆ   rt   Úcurrents   &   r   Údisable_tree0_auto_maintenancerÒ     sÀ   € ô & iÔ0ß,‰
ˆð	OÜØ�˜( I¨w¸Ð<Ü˜	“N°4¸dØ ¨¸BÜ0Ó2ô	÷
 ‰f—U‘U“Wð ð ÔÙÜØ�˜( I¨sÐ:Ü˜	“N¨$Ø#¨$Ø ¨¸BÜ0Ó2÷ó -øô" ô 	OÜ�N‰NÐ6¸ÀI×Nð	Oús   ˜ABÁ"*BÂ"B8Â7B8c               ó    € V ^8„  d   QhRRRR/# rÇ   r   )r   s   "r   r   r   5  s   € ÷ Vñ V°ð V¸$ñ Vr   c                ó�  €  \        R \        V . RO4       4       4      pVP                  R4      R8w  g   VP                  R4      R8w  g   RV9   d   R# VP                  R	4      R
8X  d   RMR F+  p\        R.RRRV.\	        V 4      RR^\        4       R7       K-  	  R#   \         d    \        P                  RT 4        R# i ; i)a^  Undo what earlier cuts of _TREE0_MAINTENANCE_OFF persisted, once.

``maintenance.auto=false`` switched off git's own post-fetch fold (git <= 2.53) and the first
cut's ``gc.auto=0`` turns ``gc --auto``, the update's own fold, into a no-op. Nothing records
who wrote them, so they are removed only under the earlier cuts' fingerprint: both wrote
``maintenance.auto=false`` together with ``fetch.writeCommitGraph=false``, and neither wrote
``maintenance.commit-graph.enabled``. The first pass of disable_tree0_auto_maintenance writes
that key, so this runs once; an operator's own lone setting never matches.
c              3  óD   "  € T F  qP                  R ^4      x € K  	  R # 5irW   )Úsplit©Ú.0Úlines   & r   Ú	<genexpr>Ú4_migrate_earlier_maintenance_keys.<locals>.<genexpr>@  s'   é € ð lñ 6k¨T—Z‘Z  a×(Ð(ó 6kùs   ‚ rÊ   rË   úmaintenance.autoÚfalsezfetch.writecommitgraphú maintenance.commit-graph.enabledNúgc.autoÚ0r&   z--unsetT)r«   r    r   r   r   z0Could not migrate earlier maintenance keys in %s)rÊ   rË   z--get-regexpzY^(maintenance\.auto|maintenance\.commit-graph\.enabled|fetch\.writecommitgraph|gc\.auto)$)rÜ   rß   )rÜ   )	r’   Ú_git_stdout_linesr”   r   r<   r   r.   r/   rJ   )rS   Úlocalrˆ   s   &  r   rÎ   rÎ   5  sÑ   € ðVÜñ lÔ5FÀyò Sjô 6kó ló lˆð �I‰IÐ(Ó)¨WÔ4¸¿	¹	ÐBZÓ8[Ð_fÔ8fØ5¸Ô>ÙØ6;·i±iÀ	Ó6JÈcÔ6QÑ2ÐWlÒlˆCÜØ�˜( I¨y¸#Ð>Ü˜	“N¨$¸tÈRÜ0Ó2÷ó møô ô VÜ�‰ÐIÈ9×UðVús   ‚AB  ÁA	B  Â !CÃCc               ó$   € V ^8„  d   QhRRRRRR/# rR   r   )r   s   "r   r   r   P  s"   € ÷ ñ  Tð ¸}ð ÐXañ r   c          	     óR   a€ \        V 4      oV3R lp\        SVV\        RR R7      # )u  Remove aborted-transfer temp pack files; same contract as clear_stale_git_locks.

Resolves ``.git/objects/pack`` for a checkout and ``objects/pack`` for a bare repo such as
the checkpoint store â€” a ``git gc`` killed by a timeout strands the same debris there.c                 óÂ   <€  SP                  4        U u. uF+  q P                  P                  \        4      '       g   K)  V NK-  	  up # u up i   \         d    . u # i ; irW   )Úiterdirr(   Ú
startswithÚ_TMP_PACK_PREFIXESrF   )ÚeÚpack_dirs    €r   Ú_candidatesÚ*clear_stale_tmp_packs.<locals>._candidatesW  sQ   ø€ ð	Ø'×/Ñ/Ô1Ó[Ñ1˜!·V±V×5FÑ5FÔGY×5Z—A�AÑ1Ñ[Ð[ùÒ[øÜô 	ØŠIð	ús(   ƒA •&A	Á A	ÁA Á	A ÁAÁAz,git process running; skipping tmp-pack sweepc                ó.   € \         P                  R W4      # )z/Removed aborted-fetch pack debris %s (%d bytes)r]   )r_   Úsizes   &&r   rZ   Ú'clear_stale_tmp_packs.<locals>.<lambda>a  s   € ¤F§K¡KÐ0aÐcdÔ$kr   ra   )r»   rP   ÚSTALE_TMP_PACK_MIN_AGE_SECONDS)rS   r7   rë   rê   s   &$ @r   Úclear_stale_tmp_packsrñ   P  s4   ø€ ô
 ˜Ó#€Hõô Ø�+Ø'Ô5SØ?Ùkô	ð r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   rS   r   r¶   r>   r   r   )r   s   "r   r   r   e  s!   € ÷ ñ  ð ¨Yð ¸9ñ r   c                óx  €  \        R.. VO\        V 4      RRRR^
\        4       R7	      pVP                  ^ 8w  d   . # VP                  P                  4        Uu. uF*  q3P                  4       '       g   K  VP                  4       NK,  	  up# u upi   \         d    \        P                  RTRR7       . u # i ; i)z>Run a read-only git query in ``repo_root``; [] on any failure.r&   Tr   r   rÍ   zgit query failed: %sr!   )
r   r<   r   r-   r+   Ú
splitlinesrÐ   r.   r/   r0   )rS   r¶   ÚresultrÙ   s   &&  r   rá   rá   e  s¥   € ðÜØˆG�W�t�W¤# i£.Ø d°WÀYÐXZÜ,Ó.ô
ˆð
 ×Ñ Ô!ØˆIØ)/¯©×)AÑ)AÔ)CÓTÑ)C ÇzÁzÇ|”�—
‘
–Ñ)CÑTÐTùÒTøÜô Ü�‰Ð+¨T¸DˆÔAØŠ	ðús.   ‚:B ½B ÁBÁ5BÂ	B ÂB Â%B9Â8B9c               ó$   € V ^8„  d   QhRRRRRR/# )r   rS   r   r6   r>   r   zset[str]r   )r   s   "r   r   r   u  s&   € ÷ Eñ E dð E¸	ð EÀhñ Er   c           
     óÎ  € V'       g   \        4       #  / p\        4       pRP                  V4      R,           p\        R.RR.\        V 4      VP	                  4       R^\        4       R7      pVP                  ^ 8w  d   \        4       # VP                  p^ pV EFq  pVP                  RV4      p	V	^ 8  d   \        4       u # WgV	 P                  4       p
V	^,           p\        V
4      ^8¼  dô   V
^,          R8X  dæ   \        V
^,          4      pWgW{,            pW{,          pWgV^,            R8w  d   \        4       u # V^,          p\        4       pVP                  R4       Fe  pV'       g    M\VP                  4       p\        V4      ^8¼  g   K/  V^ ,          R	8X  g   K?  VP                  V^,          P                  4       4       Kg  	  WÒV&   VP                  V4       EKG  \        V
4      ^8  g   V
^,          R
8w  g   EKh  \        4       u # 	  V'       g   \        4       # \        R.RR.\        V 4      RP                  \        V4      4      R,           P	                  4       R^
\        4       R7      pVP                  ^ 8w  d   \        4       # VP                  P                  RR7      P!                  4        Uu0 uF3  pVP#                  R4      '       g   K  VP                  4       ^ ,          kK5  	  ppVP%                  4        UUu0 uF  w  pqÝV,          '       g   K  VkK  	  upp# u upi u uppi   \&         d&    \(        P+                  RT RR7       \        4       u # i ; i)uâ   Return local commit objects whose parent objects are missing.

Parents are read from the commit *header* only (lines before the first blank
line) â€” a ``parent <sha>`` line inside a commit message body is prose, not
an edge.
Ú
r&   zcat-filez--batchT)r«   Úinputr   r   r   ó   
s   commits   parents   missingz--batch-checkr   )r   z missingz!parent-object probe failed for %sr!   )ÚsetÚjoinr   r<   Úencoder   r-   r+   ÚfindrÖ   Úlenr:   ÚaddÚdecodeÚupdateÚsortedrô   ÚendswithÚitemsr.   r/   r0   )rS   r6   Úparents_by_commitÚparentsÚrequestrõ   ÚdataÚcursorÚ	candidateÚ
header_endÚheaderrî   ÚbodyÚcommit_parentsrÙ   Úfieldsr    ÚmissingÚcommits   &&                 r   Ú_batch_missing_parentsr  u  sß  € ÷ Ü‹uˆð<ØÐÜ“%ˆØ—)‘)˜JÓ'¨$Õ.ˆÜØˆG�j )Ð,Ü�I“Ø—.‘.Ó"ØØÜ,Ó.ô
ˆð ×Ñ Ô!Ü“5ˆLØ�}‰}ˆØˆÜ#ˆIØŸ™ 5¨&Ó1ˆJØ˜AŒ~Ü“u’Ø Ð,×2Ñ2Ó4ˆFØ !•^ˆFÜ�6‹{˜aÔ F¨1¥I°Ô$:Ü˜6 !�9“~�Ø 6¥=Ð1�Ø•�Ø˜v¨�zÐ*¨eÔ3Ü›5’LØ˜!•�Ü!$£�Ø ŸJ™J uÖ-�DßÙØ!ŸZ™Z›\�FÜ˜6“{ aÖ'¨F°1­I¸Ö,BØ&×*Ñ*¨6°!­9×+;Ñ+;Ó+=Ö>ñ .ð 0> )Ñ,Ø—‘˜~×.Ü�V“˜q” F¨1¥I°×$;Ü“u’ñ/ $÷0 Ü“5ˆLÜØˆG�j /Ð2Ü�I“Ø—9‘9œV G›_Ó-°Õ4×<Ñ<Ó>ØØÜ,Ó.ô
ˆð ×Ñ˜qÔ Ü“5ˆLð Ÿ™×+Ñ+°9Ð+Ó=×HÑHÔJó
áJ�Ø�}‰}˜Z×(ô ˆD�J‰J‹L˜�OˆOÙJð 	ð 
ð
 6G×5LÑ5LÔ5NÔkÑ5NÑ1˜6 >Ðcj×RjÑRj—�Ñ5NÒkÐkùò
ùó
 løÜô Ü�‰Ð8¸)ÈdˆÔSÜ‹uŠðús|   ”A2L4 Â8L4 Ã A8L4 Ä9AL4 ÆL4 ÆAL4 Ç?L4 È	L4 È	L4 ÈA-L4 Ê,L4 Ê9L)ËL)Ë2L4 ÌL.ÌL.Ì%L4 Ì)L4 Ì4-M$Í#M$c               ó    € V ^8„  d   QhRRRR/# )r   rS   r   r   zOptional[Path]r   )r   s   "r   r   r   ½  s   € ÷ <ñ < $ð <¨>ñ <r   c                óè   € \        V . RO4      pV'       g   R# \        V^ ,          4      pVP                  4       '       g   \        V 4      V^ ,          ,          pVP                  4       '       d   V# R# )zAResolve ``.git/shallow`` via git, or None when the repo has none.N)ú	rev-parsez
--git-pathÚshallow)rá   r   Úis_absoluterB   )rS   Úshallow_relÚshallow_paths   &  r   Ú_shallow_file_pathr  ½  s]   € ä# IÒ/UÓV€KßÙÜ˜ A�Ó'€LØ×#Ñ#×%Ò%Ü˜I“¨°Q­Õ7ˆØ'×/Ñ/×1Ò1ˆ<Ð;°tÐ;r   c                  ó>   € ] tR tRtRtR R ltR R ltR R ltR	tR
# )Ú_ShallowLockiÈ  zÒGit's own ``shallow.lock`` protocol, so a concurrent ``git fetch`` that
writes ``.git/shallow`` between our read and our write is never clobbered:
the fetch fails fast on the lock and we re-read before writing.c               ó   € V ^8„  d   QhRR/# )r   r  r   r   )r   s   "r   r   Ú_ShallowLock.__annotate__Í  s   € ÷ Nñ N Tñ Nr   c                	ó`   € Wn         VP                  VP                  R ,           4      V n        R# )z.lockN)Ú_pathÚ	with_namer(   Ú
_lock_path)Úselfr  s   &&r   Ú__init__Ú_ShallowLock.__init__Í  s$   € Ø!Œ
Ø&×0Ñ0°×1BÑ1BÀWÕ1LÓMˆŽr   c               ó   € V ^8„  d   QhRR/# )r   r   r  r   )r   s   "r   r   r  Ñ  s   € ÷ ñ ˜<ñ r   c                	óÔ  €  \         P                  ! V P                  \         P                  \         P                  ,          \         P
                  ,          4      p \         P                  ! TR4       \         P                  ! T4       T #   \         d    \        R T P                   24      h\         d   p\        RT 24      ThRp?ii ; i  \         P                  ! T4       i ; i)zshallow lock held: zcannot create shallow lock: Ns   hermes shallow maintenance
)r'   rÁ   r#  ÚO_CREATÚO_EXCLÚO_WRONLYrÂ   ÚRuntimeErrorrF   ÚwriteÚclose)r$  ÚfdrO   s   &  r   Ú	__enter__Ú_ShallowLock.__enter__Ñ  s®   € ð	NÜ—’˜Ÿ™¬"¯*©*´r·y±yÕ*@Ä2Ç;Á;Õ*NÓOˆBð
	Ü�HŠH�RÐ8Ô9ä�HŠH�RŒLØˆøô ô 	HÜÐ!4°T·_±_Ð4EÐFÓGÐGÜô 	NÜÐ!=¸c¸UÐCÓDÈ#ÐMûð	Nûô
 �HŠH�R�Lús*   ‚AB ÁC Â+CÂ7CÂ8CÃCÃC'c               ó   € V ^8„  d   QhRR/# )r   r   rÈ   r   )r   s   "r   r   r  Þ  s   € ÷ ñ  Tñ r   c                	ó`   €  V P                   P                  4        R #   \         d     R # i ; irW   )r#  rG   ÚFileNotFoundError)r$  r"   s   &*r   Ú__exit__Ú_ShallowLock.__exit__Þ  s)   € ð	Ø�O‰O×"Ñ"Ö$øÜ ô 	Úð	ús   ‚ ž-¬-)r#  r!  N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r%  r0  r5  Ú__static_attributes__r   r   r   r  r  È  s   † ñGõNõ÷ñ r   r  c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r  r   Úcontentr<   Úsuffixr   rÈ   r   )r   s   "r   r   r   å  s(   € ÷ 'ñ ' ð '°ð 'Àð 'Èñ 'r   c               óœ   € V P                  V P                  V,           4      pVP                  VRR7       \        P                  ! W04       R# )z=Atomically replace ``.git/shallow`` (temp file + os.replace).r   r‚   N)r"  r(   Ú
write_textr'   r   )r  r>  r?  Útmp_paths   &&$ r   Ú_write_shallowrC  å  s<   € à×%Ñ% l×&7Ñ&7¸&Õ&@ÓA€HØ×Ñ˜¨'ÐÔ2Ü‡J‚JˆxÖ&r   c               ó    € V ^8„  d   QhRRRR/# r½   r   )r   s   "r   r   r   ì  s   € ÷ ?ñ ?°ð ?¸ñ ?r   c                ó\  €  \        V 4      pVf   ^ # \        R.. RO\        V 4      R^
\        4       R7      pVP                  ^ 8X  d   ^ # \        V4      ;_uu_ 4        VP                  4       pVP                  R4      P                  4        Uu0 uF  qD'       g   K  VkK  	  ppV'       g    RRR4       ^ # \        V . RO4      p\        V UUU	u0 uF2  pVP                  R^4      w  r‰V	P                  R4      '       g   K0  VkK4  	  up	pp4      p
\        W
4      pWµ,
          pV'       g    RRR4       ^ # \        VRP                  \        W\,          4      4      R,           R	R
7       \        V . RO4      '       g2   VP!                  V4       \"        P%                  R4        RRR4       ^ #  RRR4       \"        P'                  R\)        X4      V 4       \)        V4      # u upi u up	ppi   + '       g   i     LG; i  \*         d    \"        P%                  RT RR7        ^ # i ; i)aç  Re-append shallow boundaries for reflog-reachable commits whose parents
were never fetched (#108286).

A reflog-only commit whose graft was pruned leaves the repo unwalkable
(``gc``/``fsck``/``fetch`` fail) and unable to self-heal: reflog expiry
happens during ``git gc``, which is exactly what the corruption breaks.
Only reflog-reachable commits are considered, so unrelated object loss is
never re-labelled as shallow history. Returns the number of boundaries
appended; never raises.
Nr&   T©r«   r   r   r   r�   Ú úrefs/remotes/rø   z.hermes-repair©r?  z8shallow boundary repair self-check failed; file restoredz.Restored %d broken shallow boundary(ies) in %sz%shallow boundary repair failed for %sr!   ©úrev-listú--countú--allz--reflog)ÚreflogÚshowrM  z--format=%H%x00%gD)r  r   r<   r   r-   r  Ú
read_bytesr  rô   rá   r  rÖ   rç   r  rC  rü   Úwrite_bytesr/   r0   r^   rÿ   r.   )rS   r  ÚprobeÚoriginalrÙ   ÚexistingrN  rM   ÚshaÚselectorr6   ÚbrokenÚrepaireds   &            r   Ú repair_broken_shallow_boundariesrY  ì  sì  € ð4Ü)¨)Ó4ˆØÒÙäØˆGÒAÜ�I“¨t¸RÜ,Ó.ô
ˆð
 ×Ñ˜qÔ ÙÜ˜,×'Õ'à#×.Ñ.Ó0ˆHØ)1¯©¸Ó)E×)PÑ)PÔ)RÓ[Ñ)R ÓVZŸ˜Ñ)RˆHÐ[ßØ÷ (Ñ'ô  'ØÒLóNˆFäá#õ!á#�EØ&+§k¡k°&¸!Ó&<‘M�CØ×&Ñ& ×7÷ �Ù#ó!ó ˆJô ,¨IÓBˆFØÕ(ˆHßØ÷7 (Ñ'ô8 ˜<¨¯©´6¸(Õ:MÓ3NÓ)OÐRVÕ)VØ"2õ4ô % YÒ0\×]Ò]Ø×(Ñ(¨Ô2Ü—‘ÐWÔXØ÷G (Ñ'ð@ ^÷A (ôH 	�‰ÐDÄcÈ(ÃmÐU^Ô_Ü�8‹}ÐùòE \ùô!÷% (×'ûôL ô Ü�‰Ð<¸iÐRVˆÔWÚðús}   ‚H “6H ÁH Á2G1Â	G%ÂG%Â$G1Â/H Â9G1Ã-G*ÄG*Ä
%G1Ä/H Ä9A.G1Æ'H Æ22H Ç%G1Ç1H	Ç<H È#H+È*H+c               ó    € V ^8„  d   QhRRRR/# r½   r   )r   s   "r   r   r   .  s   € ÷ Añ A¨$ð A°3ñ Ar   c                óF  €  \        V 4      pVf   ^ # \        V4      ;_uu_ 4        VP                  4       pVP                  R4      P	                  4        Uu. uF  q3'       g   K  VNK  	  ppV'       g    RRR4       ^ # \        V4      0 \        V RR.4      ;'       g    . m\        V . RO4      ;'       g    . m\        V RR.4      m,          p\        V4      \        V4      8X  d    RRR4       ^ # \        V4      V,
          p\        V . RO4       FT  p\        V RRR	V.4      p\        V4      V,          '       g   K-  \        R
.RRRV.\        V 4      R^
\        4       R7       KV  	  \        VRP                  \        V4      4      R,           RR7       \        V . RO4      ;'       d%    \        V . RO4      ;'       d    \        V . RO4      p	V	'       g2   VP                  V4       \        P!                  R4        RRR4       ^ #  RRR4       \        P#                  R\        X4      \        X4      ,
          V 4       \        V4      \        V4      ,
          # u upi   + '       g   i     L`; i  \$         d    \        P!                  RT RR7        ^ # i ; i)uÖ  Drop ``.git/shallow`` graft lines no live ref or reflog still points at (#105951).

Every ``git fetch --depth 1`` appends the fetched tip to ``.git/shallow`` as a new
graft and never removes the previous one, so a long-lived shallow installer checkout
accumulates one graft per update check (57 observed in the wild). The stale grafts
break ``merge-base`` and push ``hermes update`` into the orphan-divergence reset path
on every run. Keep only the boundaries that still protect referenced tips (HEAD,
FETCH_HEAD, and every ref tip): the dropped commits are already unreachable and their
objects are left for ``git gc``. Fetch reflogs naming a dropped graft are expired
first â€” otherwise they pin it and the prune rolls back forever (#124645). Returns
the number of graft lines removed; never raises, and restores the original file if
the trimmed set breaks history walking (including the ``--reflog`` walk, so a graft
a reflog-only commit still needs is never dropped, #108286).
Nr�   r  ÚHEADúfor-each-refz--format=%(objectname)rN  rO  z--format=%Hr&   Úexpirez--expire=nowTrF  rø   z.hermes-prunerI  z0shallow prune self-check failed; grafts restoredz&Pruned %d stale shallow graft(s) in %sz!shallow graft prune failed for %sr!   )r  z--verifyú--quietÚ
FETCH_HEAD)r]  z--format=%(refname)rH  )rK  rL  r\  )rK  rL  rM  rJ  )r  r  rP  r  rô   rû   rá   rÿ   r   r<   r   rC  rü   r  rQ  r/   r0   r^   r.   )
rS   r  rS  rÙ   ÚlinesÚkeepÚdroppedÚrefÚentriesÚstill_walkss
   &         r   Úprune_stale_shallow_graftsrg  .  sf  € ð2Ü)¨)Ó4ˆØÒÙÜ˜,×'Õ'à#×.Ñ.Ó0ˆHØ&.§o¡o°kÓ&B×&MÑ&MÔ&OÓXÑ&O˜dÓSW—T�TÑ&OˆEÐXßØ÷ (Ñ'ô �u“:ð !Ü# I°¸VÐ/DÓE×KÐKÈð!ä# IÒ/aÓb×hÐhÐfhð!ô # 9¨~Ð?WÐ.XÓYð!õ ˆDô
 �4‹yœC ›JÔ&Ø÷ (Ñ'ô& ˜%“j 4Õ'ˆGÜ(ØÒSö�ô ,¨I¸À&È-ÐY\Ð7]Ó^�Ü�w“< '×)Ö)ÜØ˜ (¨H°nÀcÐ!JÜ 	›N¸4ÈÜ&8Ó&:÷ñô ˜<¨¯©´6¸$³<Ó)@À4Õ)GÐP_Õ`ô
 ,¨IÒ7VÓW÷ [ð [Ü! )Ò-MÓN÷[ð [ä! )Ò-YÓZð ÷ Ø×(Ñ(¨Ô2Ü—‘ÐOÔPØ÷S (Ñ'ðL ÷M (ôT 	�‰Ð<¼cÀ%»jÌ3ÈtË9Õ>TÐV_Ô`Ü�5‹zœC ›IÕ%Ð%ùòQ Y÷ (×'ûôX ô Ü�‰Ð8¸)ÈdˆÔSÚðús   ‚I9 “I9 ¦2I&Á	I!Á&I!Á,I&Á7I9 ÂI&Â!A
I&Ã+I9 Ã5AI&ÅBI&ÇI&Ç'I&ÈI9 ÈAI9 É!I&É&I6	É1I9 É9#J ÊJ c               ó    € V ^8„  d   QhRRRR/# )r   rS   r   r   z
str | Noner   )r   s   "r   r   r   r  s   € ÷ -ñ - Tð -¸Jñ -r   c                ó^  € \        R.. RO3R\        V 4      RRRRRRRR	R
^/VB pVP                  ^ 8w  g.   VP                  P	                  4       P                  4       R8w  d   R# \        R.. RO3R\        V 4      RRRRRRRR	R
^/VB pVP                  P	                  4       ;'       g    R# )zYThe checkout's own ``remote.origin.partialclonefilter``, or None for a non-partial clone.r&   r«   r   Tr   r   r   r   r   r   ÚtrueN)rÊ   rÌ   zremote.origin.promisor)rÊ   rÌ   ú remote.origin.partialclonefilter)r   r<   r-   r+   rÐ   r,   )rS   Ú
run_kwargsrõ   Ú
configureds   &,  r   Ú_partial_clone_filterrn  r  sÿ   € äØ	ˆÒ>ñä�	‹Nðà+/ðà6:ðð ðð "+ðð 57ðð ;Eñ€Fð
 ×Ñ˜AÔ §¡×!4Ñ!4Ó!6×!<Ñ!<Ó!>À&Ô!HÙÜØ	ˆÒHñä�	‹Nðà+/ðà6:ðð ðð "+ðð 57ðð ;Eñ€Jð
 ×Ñ×"Ñ"Ó$×,Ð,¨Ð,r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   rS   r   Úbranchr<   r   r   r   )r   s   "r   r   r   ƒ  s&   € ÷ 	rñ 	r Dð 	r°#ð 	rÈñ 	rr   c                óD   € \        V 4      RJ;'       d    \        W3/ VB # )a  Unshallow a stale installer checkout before the updater's bounded fetch (#123254).

From a depth-1 clone far behind ``branch``, a plain ``git fetch origin <branch>`` makes the
server send the full ancestry of every side branch merged past the shallow boundary, which
cannot finish inside the 300s network cap; the post-update unshallow never got to run. Fetch
the commit graph first (900s budget), pulling ``branch`` along so the bounded fetch that
follows is small. Returns whether the checkout was shallow; raises on fetch failure.
N)r  Úfetch_full_commit_graph)rS   rp  rl  s   &&,r   Úheal_shallow_historyrs  ƒ  s)   € ô ˜iÓ(°Ð4×qÐqÔ9PÐQZÑ9qÐfpÑ9qÐqr   é„  c               ó$   € V ^8„  d   QhRRRRRR/# )r   rS   r   Úextra_refspecsr<   r   r   r   )r   s   "r   r   r   –  s"   € ÷ (ñ ( tð (¸cð (ÐTXñ (r   c                ój  € \        V 4      pVRJpVP                  R^ 4      \        4       ,          VR&   \        V 3/ VB pVRJ ;'       d=    T;'       d3    \	        \        WP                  RR7      P                  4       4      4      pV'       d   Rp \        R.RR.V'       d   R	.M. OV'       d   R
V 2.M. ORNRNRNVO3R\        V 4      RRRRRRRRRRRV'       d   \        M\        /VB  V'       d   \        V 4       \        V 4       V#   T'       d   \        T 4       \        T 4       i i ; i)a&  Refresh release tags and fill shallow history before publishing identity.

A full commit graph does not imply current tags, especially after a --no-tags
clone. Fetch version tags explicitly without fetching every remote branch or
replacing existing tags. The fetch never changes the clone's mode: ``--filter`` makes git
write ``remote.origin.promisor``/``partialclonefilter``, so a full clone fetches unfiltered
(#122353) and a partial clone repeats its own filter. The one conversion is deliberate: a
depth-limited full clone whose history is really missing unshallows as a partial clone, because
an unfiltered ``--unshallow`` downloads every file version ever committed; a full clone grafted by a
``--depth`` fetch already has its history and stays full. The converted clone's existing packs
are marked as partial-clone packs, or every later fetch crashes on git 2.53+ (#124272).
It converts to ``blob:none``, the layout installers make (see ``convert_treeless_checkout``).
Returns whether the checkout was unshallowed; fetch failures raise subprocess errors.
Nr   r�   r‚   ú	blob:noner&   Úfetchr_  z--unshallowz	--filter=z	--no-tagsÚoriginzrefs/tags/v*:refs/tags/v*r«   r    Tr   r   r   r   r   r   r   )r  r”   r   rn  r   r  r�   rÖ   r   r<   Ú_HISTORY_FETCH_TIMEOUT_SECONDSÚ_TAG_REFRESH_TIMEOUT_SECONDSrÅ   rÒ   )rS   rv  rl  r  r  Úfetch_filterÚconvertss   &*,    r   rr  rr  –  s˜  € ô & iÓ0€LØ $Ð&€Gð #-§.¡.°À!Ó"DÔGYÓG[Õ"[€JˆÑÜ(¨ÑA°jÑA€LØ˜tÐ#÷ Jð J¨÷ Jð J´DÔ9OØ×)Ñ)°;Ð)Ó?×EÑEÓGó:Ió 5J€HçØ"ˆð6ÜØˆG�g˜yð R¿w¨]©OÈBð Rß/;�)˜L˜>Ð*Ñ+ÀðRàðRà"ðRà$?ðRàBPðRñ	
ô �I“ð		
ð '+ð		
ð <@ð		
ð GKð		
ð
 ð	
ð
 &/ð	
÷ 7>Õ2ÔC_ð	
ð dnò	
÷ Ü(¨Ô3Ü*¨9Ô5Ø€Nø÷ Ü(¨Ô3Ü*¨9Õ5ð ús   ÂD Â2?D Ä!D2z<should_include_obj should only be called on existing objectsc               ó    € V ^8„  d   QhRRRR/# )r   Ústderrr<   r   r   r   )r   s   "r   r   r   Ð  s   € ÷ Uñ U°ð U¸ñ Ur   c                óº   a€ T ;'       g    Ro\         S9  d   R# \        ;QJ d#    V3R l\         4       F  '       g   K   R# 	  R# ! V3R l\         4       4      # )zTTrue when a fetch failure is the git 2.53+ partial-clone pack-objects BUG (#124272).r®   Fc              3  ó,   <"  € T F	  qS9   x € K  	  R # 5irW   r   )rØ   Ú
terminatorr   s   & €r   rÚ   Ú6is_partial_clone_pack_objects_crash.<locals>.<genexpr>Õ  s   øé € ÐTÑ4S j˜TÖ!Ó4Sùs   ƒT)Ú_PACK_OBJECTS_CRASH_FINGERPRINTÚanyÚ_PACK_OBJECTS_CRASH_TERMINATORS)r€  r   s   &@r   Ú#is_partial_clone_pack_objects_crashrˆ  Ð  sD   ø€ à�<ˆ<�R€DÜ&¨dÔ2Ùß‹3ÔTÕ4SÓT�3Œ3ÐTŠ3ÐTˆ3ÔTÕ4SÓTÓTÐTr   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   Úrunnerz*Callable[..., subprocess.CompletedProcess]Úgit_cmdr>   Ú
fetch_argsrS   r   r   zsubprocess.CompletedProcessr   )r   s   "r   r   r   Ø  s4   € ÷ 'ñ 'Ð.Xð 'Ø/8ð'ØFOð'à15ð'à:Uñ'r   c                óÔ   € V ! W4      pVP                   ^ 8X  g'   \        \        VRR4      ;'       g    R4      '       g   V# \        V4       \        P                  R4       V ! W4      # )a  Run a fetch; on the pack-objects BUG, mark the unmarked packs and retry it once.

``runner(git_cmd, args) -> CompletedProcess`` and ``git_cmd + fetch_args`` is the plain
fetch argv. On the crash, ``repo_root``'s unmarked packs get a ``.promisor`` file and the
identical fetch runs once more. The retry's result is returned whatever its exit code, so the caller keeps its
normal failure handling. (A ``-c remote.origin.promisor=`` override does not help: git
registers promisor remotes additively, so the repo's own ``true`` still wins.)
r€  r®   z9pack-objects crash on a partial clone; retrying the fetch)r-   rˆ  ÚgetattrrÅ   r/   r^   )rŠ  r‹  rŒ  rS   rõ   s   &&&& r   Ú!fetch_with_partial_clone_recoveryr�  Ø  sa   € ñ �GÓ(€FØ×Ñ˜AÔÔ%HÌÐQWÐYaÐceÓIf×IlÐIlÐjl×%mÒ%mØˆÜ  Ô+Ü
‡K�KÐKÔLÙ�'Ó&Ð&r   c               ó    € V ^8„  d   QhRRRR/# re   r   )r   s   "r   r   r   ë  s   € ÷ 'ñ '¨ð 'Àñ 'r   c                óª  € VP                  R^ 4      \        4       ,          VR&   \        V 3/ VB R8w  g   \        R/ VB R8  d   R# . ROp\	        RR\        V 4      RRRRRR	R
RRR/VB p\        P                  ! . VORN3/ VB  \        V 3/ VB '       g‘   \        P                  ! . RO3R\        V 4      RRRRRRRR	R
RR^/VB P                  P                  4       p\        P                  ! . VOVN3RR/VB  \        V 3/ VB '       g   \        P                  ! ^VRR7      h\        P                  ! . RO3R\        V 4      RRRRR^/VB  R# )aj  Turn a treeless (``tree:0``) checkout into the blobless layout installers now make (#129712).

A treeless checkout holds no trees, and git asks for a missing tree without telling the server
which ones it already has, so every checkout and path-filtered history walk downloads complete
directory snapshots again: hundreds of GB on some installs. One ``--refetch`` of the clone's
refspec and its tags brings every commit and tree (about 120 MB for this repo); file contents
stay on demand. The checked-out commit can sit outside both (a branch fetched by hand, a
release ref the refspec does not name), so its history is checked offline and refetched by
commit when trees are still missing. The new filter is recorded only once that history is
whole: a failed or partial conversion leaves the checkout treeless, so the next update
retries. That check, not the fetch's exit status, is the verdict: a refused tag update (a
local tag that would be clobbered) fails the fetch after its objects have landed. Git before
2.36 has no ``--refetch`` and is left as it is. Returns whether it converted; fetch failures
raise subprocess errors.
r   ztree:0Fr«   r   Tr   r   r   r   r   r   rt  z--tagsr    z.the checked-out history is still missing trees)r€  r   )r   é$   )
r&   ú-cz	gc.auto=0r“  zmaintenance.auto=falsery  r_  z	--refetchú--filter=blob:nonerz  )r&   r  r\  )r&   rÊ   rk  rx  )r”   r   rn  Ú_git_versionr’   r<   r)   r*   Ú_history_trees_completer+   rÐ   ÚCalledProcessError)rS   rl  ÚrefetchÚfetch_kwargsÚheads   &,   r   Úconvert_treeless_checkoutr›  ë  s³  € ð  #-§.¡.°À!Ó"DÔGYÓG[Õ"[€JˆÑÜ˜YÑ5¨*Ñ5¸ÔAÄ\ÑE_ÐT^ÑE_ÐbiÔEiÙò/€Gäñ WœC 	›Nð W¸4ð WÀdð WØ!(ðWØ1:ðWØDGðWØKUñW€Lä‡N‚NÐ'�WÐ'˜hÐ'Ñ8¨<Ò8Ü" 9Ñ;°
×;Ð;Ü�~Š~Ò:ñ ,ÄÀIÃð ,ÐVZð ,Ø-1ð,Ø8<ð,ØGNð,ØW`ð,Øjlð,à *ñ,ç,2©F·5±5³7ð 	ô 	�ŠÐ'˜Ð' $Ð'ÑD¨tÐD°|ÒDÜ& yÑ?°J×?Ð?Ü×/Ò/°°7ÐCsÔtÐtô ‡N‚NÚJñä�	‹Nðà"&ðà7;ðàEGðàKUòñ r   c               ó    € V ^8„  d   QhRRRR/# rÇ   r   )r   s   "r   r   r     s   € ÷ ñ ¨tð ¸ñ r   c                óœ  € ^ RI Hp  \        V 3/ V! 4       B '       d   \        RRR7       R# R#   \        \
        P                  3 d�   p\        TRR4      ;'       g    \        T4      P                  4       P                  4       R	R ;'       g    \        T4      P                  .p\        RT^ ,           R2RR7        Rp?R# Rp?ii ; i)
aÉ  Run the one-time conversion as the update's first new-code step. Never raises.

Both update hand-offs (``update_completion._prepare`` and an older updater's
``_update_takeover.prepare``) call this before minutes of dependency work: a Desktop built before
the fix keeps walking history during that window, and on a treeless checkout every walk
downloads trees again (#129514: 434 GB, disk full mid-update). Runs in the dependency-free
bootstrap interpreter.
)Úno_prompt_git_kwargsuT     âœ“ Fetched this checkout's directory history once; updates stop re-downloading itT)Úflushr€  Nu9     âš  Could not fetch this checkout's directory history (z); retrying next updateéÿÿÿÿ)Úhermes_cli._subprocess_compatrž  r›  ÚprintrF   r)   ÚSubprocessErrorrŽ  r<   rÐ   rô   Útyper7  )rS   rž  rO   Údetails   &   r   Úconvert_treeless_checkout_firstr¦    sÁ   € õ CðÜ$ YÑIÑ2FÓ2H×IÐIÜÐhØ÷ñ Jøô ”Z×/Ñ/Ð0ô Ü˜#˜x¨Ó.×:Ð:´#°c³(×AÑAÓC×NÑNÓPÐQSÐQTÐU×mÐmÔZ^Ð_bÓZc×ZlÑZlÐYmˆÜÐIÈ&ÐQRÍ)ÈÐTkÐlØ÷	ó 	ûðús   ˆ$0 °CÁACÂ/CÃCc               ó   € V ^8„  d   QhRR/# )r   r   Útupler   )r   s   "r   r   r   *  s   € ÷ ?ñ ? %ñ ?r   c                 óæ   € \         P                  ! R R.3RRRRRRRRR	^/V B P                  p\        P                  ! R
V4      pV'       d%   \        V^,          4      \        V^,          4      3# R# )r&   z	--versionr   Tr   r   r   r   r   r   z(\d+)\.(\d+))rw   rw   )r)   r*   r+   ÚreÚsearchr:   )rl  ÚoutÚmatchs   ,  r   r•  r•  *  s†   € Ü
�.Š.˜% Ð-ñ E¸dð EÈð EÐX_ð EØ )ðEØ35ðEØ9CñEßEKÁVð ä�IŠI�o sÓ+€Eß-2ŒC��a•‹Mœ3˜u Q�x›=Ð)Ð>¸Ð>r   c               ó    € V ^8„  d   QhRRRR/# re   r   )r   s   "r   r   r   1  s   € ÷ gñ g tð g¸dñ gr   c                óÀ  € \        VP                  RR4      ;'       g    \        4       RR7      p\        P                  ! . RO3R\        V 4      RRRRR	R
RRRRRV/VB pVP                  ^ 8H  ;'       dj    \        ;QJ d4    R VP                  P                  4        4       F  '       g   K   RM)	  RM%! R VP                  P                  4        4       4      '       * # )z]Whether every tree in HEAD's history is local, checked without fetching (~3 s for this repo).ÚenvNÚ1)ÚGIT_NO_LAZY_FETCHr«   r   Tr   r   r   r   r   r   i,  c              3  óB   "  € T F  qP                  R 4      x € K  	  R# 5i)Ú?N)rç   r×   s   & r   rÚ   Ú*_history_trees_complete.<locals>.<genexpr>9  s   é € Ð+fÑMeÀT¯O©O¸C×,@Ð,@ÓMeùs   ‚F)r&   rK  z	--objectsr”  z--missing=printr\  )
r’   Úpopr
   r)   r*   r<   r-   r†  r+   rô   )rS   rl  r°  Úwalks   &,  r   r–  r–  1  sÒ   € ä
ˆz�~‰~˜e TÓ*×FÐFÔ.DÓ.FÐZ]Ô
^€CÜ�>Š>ÚYñä�	‹Nðà+/ðà6:ðàELðàU^ðð ðð ðð !+ñ€Dð
 �?‰?˜aÑ×fÐf¯«Ñ+fÈTÏ[É[×McÑMcÔMeÓ+f¯¯ªÑ+fÈTÏ[É[×McÑMcÔMeÓ+fÓ(fÔ$fÐfr   c               ó    € V ^8„  d   QhRRRR/# rÇ   r   )r   s   "r   r   r   <  s   € ÷ 	cñ 	c°ð 	c¸ñ 	cr   c                ó¤   €  \        V \        4       R7      e   \        V 4       R# R#   \         d    \        P                  RT RR7        R# i ; i)z¹Persist the commit-graph-off keys on a partial clone; a full clone keeps stock maintenance.

Runs on every update so checkouts that predate the installer change converge. Never raises.
)r   Nz0partial-clone maintenance settings failed for %sTr!   )rn  r   rÒ   r.   r/   r0   )rS   s   &r   Ú settle_partial_clone_maintenancerº  <  sL   € ð
cÜ  Ô:LÓ:NÔOÒ[Ü*¨9Ö5ñ \øäô cÜ�‰ÐGÈÐ]aˆ×bðcús   ‚"( ¨#AÁAiX  )zshallow.lockrj   z	HEAD.lockzMERGE_HEAD.lock)Ú	tmp_pack_Útmp_idx_Útmp_rev_Útmp_mtimes_z.tmp-))rÞ   rÝ   )zgc.writeCommitGraphrÝ   )zfetch.writeCommitGraphrÝ   )zpack-objects died of signal 6z3could not finish pack-objects to repack local linksz%fetch-pack: invalid index-pack output)?r;  Ú
__future__r   Úloggingr'   rª  r)   rA   Úpathlibr   Útypingr   r   r   r   r¡  r   r	   r
   r   Úhermes_cli.update_custodyr   Ú	getLoggerr7  r/   rb   rð   rX   rè   r3   rP   rc   rr   r}   rn   ro   r»   rÅ   rÏ   rÒ   rÎ   rñ   rá   r  r  r  rC  rY  rg  rn  rs  r|  r{  rr  r…  r‡  rˆ  r�  r›  r¦  r•  r–  rº  r   r   r   Ú<module>rÅ     sE  ðñaõ
 #ã Û 	Û 	Û Û Ý ß 5Ó 5÷ó õ .à	×	Ò	˜8Ó	$€ð %Ð Ø!;Ð ð L€
ð SÐ õõ*ð>Èt÷ õAõ@õ-gõ`!õHSõ
ðBÐ õOõ:Vð6Èt÷ õ*õ EõP<÷ñ õ:'õ?õDAõH-õ"	rð  "Ð Ø!$Ð õ(ðd #aÐ ð#Ð õUõ'õ&'õTõ*?õg÷	cr   