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/convert/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�]Lb�W�@s�ddlmZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZddlmZddlmZmZmZmZmZmZmZmZmZmZmZejZejZej Z ej!Z!ej"Z"ej#Z#ej$Z$ej%Z%ej&Z&ej'Z'ej(Z(ej)Z)ej*Z*ej+Z+ej,Z,d	a-d%d
d�Z.dd
�Z/dd�Z0de#dfde$dfde,dfde(dfde%dfde)dfde&dfde"dfde*dfg	Z1de'fde+fgZ2dd�Z3dd�Z4Gdd �d e5�Z6Gd!d"�d"e5�Z7d&d#d$�Z8dS)'�)�absolute_importN)�_)�open)�encoding�error�hg�pycompat�scmutil�util)�dateutil�)�bzr�common�cvs�darcs�filemap�git�gnuarchr�monotone�p4�
subversionsasciic	Cs
|duri}t|d��p}|D]d}|��}|r|�d�rqz
|�dd�\}}Wnty>td�}|�|||��f�Yqw|��}|��}|�|�d|fvrbtd�}|�	|||f�|||<qtd�}|�
|||||f�qWd�|S1s~wY|S)N�rb�#�=rs,ignoring bad line in author map file %s: %s
smapping author %s to %s
s5overriding mapping for author %s, was %s, will be %s
)r�strip�
startswith�split�
ValueErrorr�warn�rstrip�get�debug�status)	�ui�
authorfile�authors�afile�line�	srcauthor�	dstauthor�msg�m�r,�7/usr/lib/python3/dist-packages/hgext/convert/convcmd.py�
readauthormap;s8��
��r.cCs6t|tj�r|�t�t�d�S|�d��t�t�d�S)N�replacezutf-8)�
isinstancer�unicode�encode�sysstr�
orig_encoding�decode)�sr,r,r-�recodeYs


�r7cCs$|�|pd|�}|s|�d|�}|S)a�
    >>> bmap = {b'default': b'branch1'}
    >>> for i in [b'', None]:
    ...     mapbranch(i, bmap)
    'branch1'
    'branch1'
    >>> bmap = {b'None': b'branch2'}
    >>> for i in [b'', None]:
    ...     mapbranch(i, bmap)
    'branch2'
    'branch2'
    >>> bmap = {b'None': b'branch3', b'default': b'branch4'}
    >>> for i in [b'None', b'', None, b'default', b'branch5']:
    ...     mapbranch(i, bmap)
    'branch3'
    'branch4'
    'branch4'
    'branch4'
    'branch5'
    sdefaultsNone�r )�branch�	branchmapr,r,r-�	mapbranchbsr;scvs�
