�8�c@s�ddlZddlZddlZddlmZddlmZddlmZddlmZde fd��YZ
defd��YZd �Z
ed
eed�Zde fd
��YZdeed�Zd�ZdS(i�N(tutil(t_(thooktlogentrycBs eZdZd�Zd�ZRS(s�Class logentry has the following attributes:
.author - author name as CVS knows it
.branch - name of branch this revision is on
.branches - revision tuple of branches starting at this revision
.comment - commit message
.commitid - CVS commitid or None
.date - the commit date as a (time, tz) tuple
.dead - true if file revision is dead
.file - Name of file
.lines - a tuple (+lines, -lines) or None
.parent - Previous revision of this entry
.rcs - name of file as returned from CVS
.revision - revision number as tuple
.tags - list of tags on the file
.synthetic - is this a synthetic "file ... added on ..." revision?
.mergepoint - the branch that has been merged from (if present in
rlog output) or None
.branchpoints - the branches that start at the current entry or empty
cKst|_|jj|�dS(N(tFalset synthetict__dict__tupdate(tselftentries((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyt__init__$s cs?�fd�t�j�D�}dt��jdj|�fS(Nc3s&|]}d|�j|fVqdS(s%s=%rN(R(t.0tk(R(s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pys <genexpr>)ss%s(%s)s, (tsortedRttypet__name__tjoin(Rtitems((Rs7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyt__repr__(s(Rt
__module__t__doc__R
R(((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyRs tlogerrorcBseZRS((RR(((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyR,scCs_|jd�}|djd�}d}|dkr=|}n|d|djd|�}|S(sUReturn the repository path from a CVS path.
>>> getrepopath('/foo/bar')
'/foo/bar'
>>> getrepopath('c:/foo/bar')
'/foo/bar'
>>> getrepopath(':pserver:10/foo/bar')
'/foo/bar'
>>> getrepopath(':pserver:10c:/foo/bar')
'/foo/bar'
>>> getrepopath(':pserver:/foo/bar')
'/foo/bar'
>>> getrepopath(':pserver:c:/foo/bar')
'/foo/bar'
>>> getrepopath(':pserver:truc@foo.bar:/foo/bar')
'/foo/bar'
>>> getrepopath(':pserver:truc@foo.bar:c:/foo/bar')
'/foo/bar'
>>> getrepopath('user@server/path/to/repository')
'/path/to/repository'
t:i�t@it/(tsplittfind(tcvspathtpartst
atpositiontstarttrepopath((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pytgetrepopath/s tc8sJi��fd�}|jtd��g}tjd�}tjd�}tjd�} tjd�}
tjd�}tjd�}tjd �}
tjd
�}tjd�}tjd�}tjd
�}tjd�}tjd�}d}|d^kr�yFttjjdd��j �j
�}|}|dkrHd}nWn#tk
rnttd���nX|r�|j
tj�r�|tj7}ny+ttjjdd��j �j
�}Wq�tk
r�q�Xn|s�jjdd�}ng}d^}|r�tjjd�}tjj|�s>tj|�n|jd�|dg}g|D]'}|r^djtjd|��^q^}tjj|djg|D]}|r�|^q���}n|dkr�y�|jtd�|�tjt|��}xa|D]Y}tj|d�o@tj|d�o@tj|d �s|jtd!��g}PqqW|jtd"�t|��Wn*tk
r�}|jtd#�|�nX|r�|d$j}tj|d%�}q�nd&d'g}|rS|jd(|�tj t!|��}|j
d)�s.|d)7}n|rJ|tj |�}qS|}n|jd*d+g|�|r�|jd,|�n|j|�i}i}d-}t"} g|D]}!tj#|!�^q�}|jtd.�d/j|��|j$d0|||f�tj%d/j|��}"|"j&�}#x�t'r�#}$|$dkrHPn|"j&�}#|$j
d1�rp|$d$ }$n|d-kr�|j(|$�}%|%rC|%j)d2�}&i}|r7tj |&d3 �}'|'j*|�r�'t|�}'n|'j*d)�r�d2}'n|'j*d4�r|'d5}'n|'j+d6d)�}'d7}q,nd2}q,n|j(|$�}%|%rpt|%j)d2���n| j(|$�}%|%r�t|%j)d7���n|
j(|$�rj
t|$��qj
n�|d2kr|j(|$�}%|%s�td8���tj |%j)d2��}'d7}nX|d7kr?|j(|$�rj
i}d9}qj
n+|d9kro|
j(|$�}%|%r<g|%j)d7�jd�D]}(t-|(�^qy})t|)�}*|*d9kr�|*d7d-kr�|)d3d-kr�|)d3 |)d$})nt.|)�})|)|krg||)<n||)j|%j)d2��|%j)d7�||%j)d2�<qj
|j(|$�rTd:}qj
|j(|$�rj
d-}qj
n�d;kr�|j(|$�r�d:}qj
|j(|$�sj
t,td<���n�|d:krm |j(|$�}%|%s�,td=���t/d>||&�d?||'�d@t.g|%j)d2�jd�D]}(t-|(�^q% �dAgdBd^dd^d d^dt0��}d5}n�d5kr�j(|$�}%|%s�t,tdC���|%j)d2�}+|+d7d)kr�dD|+}+nt|+j��d9kr�dE}+ntj1|+dFdGdHg�|_||%j)d7��|_2|%j)d9�j3�dIk|_4|%j)d:�r�|%j)d5�r�t-|%j)d:��t-|%j)d5��f|_5q�-|%j)d:��d-f|_5n9|%j)d5�r�-t-|%j)d5��f|_5n d^|_5|%j)dJ�r|%j)dK�|_6n|%j)dL�r�|%j)dM�jd�},t|,�d7krVdN|_7q�dj|,d3 dO|,d3g�},g|D]}-||-|,kr~|-^q~}.t|.�d2ks�t,dP|j7��|.d-|_7ng|_8dJ}n�|dJkr�|j(|$�}/|/rmg|/j)d2�jdQ�D]:}(t.g|(j
�jd�D]}0t-|0�^q@�^q!|_9dK}qj
|j(|$�r�|j(|#�r�d:}t'} qj
|j(|$�r�d-}t'} qj
|j8j|$�n�|dKkrj
|j(|$�r9
|#}1|1j
d1�r
|1d$ }1n|j(|1�r&
d:}t'} qg
|j8j|$�qj
|j(|$�rW
d-}t'} qj
|j8j|$�n| r�j4r�j:d$d2kr�|j8�d2kr�j(|j8d-�r�j$dR|j;|j8d-f�t'|_<n| r,t"} t=g|j|j:g�D]}(||(�^q �|_>|d1j|j8��|_8t|j:�}*|*d9kr�|*d7d-kr�|j|j:d$ d^g�d-|_?n d^|_?t0�}2x�|j@�D]�\}3}4t.g|4jd�D]}5t-|5�^q��}6t|6�d7krq�n|6d3d-krN|6d$d7d-krN|6d3 |j:kr||2jA|3�q|q�|6d_kr�|6|j9kr||2jA|3�q|q�q�W|2|_B|j|�t|�dSd-kr�jtjCdTt|�|jDfdU�d1�q�,q,W|jEdVdW��i}7xq|D]i}|j:d$ }3|7j|j;|3fd^�}|d^krP|j:d3 }n||_F|j:|7|j;|3f<qW|r
|r|jEdVdX��|r�|d$j|d-jkr�ttdY���n||}|jtdZ�|�tjG|t|d[��q
|}n|jtd\�t|��tHjH|d^d]t'd*|�|S(`sCollect the CVS rlogcs�j||�S(s#return a shared version of a string(t
setdefault(ts(t_scache(s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pytscache\sscollecting CVS rlog
sRCS file: (.+)$scvs \[r?log aborted\]: (.+)$scvs (r?log|server): (.+)
$s>(Cannot access.+CVSROOT)|(can't create temporary directory.+)$sWorking file: (.+)$ssymbolic names:s (.+): ([\d.]+)$s----------------------------$sN=============================================================================$s(revision ([\d.]+)(\s+locked by:\s+.+;)?$s�date:\s+(.+);\s+author:\s+(.+);\s+state:\s+(.+?);(\s+lines:\s+(\+\d+)?\s+(-\d+)?;)?(\s+commitid:\s+([^;]+);)?(.*mergepoint:\s+([^;]+);)?sbranches: (.+);$s+file [^/]+ was (initially )?added on branchR!tCVSt
Repositoryt.snot a CVS sandboxtRoottCVSROOTs~/.hg.cvspsRtcachet-s\w+Rsreading cvs log cache %s
tbranchpointstcommitidt
mergepointsignoring old cache
scache has %d log entries
serror reading cache: %r
i�s%Y/%m/%d %H:%M:%S %1%2tcvss-qs-d%sRtlogtrlogs-d>%sisrunning %s
t sprefix=%r directory=%r root=%r
s
ii�sAttic/is/Attic/is)RCS file must be followed by working fileiiis!must have at least some revisionssexpected revision numbertrcstfiletrevisiontbranchestparents&revision must be followed by date linet19s UTCs%y/%m/%d %H:%M:%Ss%Y/%m/%d %H:%M:%Ss%Y-%m-%d %H:%M:%Stdeadiii i
tHEADt0sunknown branch: %st;s#found synthetic revision in %s: %r
ids%d %siPtkeycSs|j|jfS(N(R4R6(tx((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyt<lambda>�scSs|jS(N(tdate(R?((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyR@�ss>log cache overlaps with new log entries, re-run without cache.swriting cvs log cache %s
tws%d log entries
tcvslogN(iii(ItstatusRtretcompiletNonetopentostpathRtreadtstriptIOErrorRtendswithtseptenvirontgett
expandusertexiststmkdirRtfindalltnotetpickletloadRtsafehasattrtlent ExceptionRAtdatestrtappendtnormpathR Rt
shellquotetdebugtpopentreadlinetTruetmatchtgroupt
startswithtreplacetAssertionErrortintttupleRtsett parsedatetauthortlowerR:tlinesR.R/tcommentR7R6R4RR
ttagstbrancht iteritemstaddR-tellipsisR5tsortR8tdumpR(8tuit directorytrootR2R+R%R1tre_00tre_01tre_02tre_03tre_10tre_20tre_30tre_31tre_32tre_50tre_60tre_70t
file_added_retprefixtoldlogRAtcachedirt cachefileR#tetcmdtpRqt branchmaptstatetstoretargtpfptpeektlineRdR4tfilenameR?trevtrevntdtmyrevtbR7tmtytcpeekR-RrR6titrevpartstversions((R$s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyt createlogVs'
+
4.
!
"
1,
%1
0!! !)
Y
7& .$
:
t changesetcBs eZdZd�Zd�ZRS(s�Class changeset has the following attributes:
.id - integer identifying this changeset (list index)
.author - author name as CVS knows it
.branch - name of branch this changeset is on, or None
.comment - commit message
.commitid - CVS commitid or None
.date - the commit date as a (time,tz) tuple
.entries - list of logentry objects in this changeset
.parents - list of one or two parent changesets
.tags - list of tags on this changeset
.synthetic - from synthetic revision "file ... added on branch ..."
.mergepoint- the branch that has been merged from or None
.branchpoints- the branches that start at the current entry or empty
cKst|_|jj|�dS(N(RRRR(RR ((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyR
�s cs?�fd�t�j�D�}dt��jdj|�fS(Nc3s&|]}d|�j|fVqdS(s%s=%rN(R(RR(R(s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pys <genexpr>�ss%s(%s)s, (R
RRRR(RR((Rs7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyR�s(RRRR
R(((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyR��s i<cs6|jtd��i�x?|D]7}|jr t|j�j|j���|j<q q W|jd�fd��g}t�}d"�x�|�D]�}}�o�|j
�j
ko�|jd"k r�|j�jkp�|jd"ks�jd"ko�|j�jko�|j�jko�|j
�j
ko��jd�jd|jd|jdko��jd�jd|kno�|j|ksWtd|jd|jd|j
d |jd
gd|jd|j
d
|j��|j��t�}t|�ddkrWdt|�t|j�dd!f} |jtj| d�d�qWn�jj|�|j|j�|j�_q�Wx6|D].�t�j�dko��jdj�_q�Wd�}
x|D]��jj|
�q�Wd�}|j|�i�x@|D]8�x/�jD]$}x|jD]}��|<q-WqWq
Wx]|D]U�t�}
x!�jD]}|
j|j�qiWt��fd�|
D���_qPW|d"kr�d}n|r�tj|�}n|d"kr�}n|rtj|�}ni}i}t|�}d}xk||kr�||�x'�jD]}|||j|jf<qDWd"}�j
|kr�|�j
}nIxFt |�D]8}�j
||j
kr�|d"k r�Pq�q�n|}q�Wg�_!|d"k rj||}xT|jrGt|j!�dks$t"td���|j!r=|j!d}q�}Pq�d"k rj�j!j|�qjn�jr��jdkr�d"�_n�j!j||�j�n|rr|j#�j�}|rr|j$d�}|dkr�"}ny|||}Wn1t%k
r3|j&td�|�jf�nX||kro�j
|kro|jro�j!j|�qoqrn|rt|j#�j�}|rt|j'�r�|j$d�}|dkr�d"}q�nd"}||krq�j
|krqtd�jd|d �jdd�j
d
gdgd|||�g�}|j(|d|�|d||<|d7}|d7}q$qqqtn||�j
<|d7}q$Wd}x7|t|�kr�||jr�||=q�|d7}q�Wx't |�D]\}�|d�_)q�W|jtd�t|��t*j*|d"d t+d!|�|S(#sConvert log into changesets.screating changesets
R>cs7�j|j�|j|j|j|j|j|jfS(N(RQR.RpRmRrRAR-(R?(tmindate(s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyR@siiRpRmRrRAR R/R-R.ids%d %si�iPs
cSs�|jjd�}|jjd�}t|�}t|�}t||�}x�t|�D]x}|d|kr~||kr~dS|d|kr�||kr�d
S||||kr�dS||||krXd
SqXWdS(sMimic cvsps sorting orderRii�i(R5RRZtmintrange(tltrtnltnrtnR�((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyt
entitycompareHs cSst|j�t|j�}|r&|Si}x!|jD]}|j||j<q6Wi}x!|jD]}|j||j<q`Wd}xF|jD];}|j|jd�|jkr�|s�t�d}Pq�q�WxF|jD];}|j|jd�|jkr�|st�d}Pq�q�W|S(Niii�( tsumRAR R6R4RQRGR8Rh(R�R�R�tleR�RE((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pytcscmp_s*
c3s%|]}�|�kr|VqdS(N((Rttag(tct
globaltags(s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pys <genexpr>�ss{{mergetobranch ([-\w]+)}}s{{mergefrombranch ([-\w]+)}}s0synthetic changeset cannot have multiple parentsR;sBwarning: CVS commit message references non-existent branch %r:
%s
s&convert-repo: CVS merge from branch %sRqtparentsis%d changeset entries
t
cvschangesetst
changesetsN(,RDRR.R�RARQRvRkRGt enumerateR-RpRmRrR5R�R/R]RZtreprRRuR RtRRqRR
RERFR4R6txrangeR�RhtsearchRetKeyErrortwarntgroupstinserttidRRc(RxR1tfuzzt mergefromtmergetoR�R�tfilesR�ttR�R�R�RqR�R7R�tfR�t candidateR�tcc((R�R�R�s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pytcreatechangeset�s
, !$
&#
,
&
%
cOs!|drd}n|dr&d}nd }|d}yc|r|g}xP|D])}|t||d|dd|�7}qLWnt|d|dd|�}Wn%tk
r�}|jd|�d SXt|||d
�}~t|�} i}
i}x(|D] }|dry|j|
krf|jrf|jdjrf||jdjd
j|jdjf||j<n|j|
|j<n|dr�|jp�d|dkr�q�| s�|jd�|jd|j�|jdt j
|jd��|jd|j�|jd|jpd�|jdddgt|j
�d
kdj|j
�pQdf�|jr�|jddjt|j���n|dr
|jr
t|j�d
kr�jddjg|jD]}
t|
j�^q���q
|jd|jdj�n|dr�|j}g}x>|rc||\}}|jd |pNd||
|f�q&W|r�|jd!dj|��q�n|jd"�|jd#|j�|jd$�x�|jD]�}|j}|j|d%�r�t|d%�}n|jd&|d'jg|jD]}t|�^q�p5d(d'jg|jD]}t|�^qE�dd)g|jf�q�W|jd*�n|r�| r�|dt|j�ks�|d|j
kr�t} q�nt|�d
kr�r�d
t|j�ks|d
|j
krPqq�Wd S(+s�Read CVS rlog for current directory or named path in
repository, and convert the log to changesets based on matching
commit log entries and dates.
t new_cachetwritetupdate_cacheRt revisionsRzR+s%r
NR�t ancestorsiiR7R;s---------------------
s
PatchSet %d
s Date: %s
s%Y/%m/%d %H:%M:%S %1%2sAuthor: %s
sBranch: %s
sTag%s: %s
R!R#t,s(none)sBranchpoints: %s
s, R�sParents: %s
sParent: %d
s%s:%d:%dsAncestors: %s
sLog:
s%s
s
Members:
R�s %s:%s->%s%s
R(tINITIALs(DEAD)s
(RGR�RR�R�RZRrR�R�RR\RARmRqRR-R
tstrR]RpR R5RfR8R6R:R(RxtargstoptsR+R�R1R�R�R�toffR7R�tcsR�R�R�R�R�tfnR?((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyt
debugcvspss�
*
(#
% 3
(
1((RIREtcPickleRWt mercurialRtmercurial.i18nRRtobjectRR[RR RGRcR�R�R�R�(((s7/sys/lib/python2.7/site-packages/hgext/convert/cvsps.pyt<module>s '�
|