https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/hgext/largefiles/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/hgext/largefiles/__pycache__/lfcommands.cpython-310.pyc
o

�]Lb<Z�@s�dZddlmZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZmZmZddlmZdd	lmZmZd
dlmZmZej Z e��Z!e!j"dd
dded�dfddded�fged�ddd�dd��Z#dd�Z$dd�Z%dd�Z&d d!�Z'd"d#�Z(d$d%�Z)d&d'�Z*d(d)�Z+d>d*d+�Z,d?d,d-�Z-d.d/�Z.	d@d0d1�Z/e!�"d2d3d4ged5�fgej0ed6��dAd8d9��Z1e!�"d:gej0ed;��d<d=��Z2dS)Bz=High-level command function for lfconvert, plus the cmdtable.�)�absolute_importN)�_)�bin�hex)�cmdutil�context�error�	exthelper�hg�lock�
logcmdutil�match�pycompat�scmutil�util)�hashutil�)�convcmd�filemap�)�lfutil�storefactorys	lfconvert�s�size�s9minimum size (MB) for files to be converted as largefilessSIZEs	to-normalFs/convert from a largefiles repo to a normal repos#hg lfconvert SOURCE DEST [FILE ...]T)�norepo�	inferrepocs t�|�}|drd}nd}tj|d|�d�dd�}t�|�s(t�t	d�|��t�|�s6t�t	d�|��t�
||��|�t	d�|�tj
||dd	�}d}d}	}
�z#�fd
d��j�
d����dD�}�j|ji}|�r|��}	|��}
t�}
t�}|s�|�tjd
�}|r�t��jdt|��}nd}i}|jt	d�t	d��d��d�� }|D]}|�|���t�||||
||||�	q�Wd�n1s�wY|j�tj�r�|j� tj�|�!�D]$}|j�"|�r�|j�#|�z|j�$|j�%|��Wq�t&�yYq�w|
�r|j'�(d�t)�*|�nEG��fdd�dt+j,��G��fdd�dt-j.��t/|��\}}|dk�rAt�t	d���t-j.}�t-_.zt-j0|||ddd�W|t-_.n|t-_.wd}W|�rk|j1�2�t3|
|	�|�svt4� |j�dSdS|�r�|j1�2�t3|
|	�|�s�t4� |j�ww)aMconvert a normal repository to a largefiles repository

    Convert repository SOURCE to a new repository DEST, identical to
    SOURCE except that certain files will be converted as largefiles:
    specifically, any file that matches any PATTERN *or* whose size is
    above the minimum size threshold is converted as a largefile. The
    size used to determine whether or not to track a file as a
    largefile is the size of the first version of the file. The
    minimum size can be specified either with --size or in
    configuration as ``largefiles.size``.

    After running this command you will need to make sure that
    largefiles is enabled anywhere you intend to push the new
    repository.

    Use --to-normal to convert largefiles back to normal files; after
    this, the DEST repository can be used without largefiles at all.s	to_normalFTrN)�defaults %s is not a local Mercurial reposinitializing destination %s
)�createc3s�|]}�|VqdS�N�)�.0�ctx)�rsrcr �=/usr/lib/python3/dist-packages/hgext/largefiles/lfcommands.py�	<genexpr>rs
��
�zlfconvert.<locals>.<genexpr>rspatternsrsconverting revisionss	revisionsstip��unit�totals
largefilescs.eZdZ��fdd�Z���fdd�Z�ZS)zlfconvert.<locals>.lfsourcecs&t�|��||d�d|jjtj<dS)N�.)�super�__init__�
filemapper�renamer�	shortname)�self�ui�source)�	__class__�lfsourcer r$r+�sz$lfconvert.<locals>.lfsource.__init__cs~|\}}t�|��||�}|�tj�r|ddur|S|d��}t��|�}|dur6t�t	d�||f��t
�|�|dfS)Nrs missing largefile for '%s' in %sr)r*�getfile�
startswithr�shortnameslash�strip�findfiler�Abortrr�readfile)r/�name�rev�realname�realrev�f�hash�path)r2r3r#r r$r4�s
���z#lfconvert.<locals>.lfsource.getfile)�__name__�
__module__�__qualname__r+r4�
__classcell__r )r3r#�r2r$r3�sr3cs eZdZ���fdd�Z�ZS)zlfconvert.<locals>.convertercs&�||�}t�|��|||||�dSr)r*r+)r/r0r1�dest�
revmapfile�opts�src)r2�	converterr3r r$r+�s