branchsortsgitssvnshg�
sourcesortsdarcssmtnsgnuarchsbzrsp4c	Cs�g}|r|dd�tD�vrt�td�|��tD]2\}}}z|r$||kr0|||||�|fWSWqttfyJ}z|�|�WYd}~qd}~ww|js`|D]}|�dt	�
|jd��qPt�td�|��)NcS�g|]}|d�qS�rr,��.0r6r,r,r-�
<listcomp>��z!convertsource.<locals>.<listcomp>s"%s: invalid source repository type�%s
rs%%s: missing or unsupported repository)�source_convertersr�Abortr�NoRepo�MissingTool�append�quiet�writer�bytestr�args)	r#�path�type�revs�
exceptions�name�source�sortmode�instr,r,r-�
convertsource�s ���rVcCs�|r|dd�tD�vrt�td�|��tD]B\}}z|r!||kr*||||�WSWqtyF}z|�td�|�WYd}~qd}~wtyX}zt�d|��d}~wwt�td�|��)NcSr>r?r,r@r,r,r-rB�rCzconvertsink.<locals>.<listcomp>s'%s: invalid destination repository typesconvert: %s
rDs%s: unknown repository type)�sink_convertersrrFrrG�noterH)r#rNrOrR�sinkrUr,r,r-�convertsink�s����rZc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�progresssourcecCs*||_||_|jtd�td�|d�|_dS)Ns
getting filessfiles��unit�total)r#rS�makeprogressr�progress)�selfr#rS�	filecountr,r,r-�__init__�s
�zprogresssource.__init__cCs|jj|d�|j�||�S)N)�item)r`�	incrementrS�getfile)ra�file�revr,r,r-rf�szprogresssource.getfilecC�|j�|�S�N)rS�targetfilebelongstosource)ra�targetfilenamer,r,r-rk��z(progresssource.targetfilebelongstosourcecCrirj)rS�	lookuprev)rarhr,r,r-rn�rmzprogresssource.lookuprevcCs|j��dSrj)r`�complete�rar,r,r-�close�szprogresssource.closeN)�__name__�
__module__�__qualname__rcrfrkrnrqr,r,r,r-r[�sr[c@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�	convertercCs�||_||_||_||_i|_i|_d|_t||�|_|j��}|r-t	j
�|�r-|�|�|�
d�r@|�|�
d��|j��|_|�|�
d��|_t||�
d��|_dS)N�	authormaps	splicemaps	branchmap)rS�destr#�opts�commitcacher%r$�mapfile�map�osrN�existsr.r �parsesplicemap�	splicemapr:)rar#rSrw�
revmapfilerxr$r,r,r-rc�s 


zconverter.__init__cCs|siSi}zpt|d�}tt�|��D]`\}}|��d��}|s"qtj|dd�}t|�}dt	|�kr9dksGnt
�td�||df��|D]}|j
�|�qI|d|dd�|dd	�}}	}
|	|
krm|	||<q|	|
||<qW|Sty�t
�td
�|��w)a�check and validate the splicemap format and
        return a child/parents dictionary.
        Format checking has two parts.
        1. generic format which is same across all source types
        2. specific format checking which may be different for
           different source type.  This logic is implemented in
           checkrevformat function in source files like
           hg.py, subversion.py etc.
        rr�,)�data�
whitespace��s8syntax error in %s(%d): child parent1[,parent2] expectedrNs-splicemap file not found or error reading %s:)r�	enumerater
�iterfile�
splitlinesrr�shlexer�list�lenrrFrrS�checkrevformat�IOError)rarNr+�fp�ir'�lex�part�child�p1�p2r,r,r-r~�s@
�
��$
��
��zconverter.parsesplicemapcCs�t|�}t�}i}|j��}|jjtd�td�|d�}|re|�d�}||vr'q||jvr<|j|}|t	ks;|j
�|�r<q|�|�|�
t|��|�|�}	g||<|	jD]}
||�|
�|�|
�qT|s|��|S)z`Return a mapping that identifies the uncommitted parents of every
        uncommitted changeset.sscanning�	revisionsr\r)r��setrS�
numcommitsr#r_r�popr{�SKIPREVrw�hascommitfrommap�add�updater��cachecommit�parentsrIro)ra�heads�visit�knownr�r�r`�nr+�commit�pr,r,r-�walktrees2
�





�zconverter.walktreecCs�t|�D]G}||vr |j�|j�||��s|j�td�|�qg}||D] }|j�|j�||��r4q&||vrAt�	td�|��|�
|�q&|||<qdS)z�A splicemap redefines child/parent relationships. Check the
        map contains valid revision identifiers and merge the new
        links in the source graph.
        s8splice map revision %s is not being converted, ignoring
sunknown splice map parent: %sN)�sortedrw�hascommitforsplicemapr{r r#rrrrFrI)rar�r�c�pcr�r,r,r-�mergesplicemap2s(���
�zconverter.mergesplicemapc
sx�fdd�}�fdd�}�fdd�}�fdd�}�fd	d
�}|dkr&|�}n!|dkr.|�}n|d
kr6|�}n|dkr>|�}n	t�td�|��|��\}	}
g}i}|
r�||
�}
|
�|
�|�|
�|	�|
g�D]A}||vrz�fdd��|D�||<z	||�|
�Wnty�t�td�t|�t|
�f��w||s�|
�d|�d||<qg|
sSt	|�t	��kr�t�td���|S)znReturn an ordering such that every uncommitted changeset is
        preceded by all its uncommitted ancestors.cs�t�t|��}t�}i}g}|rK|��}||vrq|�|�|�|g�d}||D]}|�jvr8|�|�d}|�|g��|�q*|sI|�|�|s||fS)aReturn a (children, roots) tuple where 'children' maps parent
            revision identifiers to children ones, and 'roots' is the list of
            revisions without parents. 'parents' must be a mapping of revision
            identifier to its parents ones.
            FT)	�collections�dequer�r��popleftr��
setdefaultr{rI)r�r��seen�children�rootsr��	hasparentr�rpr,r-�mapchildrenRs(



�z'converter.toposort.<locals>.mapchildrencsdg���fdd�}|S)aIf the previously converted revision has a child in the
            eligible revisions list, pick it. Return the list head
            otherwise. Branch sort attempts to minimize branch
            switching, which is harmful for Mercurial backend
            compression.
            Ncs6|d}|D]}�d�|vr|}nq|�d<|S)Nrr,)�nodes�nextr�)r��prevr,r-�picknext|s�z>converter.toposort.<locals>.makebranchsorter.<locals>.picknextr,�r�)r�)r�r-�makebranchsorterss	z,converter.toposort.<locals>.makebranchsorterc��fdd���fdd�}|S)zSource specific sort.cs�j|jSrj)ry�sortkey�r�rpr,r-�<lambda>�sz>converter.toposort.<locals>.makesourcesorter.<locals>.<lambda>c�t|�d�dS�N)�keyr�r��r���keyfnr,r-r���z>converter.toposort.<locals>.makesourcesorter.<locals>.picknextr,r�rpr�r-�makesourcesorter�sz,converter.toposort.<locals>.makesourcesortercr�)zClose order sort.csd�j|jv�j|jfS)Nsclose)ry�extrar�r�rpr,r-r��s
�z=converter.toposort.<locals>.makeclosesorter.<locals>.<lambda>cr�r�r�r�r�r,r-r��r�z=converter.toposort.<locals>.makeclosesorter.<locals>.picknextr,r�rpr�r-�makeclosesorter�sz+converter.toposort.<locals>.makeclosesortercs"i���fdd���fdd�}|S)zSort revisions by date.cs&|�vrt��j|j��|<�|Srj)r�	parsedatery�dater�)�datesrar,r-�getdate�sz;converter.toposort.<locals>.makedatesorter.<locals>.getdatecst�fdd�|D��dS)Ncsg|]}�|�|f�qSr,r,)rAr��r�r,r-rB�szPconverter.toposort.<locals>.makedatesorter.<locals>.picknext.<locals>.<listcomp>r)�minr�r�r,r-r��sz<converter.toposort.<locals>.makedatesorter.<locals>.picknextr,r�rp)r�r�r-�makedatesorter�sz*converter.toposort.<locals>.makedatesorterr<�datesortr=�	closesortsunknown sort mode: %scsg|]	}|�jvr|�qSr,�r{�rAr�rpr,r-rB��z&converter.toposort.<locals>.<listcomp>s cycle detected between %s and %srNsnot all revisions were sorted)
rrFr�removerIr rr7�insertr�)rar�rTr�r�r�r�r�r�r��activesr6�pendingsr�r�r,)r�rar-�toposortNsR!	

�����zconverter.toposortc	Csb|j}|r/|j�td�|�t|d�}|jD]}|�t�d||j|f��q|�	�dSdS)Nswriting author map file %s
swb+s%s=%s
)
r$r#r"rrr%rKr
�tonativeeolrq)rar$�ofile�authorr,r,r-�writeauthormap�s

���zconverter.writeauthormapcCst|j||j�|_dSrj)r.r#r%)rar$r,r,r-r.�szconverter.readauthormapcCs>|j�|�}|j�|j|j�|_t|j|j�|_||j|<|Srj)	rS�	getcommitr%r r�r;r9r:ry)rarhr�r,r,r-r��s

