��Pc@sMddlmZmZmZmZmZddlmZddlm Z ddl
Z
ddlZddlZddl
Z
yddlmZmZWn�ek
r/yddlmZmZWq0ek
r+yddlmZmZWq,ek
r'yddlmZmZWq(ek
r#q(Xq,Xq0XnXdeefd��YZdS(i�(tNoRepot checktooltcommandlinetcommittconverter_source(t_(tutilN(tElementTreet XMLParsertdarcs_sourcecBs�eZd
d�Zd�Zd�Zd
d�Zd�Zd�Zd�Z d�Z
d�Zd �Zd
�Z
d�Zd�ZRS(cCsktj|||d|�tj||d�tjjtjj|d��sfttd�|��nt d�|j
d�j�dj�}|dkr�t
jtd�|��nd t�kr�t
jtd
���ntjj|�|_d|_i|_i|_i|_|j�}|rQ|dkrgttd
�|��qgn|jjtd��dS(Ntrevtdarcst_darcss(%s does not look like a darcs repositorys --versionis2.1s,darcs version 2.1 or newer needed (found %r)Rs*Python ElementTree module is not availables darcs-1.0thasheds3%s repository format is unsupported, please upgrades#failed to detect repository format!(s darcs-1.0R
(Rt__init__RtostpathtexiststjoinRRRtrun0t
splitlineststripRtAborttglobalstrealpathtNonetlastrevtchangestparentsttagstformattuitwarn(tselfRRR
tversionR((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pyRs,!
c Cs:tjddtjj|j�d�|_|jdd|j�\}}|j|�|jddt dt d|j�}d}d}x�|jd �D]�}|jd
�}|j
dd�}|jd
�r�dj�}n"|dk r||j|<d}n||j|<|g|j|<|}q�Wg|j|<dS(Ntprefixsconvert-t-tinittrepodirRt
xml_outputtsummarytpatchthashtnametsTAG i(ttempfiletmkdtempRRtbasenamettmppathtrunt checkexittxmltTrueRtfindalltgettfindtextt
startswithRRRR( R!toutputtstatusttreettagnametchildtelttnodeR+((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pytbefore@s( #
cCs1|jjd|j�tj|jdt�dS(Nscleaning up %s
t
ignore_errors(RtdebugR0tshutiltrmtreeR4(R!((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pytafterWscCs:t|t�r!|jd�}ntt|�j||�S(Nslatin-1(t
isinstancetunicodetencodetsuperR trecode(R!tstencoding((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pyRJ[scKsdt�}tdd�}|j||�}|j|jd|�|j�|j|j�|j�S(NRLslatin-1tparser( RRt_runtparsetstdouttwaitR2t
returncodetgetroot(R!tcmdtkwargstetreeRMtp((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pyR3cs
cCs�|jdddtd|j�\}}|j|�tjd|tj�}|sVdSdjt d�|j
d�jd�D���S( Ntshowtrepotno_filesR&s^\s*Format:\s*(.*)$t,css|]}|j�VqdS(N(R(t.0tf((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pys <genexpr>xsi(R1R4RR2tretsearcht MULTILINERRtsortedtgrouptsplit(R!R9R:tm((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pyRqs
cCsxg}|jdddtd|j�\}}|j|�x7|jd�D]&}|d}|rJ|j|�qJqJW|S(NRXtfilestno_directoriesR&s
i(R1R4R0R2Rctappend(R!tmanR9R:tlineR((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pytmanifestzs
cCs|jdS(N(RR(R!((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pytgetheads�sc
Cs�|j|}tj|jd�d�}|jd�d|jdd�}td|j|jd��dtj|d �d
|j|�j�d|j |�S(Nt
local_dates%a %b %d %H:%M:%S %Z %YR+s
tcommentR,tauthortdates%Y-%m-%d %H:%M:%S %1%2tdescR(
RRtstrdateR6R7RRJtdatestrRR(R!R
R>RoRp((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pyt getcommit�s
#cCs�|jd|jdtdd|dtdtddd |j�\}}|r�|jd
�dkrt|j||�n|jddtd |j�\}}|j||�ndS(
Ntpulltalltmatchshash %stno_testtno_posthooktexternal_merges
/bin/falseR&sWe have conflicts ini�trevert(R1RR4R0tfindR2(R!R
R9R:((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pyRt�s
$c
Cs�i}g}d}xX|j|jd�j�D]:}|jdkrJq/n|jdkrM|dkrt|j�}n|jd�|jd�}}||kr�|j||f�|j||f�|||<qi|d}x�|D]c}|j|�s�n|d|t |�} |j||f�|j| |f�||| <q�q/|j|j
j�|f�q/W|j|�||_
t|�|fS( NR(t
add_directorytremove_directorytmovetfromttot/(R|R}(RRR{tgetchildrenttagRjR6RgR8tlenttextRRtRRa(
R!R
tcopiesRRhR>tsourcetdestR]tfdest((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pyt
getchanges�s4#
cCs�||jkr'tjtd���ntjj|j|�}tj|�}tj |�j
}|d@rpdpsd}||fS(Nsinternal calling inconsistencyiItxR,(RRRRRRRR0treadfiletlstattst_mode(R!R+R
Rtdatatmode((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pytgetfile�scCs|jS(N(R(R!((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pytgettags�sN(t__name__t
__module__RRR@RERJR3RRjRkRsRtR�R�R�(((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pyR s" (tcommonRRRRRtmercurial.i18nRt mercurialRRRCR-R^txml.etree.cElementTreeRRtImportErrortxml.etree.ElementTreetelementtree.cElementTreetelementtree.ElementTreeR (((s7/sys/lib/python2.7/site-packages/hgext/convert/darcs.pyt<module>s"(0
|