�z%lfconvert.<locals>.converter.__init__)rBrCrDr+rEr )rKr3rFr$rK�srKs&all largefiles must be present locallyshg)�source_type�	dest_type)5r�byteskwargsr�
getminsize�getr
�islocalrr9r�
repository�status�	changelog�nodesbetween�heads�nullid�wlockr�set�
configlist�longname�matchmodr
�root�list�makeprogressr<�update�_lfconvert_addchangeset�wvfs�existsr.�rmtree�keys�isfile�unlink�
removedirs�dirname�OSError�requirements�addr�writereporequirementsr�filemap_sourcerrK�downloadlfiles�convert�dirstate�clear�release�shutil)r0rJrG�patsrI�tolfile�size�rdst�success�dstwlock�dstlock�ctxs�revmap�lfiles�normalfiles�matcher�lfiletohash�progressr"r?�found�missing�origr )rKr3r#r$�	lfconvert3s�
(


�
�����
�

�

��

�r�c	s�t���}	t�|	�}
g}|
D]�}||vr^||vr^t|�||�}
|���vrQ��|�}|��}|dur4d}|o9||v}|
|O}
d|��vrQ|rOt�t	d�|��d}
|
rY|�
|�n|�
|�||vr�t�|�}|�
|�|���vrш�|�}d|��vr�|��}|r�||vr�t�t	d�|��t�d�}|��|���t|���}|�vs��||kr�|�|�|���|���d�|��v}t�||||�|�|<q|�
|�q���fdd�}t||	�||��dS)	NF�ls+renamed/copied largefile %s becomes symlinkslargefile %s becomes symlinkr�xc
s�t�|�}|dur>z��|�}WntjyYdSw|��}|r't�|�}t�|||�|dd|�	�vd|�	�v|�St
|�|��S)N�
r�r�)r�splitstandin�filectxr�LookupError�
copysource�standinr�
memfilectx�flags�_getnormalcontext)�repo�memctxr?�srcfname�fctx�renamed�r"r�r}r r$�
getfilectx$s(
�



�
z+_lfconvert_addchangeset.<locals>.getfilectx)�_convertparents�_getchangedfiles�_islfile�manifestr�r�r�rr9rrlrr��appendr�sha1r`�datar�digest�wwrite�writestandin�_commitcontext)r#rxr"r}r~rr�rwr��parents�files�dstfilesr?�islfiler�r��renamedlfile�fstandin�mr@�
executabler�r r�r$ra�s^


��




�
�racCs^t�|||��|||��|��|���}|�|�}t�||�|�	|�|j
��||��<dSr)
rr��description�user�date�extra�	commitctxr�copyalltostore�
setparentsrT�tip�node)rxr�r"r�r�r}�mctx�retr r r$r�Cs�


r�cCsRt|���}|��j|vr'|��}|��D]}|���|�D]}|�|�qq|Sr)rYr�r�rWr�r��diffrl)r"r�r��mc�pctx�fnr r r$r�Us�r�cCsPg}|��D]}|�||���qt|�dkr&|�|��j�t|�dks|S)Nr)r�r�r��lenr�rW)r"r}r��pr r r$r�`s�r�c
Csrz|�|�}WntjyYdSw|��}|��}|dkr&t|j||�}t�||||d|�	�vd|�	�v|�S)N�.hgtagsr�r�)
r�rr�r�r��_converttagsr0rr�r�)r�r"r?r}r�r�r�r r r$r�js��r�c	Cs�g}|��D]Y}z
|�dd�\}}Wnty$|�td�|�Yqwzt|�}Wnty=|�td�|�Yqwz|�dt||�|f�Wqt	y_|�td�|�Yqwd�
|�S)N� rs&skipping incorrectly formatted tag %s
s%skipping incorrectly formatted id %s
s%s %s
sno mapping for id %s
r)�
splitlines�split�
ValueError�warnrr�	TypeErrorr�r�KeyError�join)r0r}r��newdata�line�idr;�newidr r r$r�zs*���
r�cCs`|dks|dks|dkrdS|r||�rdSz|�|���|ddkWStjy/YdSw)zlReturn true if file should be considered a largefile, i.e.
    matcher matches it or it is larger than size.r�s	.hgignores.hgsigsFTi)r�rwrr�)�filer"r�rwr r r$r��s�r�c	s�|sdStj||dd�}d}|�dt|��|�|���fdd�|D�}|�dt|��|jtd	�td
�t|�d��.}|D]"}|�|�t�	||�}|sWt
�td�|��|�||�|d
7}q?Wd�dS1smwYdS)z&upload largefiles to the central storeNT)�putrs,sending statlfile command for %d largefiles
csg|]}�|s|�qSr r )r!�h��retvalr r$�
<listcomp>��z uploadlfiles.<locals>.<listcomp>s"%d largefiles need to be uploaded
suploading largefilessfilesr&s6largefile %s missing from store (needs to be uploaded)r)
r�	openstore�debugr�rcr_rr`rr8rr9r�)	r0r#rxr��store�atr�r@r1r r�r$�uploadlfiles�s6
�
���
�"�r�cCs.|r|�d�}ndg}t�|�}|j||d�S)a)Verify that every largefile revision in the current changeset
    exists in the central store.  With --contents, also verify that
    the contents of each local largefile file revision are correct (SHA-1 hash
    matches the revision ID).  With --all, check every changeset in
    this repository.sall()r))�contents)�revsrr��verify)r0r��allr�r�r�r r r$�verifylfiles�s

