�
]�@s~ddkZddklZddklZlZddklZddkl Z l
Z
lZlZdefd��YZ
dS(i�N(tutil(thextnullid(t_(tNoRepotcommittconverter_sourcet checktooltconvert_gitcBs�eZeied�oed�Zn
ed�Zd�Zd
d�Z d�Z
d�Zd�Zd�Z
d �Zd
�Zd�Zd�ZRS(tunsetenvcCs�tiid�}|itid<z;|o ti|�\}}}|Snti|d�SWd|djotid=n|tid<XdS(NtGIT_DIRtrb(tostenvirontgettpathRtpopen3tpopentNone(tselftstnoerrt
prevgitdirtstdintstdouttstderr((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pytgitopens
cCsU|o-tid|i|f�\}}}|Sntid|i|fd�SdS(Ns
GIT_DIR=%s %sR(RRRR(RRRtsintsotse((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pyR#s%cCs+|i|�}|i�}||i�fS(N(Rtreadtclose(RRtfhtdata((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pytgitread*scCs�tt|�i||d|�tii|d�o|d7}ntii|d�pttd�|��nt dd�||_dS(Ntrevs/.gits/objectss&%s does not look like a Git repositorytgit(
tsuperRt__init__RRtisdirtexistsRRR(RtuiRR#((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pyR&/s
cCs||ip%|id�\}}|i�}n*|id|i�\}}|d g}|otitd���n|S(Ns"git rev-parse --branches --remotessgit rev-parse --verify %si�scannot retrieve git heads(R#R"t
splitlinesRtAbortR(Rtheadstret((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pytgetheads;s
cCsm|tt�jo
t��n|id||f�\}}|o#titd�||f��n|S(Nsgit cat-file %s %sscannot read %r object at %s(RRtIOErrorR"RR+R(RR#ttypeR!R-((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pytcatfileFs
#cCs/|i|d�}|i||f}||fS(Ntblob(R1t modecache(RtnameR#R!tmode((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pytgetfileNscCsvh|_|id|�}g}t�}d}x|i�id�D]�|p$|id�pqGn|}qGn|}||jo�|i|�|i�}|d}|ddjoti d��n|ddj} |dd j}
| od
p|
odpd|i||f<|i
||f�nd}qGW|i�oti td
�|��n|hfS(Ns git diff-tree -z --root -m -r %stt:iit160000s!git submodules are not supported!t100755t120000txtltscannot read changes in %s(
R3RtsetRRtsplitt
startswithtaddRR+tappendRR(RtversionR tchangestseententryR=tfthtpR((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pyt
getchangesSs6
/
cCs?|i|d�}|id�}||d}|i|�}|| i�}g}d}}x*|dD]} | idd�\}
}|
djod|i�}|d\}
}di|d �}|dd jo|dd
!}n|i|�}n|
djod|i�}|d\}
}di|d �}|dd jo|dd
!}n|i|�}n|
djo|i|�qiqiW|o||jo|d
|7}n|dd!d|dd!|d}}}t|�t|�dt|�}|
dt |�}t
d|d|d|d|d|�}|S(NRs
iit tauthori�it<i�t committertparents
committer: %s
i�i�t1itparentstdatetdescR#(R1tfindtrecodeR*RR@tjoinRCtinttstrR(RRDtctendtmessageR=RRRMROtetntvRJttmttzttzsttzhttzmRS((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pyt getcommitos@
"
"
*% cCsh}h}|id|i�}d}x]|D]U}|i�}|idd�\}}|i|�pq/n|||t|�<q/W|i�o ti t
d�|i��nxZ|D]R}|id�o||||d <q�|d|joq�q�||||<q�W|S(Nsgit ls-remote --tags "%s"s
refs/tags/iscannot read tags from %ss^{}i�(RRtstripR@RRAtlenRRR+Rtendswith(RttagstalltagsR tprefixtlinetnodettag((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pytgettags�s*
c Cs�g}|djob|id|�}x�|D]@}d|joq-n|d id�\}}|i|�q-WnK|id|||df�}g}|D]}||id�q�~}|i�otitd�|��n|S(Nsgit diff-tree --root -m -r %ss i�s1git diff-tree --name-only --root -r %s "%s^%s" --is
scannot read changes in %s( RRR@RCtrstripRRR+R( RRDtiRER R=tmRHt_[1]((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pytgetchangedfiles�s
*
c
Cs�h}d}t|�}hdd<dd<}x�|D]�}y�|i||dt�}xg|D]_}|i�}|idd�\}} | i|�pq`nd|| |f} ||| <q`WWq7q7Xq7W|S( Nsrefs/heads/sgit ls-remote --heads originsremote/sgit show-refR>Ris%s%s(RgRtTrueRfR@RRA(
Rt bookmarksRkt prefixlentgitcmdtreftypeR RlR#R4((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pytgetbookmarks�s(
N(t__name__t
__module__RtsafehasattrRtFalseRR"RR&R.R1R6RKReRoRtRz(((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pyRs # (Rt mercurialRtmercurial.nodeRRtmercurial.i18nRtcommonRRRRR(((s@/sys/lib/python/lib/python2.5/site-packages/hgext/convert/git.pys<module>s
"
|