zconverter.cachecommitc
s��j|}�j�d�}�j�||�}t|t�r*|tkrt}n�j|}|�j|<dS|\}}}g}	|j	rR|j	D]}
|
�jvrC��
|
�|	��j|
�j|
jf�q7�j
�|j|	�z!�j|}�j�td�td��|�|f��fdd�|D�}Wnty�dd�|	D�}|��fdd�|jD��Ynwt|	�d	kr�t�}t|�d
kr�t�j�jt|��}nt�j�jt|�t|�d�}�j
�|||||�j||�}
|���j�||
�|
�j|<dS)Nsfullsspliced in %s as parents of %s
s and csg|]	}�j�||��qSr,)r{r r�rpr,r-rBr�z"converter.copy.<locals>.<listcomp>cSr>r?r,)rA�br,r,r-rBrCc3s$�|]
}|�jvr�j|VqdSrjr�)rA�xrpr,r-�	<genexpr>s��z!converter.copy.<locals>.<genexpr>r�r�r)ryrxr rS�
getchangesr0�bytesr�r{r�r�rIr9rw�	setbranchrr#r"r�join�KeyError�extend�
optparentsr�r�r[�	putcommitrq�	converted)rarhr��full�changesrw�files�copies�cleanp2�	pbranchesr�r�rS�newnoder,rpr-�copy�s\







�
������zconverter.copycsL�z|j��|j��|j�|j�|j�td��|j��}|�	|�}|�
||j�|j�td��|�||�}t
|�}d}|j�td��|jjtd�td�t
|�d�}t|�D]:\}}|d8}|j|j}	d|	vrs|	��d	}	|j�d
|t|	�f�|j�td�t|��|�|�|�|�q[|��|j�dd
�s�|j��}
i}|
D]}|
|}
|j�|
t�tkr�|j|
||<q�|r�|r�|j�|�\}�|r�r�fdd�t�|j�D�}|r�||j|d	d	<|j��}i}|D]}||}
|j�|
t�tk�r	|j|
||<q�|�r|�r|j� |�|�!�W|�"�dS|�"�w)Nsscanning source...
ssorting...
sconverting...
s
convertingr�r\r�
rs%d %s
ssource: %s
sconvertsskiptagscsg|]
}|d�kr|�qS)rr,)rA�e��
tagsparentr,r-rBKs
�z%converter.convert.<locals>.<listcomp>)#rS�beforerw�	setrevmapr{r#r"r�getheadsr�r�rr�r�r_r�ry�descr�r7rXr�r�ro�
configbool�gettagsr r��puttagsr�	iteritems�getbookmarks�putbookmarksr��cleanup)rarTr�r��t�numr�r`r�r��tags�ctags�k�v�nrev�tagsparents�	bookmarks�
cbookmarksr,r�r-�convertsj



�

�

�
�
zconverter.convertcCs4z|j��W|j��n|j��w|j��dSrj)rw�afterrSr{rqrpr,r,r-raszconverter.cleanupN)rrrsrtrcr~r�r�r�r�r.r�r�rrr,r,r,r-ru�s/
4Cruc
s�t����tjadt_��d�s��d��d<|s)t�|�d}|�td�|�t	||��d��}t
�|�}zt||��d���d��\}}Wnt
y\|jD]}t�|d	�qR�wd
}	�fdd�|	D�}
t|
�d
krut�td���|
r||
d}
n|}
|
dkr�|��s�t�td���|
dkr�|��s�t�td�����d�}|r�t�|||�}|�d	�|s�|��}t||||��}|�|
�dS)NsUTF-8rvsauthorss-hgsassuming destination %s
s	dest_typessource_typesrevT)r<r�r=r�csg|]	}��|�r|�qSr,r8)rAr+�rxr,r-rB�r�zconvert.<locals>.<listcomp>rs!more than one sort mode specifiedrr=s1--sourcesort is not supported by this data sourcer�s0--closesort is not supported by this data sourcesfilemap)r�byteskwargsrr4r r�defaultdestr"rrZr	�wrapconvertsinkrV�	Exception�created�shutil�rmtreer�rrF�hasnativeorder�hasnativecloser�filemap_source�setfilemapmoder�rur)
r#�srcrwr�rx�destc�srcc�defaultsortrN�	sortmodesrT�fmapr�r,rr-risT


�
�
��

rrj)NN)9�
__future__rr�r|r�mercurial.i18nr�mercurial.pycompatr�	mercurialrrrrr	r
�mercurial.utilsr�r
rrrrrr�	hgconvertrrrrzrHrGr��
bzr_source�convert_cvs�convert_git�darcs_source�gnuarch_source�mercurial_sink�mercurial_source�monotone_source�	p4_source�svn_sink�
svn_sourcer4r.r7r;rErWrVrZ�objectr[rurr,r,r,r-�<module>sb 4
	#�
�"

https://t.me/RX1948 - 2025