r�cCs�t�||�}|rt|�t|�@}g}||}|D]5}zt�|t�|��}Wnty?}	z
|	jtjkr:WYd}	~	q�d}	~	wwt�||�sM|�	||f�q|r\t
�|�}
|
�|�}|SggfS)a.cachelfiles ensures that all largefiles needed by the specified revision
    are present in the repository's largefile cache.

    returns a tuple (cached, missing).  cached is the list of files downloaded
    by this operation; missing is the list of files that were needed but could
    not be found.N)
r�
listlfilesrY�
readasstandinr��IOError�errno�ENOENTr8r�rr�rP)r0r�r��filelistr~�togetr"�lfile�expectedhash�errr�r�r r r$�cachelfiles�s,���

r�cCs�|jj}d}d}|�ddtj�D]}t||||��\}}|t|�7}|t|�7}q|�td�|�|dkr@|�td�|�||fS)Nrsfile(%s)spath:s %d additional largefiles cached
s!%d largefiles failed to download
)	rTr�r�rr.r�r�rSr)r0r��tonode�totalsuccess�totalmissingr<ryr�r r r$ro�sroc	s�t�|||�}|�����t�||�}tt�|��t|�B}�dur/t����fdd�|D�}|����i}t��d\}	}
|j}|d}|D]�}
tj	j
t�|||
�|j
d�}t�|
�}tj	j
t�|||�|j
d�}|�|�r�|�|�r�|�|
�r�t�|�|
�|�|��|�|�t�||�}|dkr�|
|vr�|j�|�jr�|j|
dd�n��|
�|j|
dddd	�|||
<qF|�|
�r�|j�|
�|vr�|�|
�|
d
7}
qFWd�n1s�wY|�|���|�r�fdd�|D�}�D]}|j�t�|��|j�|�q�|td��t ||d|�|���u|D]j}
d
}|�!|
�}|�r;t�"|||
��s1�q|j|
ddd�d
}t�|
�}|�|��rx|�#|�j$d@}|�#|
�}|j$}||d@k�rx|dM}|�rp||d?d@t%j&@O}|�'|
|�d
}|	|7}	t�(|||
|��qWd�n	1�s�wY|�|���|�r�|td�|	|
f�Wd�dSWd�dS1�s�wYdS)z�Update largefiles according to standins in the working directory

    If ``printmessage`` is other than ``None``, it means "print (or
    ignore, for false) message forcibly".
    Ncsg|]}|�vr|�qSr r �r!r?)r�r r$r�	r�z updatelfiles.<locals>.<listcomp>)rr)�startrT)�
ignoremissing)�
p1_tracked�
wc_tracked�possibly_dirtyrcsg|]}|�vr|�qSr r r�)�droppedr r$r�?r�sgetting changed largefiles
r)r�r��@i����r�Is"%d largefiles updated, %d removed
))r�getstatuswriterrX�openlfdirstaterYr��parentchangerb�osrA�relpathr�
backuppathr]r�rcrt�copyfiler��
unlinkpathr�rq�	get_entry�any_trackedrl�update_file�	normalize�write�currenttransaction�_map�reset_staterr�rP�
copyfromcache�stat�st_moder�umask�chmod�synclfdirstate)r0r�r��printmessage�normallookup�statuswriter�
lfdirstater~r`�updated�removedrb�wctxr��	lfileorigr��standinorig�
expecthashr?�update1�standinexec�st�moder )r�r�r$�updatelfiles�s�
�
�


���
���1

�

��$��l$�rslfpull�rsrevs#pull largefiles for these revisionss--r REV... [-e CMD] [--remotecmd CMD] [SOURCE]�defaultc	Ks�||_|�dg�}|st�td���t�||�}d}|D]}|�td�|�t|||�\}}|t	|�7}q|�
td�|�dS)a0pull largefiles for the specified revisions from the specified source

    Pull largefiles that are referenced from local changesets but missing
    locally, pulling from a remote repository to the local cache.

    If SOURCE is omitted, the 'default' path will be used.
    See :hg:`help urls` for more information.

    .. container:: verbose

      Some examples:

      - pull largefiles for all branch heads::

          hg lfpull -r "head() and not closed()"

      - pull largefiles on the default branch::

          hg lfpull -r "branch(default)"
    r<sno revisions specifiedrs#pulling largefiles for revision %d
s%d largefiles cached
N)�lfpullsourcerPrr9rr�revrange�noter�r�rS)	r0r�r1rIr��	numcachedr<�cachedr�r r r$�lfpullusrs
debuglfputsFILEcKs.t�|�}t�|��||�|�d|�dS)Ns%s
r)r�hashfilerr�r�r�)r0r��filepath�kwargsr@r r r$�
debuglfput�s
r#)FFr)NNF)r)3�__doc__�
__future__rr�r�rt�mercurial.i18nr�mercurial.noderr�	mercurialrrrr	r
rrr
r\rrr�mercurial.utilsrrprr�rrrs�eh�commandr�rar�r�r�r�r�r�r�r�r�ror�
remoteoptsrr#r r r r$�<module>sp4
����
]

!

�{��$

https://t.me/RX1948 - 2025