8Qc@sddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl Z ddlZddlZddlZddlZddlZddlZddlZeaejZdddfZdZdZdZdejfd YZd Zd Z d Z!d Z"dZ#dZ$dZ%e&e'dZ(dZ)dZ*de+fdYZ,de,fdYZ-de,fdYZ.de,fdYZ/ie-d6e.d6e/d6Z0dS(iN(t_ttemptycCsUtjtj|}tj|}|jsQtjtjj|j}n|S(sU get a path or url and if it is a path expand it and return an absolute path ( tutilt urllocalpatht expandpathturltschemetnormpathtostpathtabspath(R t expandedpathtu((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_expandedabspaths  !cCs tjt|jdd!S(sEget a unique filename for the store hash cache of a remote repositoryii (Rtsha1Rt hexdigest(t remotepath((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_getstorehashcachenamescCsSd}tjj|r@t|d}|j}|jntj|jS(NRtrb( R R texiststopentreadtcloseRRR(tfilenametdatatfd((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt _calcfilehashs   t SubrepoAbortcBseZdZdZRS(sEException class used to avoid handling a subrepo error more than oncecOs>tjj||||jd|_|jd|_dS(Ntsubrepotcause(terrortAbortt__init__tgetRR(tselftargstkw((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR!)s(t__name__t __module__t__doc__R!(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR'scsfd}|S(Ncsy|||}Wntk r1}|ngtjk r}t|}t|dtd|}t|d|jd|dtjnX|S(Nt s(in subrepo %s)thintRR( RRR t subrelpathtstrRR*tsystexc_info(R#R$tkargstrestexRterrormsg(tfunc(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytdecoratedmethod/s  ((R3R4((R3s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytannotatesubrepoerror.s cstjddfddkrCdnx?jdD].\}}jd||jd|qSWi}dkrhyxtdjjD]{\}}|j}|sqny|j dd\}}Wn.t k r't j t d|dnX|||R=tstatetkindtparenttjoinedtremapped((R?R@RRAs5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRg>s\   & )          2cCsQgt|D]}d||d|f^q }|jddj|ddS(s=rewrite .hgsubstate in (outer) repo with these subrepo statess%s %s is .hgsubstateRN(tsortedtwwriteR`(trepoRgtstlines((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt writestates1cs.||kr|j}n|j}|j}|j}i}jjd|||fdfd} xt|jD]\} } |j| t} | } |j| j r| d| ddf} n||kr| } n| |krv|| }| |ks|| kr%| || return instance of the right subrepo class for subrepo in pathiNisunknown subrepo type %s( RLtscmutilt pathauditorR]RRwttypesRR R(R?R thRg((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR3s   tabstractsubrepocBseZdZedZdZdZdZdZedZ dZ dZ d Z d Z d Zd Zd ZdZdZdZddZdZdZdZRS(cCstS(s returns true if the repository has not changed since it was last cloned from or pushed to a given repository. (R^(R#R ((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt storecleanGscCs tdS(sreturns true if the dirstate of the subrepo is dirty or does not match current stored state. If ignoreupdate is true, only check whether the subrepo has uncommitted changes in its dirstate. N(tNotImplementedError(R#t ignoreupdate((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRzNscCs tdS(spcurrent working directory base state, disregarding .hgsubstate state and working directory modificationsN(R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt basestateUscCstS(s7check if path is a subrepository within this repository(R^(R#R ((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt checknestedZscCs tdS(scommit the current changes to the subrepo with the given log message. Use given user and date if possible. Return the new state of the subrepo. N(R(R#ttexttusertdate((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytcommit^scCs tdS(sTremove the subrepo (should verify the dirstate is not dirty first) N(R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR}escCs tdS(sTrun whatever commands are needed to put the subrepo into this state N(R(R#RgR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR"lscCs tdS(s/merge currently-saved state with the new state.N(R(R#Rg((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR|rscCs tdS(shperform whatever action is analogous to 'hg push' This may be a no-op on some systems. N(R(R#topts((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRvscCsgS(N((R#RAtmatchtdryrunt listsubrepostprefixt explicitonly((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytadd}scKsgggggggfS(N((R#trev2R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytstatusscKsdS(N((R#RAtdiffoptstnode2RRR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytdiffscCsdS(Ni((R#RAtdestR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytoutgoingscCsdS(Ni((R#RARGR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytincomingscCs tdS(sreturn filename iteratorN(R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytfilesscCs tdS(sreturn file dataN(R(R#tname((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytfiledatascCsdS(sreturn file flagsR((R#R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt fileflagssc Cs\|dk r:g|jD]}||r|^q}n |j}t|}t|}|jtd|ddtdd|xt|D]\} } |j| } d| krdpd} d | k} |jt j j ||j | | | |j | |jtd|| d dtdd|qW|jtd|d|S( Nsarchiving (%s)itunitRttotaltxiiRei(RQRRR+tprogressRRURtaddfileR R R`RR(R#RAtarchiverRRR;RRtrelpathRdRtflagstmodetsymlink((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytarchives" .    cCsdS(sv walk recursively through the directory tree, finding all files matched by the match function N((R#R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytwalkscCs ggfS(N((R#RARR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytforgetscOs#|jd|d|dfgS(Ns)%s: reverting %s subrepos is unsupported ii(R9(R#RARwtpatsR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytreverts N(R&R'RR^RzRRRR}R"R|RRRRRRRRRRQRRRR(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyREs*                    t hgsubrepocBsveZdZdZdZdZdZdZedZ edZ edZ ed Z edd Zeed Zd Zd ZedZedZdZeedZedZedZedZedZedZdZdZdZedZedZ dZ!RS(c Cs ||_||_|j}|j|}t}tjjtjj|dsgt }t j |nt j |j|d||_xNdgD]C\}}|jj||} | r|jjj||| qqW|jjjddd|j||d|dS( Ns.hgtcreateRAtcommitsubrepost_usedassubrepotTruei(suiR(Rt_stateR]twjoinR^R R RR`RRtmakedirsRLt repositorytbaseuiRARPt setconfigt _initrepo( R#R?R RgRtRRRotktv((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR!s   ! cCst}|jj}|j|}y:x3|j|D]"}||jkr7t}Pq7q7WWntk rwt}nX|ry|jt}Wqtk rqXn|j|S(N( RR]tlockt_calcstorehasht_readstorehashcachetnextR^t StopIterationtrelease(R#R tcleanRt itercachetfilehash((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs$       ccs]d}dt|VxA|D]9}tjj|jj|}d|t|fVqWdS(scalculate a unique "store hash" This method is used to to detect when there are changes that may require a push to a given remote path.t bookmarkssstore/phaserootssstore/00changelog.is# %s s%s = %s N(s bookmarkssstore/phaserootssstore/00changelog.i(RR R RR]R`R(R#Rtfilelisttrelnametabsname((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs  cCs(|jjtjjddt|S(s*get a unique path for the store hash cachetcachet storehash(R]R`R R R(R#R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_getstorehashcachepathscCsN|j|}tjj|s%dSt|d}|j}|j|S(s7read the store hash cache for a given remote repositoryRRt(RR R RRt readlinesR(R#Rt cachefileRt pullstate((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs  cCs|j|}|jj}t|j|}tjj|}tjj|smt j |dt nt |d}|j ||j|jdS(scache the current store hash Each remote repo requires its own store hash cache, because a subrepo store may be "clean" versus a given remote repo, but not versus another t notindexedtwN(RR]RtlistRR R RRRRRRt writelinesRR(R#RRRRtcachedirR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_cachestorehashs  cs|j_|j_|rjjdddtjdfd}tjdt}tjtdt}|d|||kr|d|njndS( NthgrcRRs[paths] cs=|r9jd||fjjjd||ndS(Ns%s = %s R(twriteR]RAR(tkeytvalue(tfpR#(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt addpathconfigsRORs default-push( R]RRtopenerRRR\R^R(R#t parentrepoRGRRtdefpatht defpushpath((RR#s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs     c Cs4tj||j|||tjj||j|S(N(tcmdutilRR]R R R`R(R#RARRRRR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR$scKsyA|jd}|j|}|j|}|jj|||SWnUtjk r}|jjjtd|t|fgggggggfSXdS(Nis*warning: error "%s" in subrepository "%s" ( RR]RRtRepoLookupErrorRAR9RR+(R#RRtrev1RRtinst((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR)s   c Ksyutj|jd}|dk r7tj|}ntj||j||||dtj||j dt |Wn?t j k r}|jj jtd|t|fnXdS(NiRRs*warning: error "%s" in subrepository "%s" (tnodetbinRRQRtdiffordiffstatR]R_R`RRRRRAR9RR+( R#RARRRRRtnode1R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR5s  c Cs|j|jdtj|||||}|jd}|j|}x`|jD]U}t||} tj||} || j||t j j ||j | 7}qSW|S(NRLi(shg( t_getRRRR]RwRtmatchmodt narrowmatcherR R R`R( R#RARRRRRcR?RRotsubmatch((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyREs   )cCs^|jd}|dkr$| r$tS|jd}||jjkrT| rTtS|jS(NiR(RRR]RQRvthexRz(R#RRtR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRzRs  cCs|jdjS(Nt.(R]R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR]scCs|jj|jj|S(N(R]t _checknestedR(R#R ((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR`scCsy|jts |jdjS|jjjdt||jj|||}|sl|jdjStj|S(NRscommitting subrepo %s ( RzRR]RRARrR+RR(R#RRRtn((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRcscCs@|jjjtdt|tj|jtjt dS(Nsremoving subrepo %s ( R]RAtnoteRR+RLRRtnullidR^(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR}os#c Cs|\}}}||jkr||j_t|j}tj|ji|}t|jdkr|jjjtdt ||f|jj }t j |jj tj|jj ji||jjdt\}}|j|_|j||dt|j|q|jjjtdt ||f|j|} |jd} |jj|tj|jj|j| || r|j|qndS(Niscloning subrepo %s from %s RRspulling subrepo %s from %s R(R]RR\RLtpeerRRARRR+RtshutiltrmtreeR tcloneRRR^RRRRRtlistkeystpullRtupdatefromremote( R#RgRGRfRhtsrcurltotherRtclonedtcleansubtremotebookmarks((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR vs2   cCsP|j||\}}}|jjjd|jtj|j||dS(Nsgetting subrepo %s (R R]RARrRRLt updaterepo(R#RgRRGRfRh((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR"s csjjdjdjfd}jd}jrkrtjj|jr|qq|n|dS(NRicskr[jjkr[jjjdttjjdnfkrjjjdtn:jjjdttjjddtdS(Nsupdating subrepo %s isskipping subrepo %s smerging subrepo %s tremind( tbranchR]RARrR+RLRR|R^((tanctcurtdstR#Rg(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt mergefuncs$  (R R]tancestorRQRzRRA(R#RgR(R~((R%R&R'R#Rgs5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR|s     $  c CsG|jd}|jd}|jd}|jd}|j}x6t|D](}|j|j|dkrPtSqPWt|jt}|s|j |r|jj j t dt ||fdSn|jj j t dt ||ftj|ji|d6|} |jj| |d|} |j|| S( Ntforcet new_branchtsshRis4no changes made to subrepo %s since last push to %s spushing subrepo %s to %s t newbranch(R"R]RwRlRFRR^R\RRRARRR+RQRLRR( R#RR*R-R,tctsubsRotdsturlRR0((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs*     cCs%tj||jt|jt|S(N(RLRR]R\R(R#RARR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRscCs%tj||jt|jt|S(N(RLRR]R\R^(R#RARGR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRscCs$|jd}|j|}|jS(Ni(RR]tmanifest(R#RcR?((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs  cCs"|jd}|j||jS(Ni(RR]R(R#RRc((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs cCs'|jd}|j|}|j|S(Ni(RR]R(R#RRcR?((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs  cCs|jd}|j|S(N(R]RQR(R#RR?((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs cCs.tj||j|tjj||jtS(N(RRR]R R R`RR(R#RARR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRscOs|jtd|d|jds|j}d|d<|d|ddg}ng}tj||j||||dS(NRcR3sset:modified()(R]tdirstatetparentsR"RR(R#RARRR?R7((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR5 s  N("R&R'R!RRRRRR5RRRRRQRR^RzRRRR}R R"R|RRRRRRRRRR5(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs@             t svnsubrepocBseZdZdedZedZdZdZdZ edZ dZ e d Z e d Ze ed Ze d Zd Ze dZdZRS(cCsh||_||_||_|jj|_tjd|_|jsdtj t d|jndS(Ntsvns+'svn' executable not found for subrepo '%s'( RRt_ctxR]RAt_uiRtfindexet_exeR R(R#R?R Rg((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR!s    Rc Cs|jg}i}|jjsQtj|d<|ddkrQ|jdqQn|j||dk rtj j |j j j |j|}|j|nttj}|jd}|r||d<|d=nd |d tm((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt _svnversionBs !cCs|jddg\}}tjjj|}|jd}d\}}|rt|djdpmd}|djd}|rt|djdpd}qn||fS( Ntinfos--xmltentryt0iRfR(RcRc(RZtxmltdomtminidomt parseStringtgetElementsByTagNameR,t getAttribute(R#R^R>tdoctentriestlastrevRctcommits((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_wcrevsJs %cCs|jdS(Ni(Rn(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_wcrevYsc Cs~|jddg\}}ggg}}}tjjj|}x|jdD]}|jd}|suqTn|djd} |djd} |jd} | d kr|j| n| d kr|j| n| dks| dkrT|j| qTqTWxT|D]L} xC|D];} | | ksJ| j| t j r"t t t |fSq"WqWt |t t |fS(sReturn (changes, extchanges, missing) where changes is True if the working directory was changed, extchanges is True if any of these changes concern an external entry and missing is True if any change is a missing entry. Rs--xmlRbs wc-statusititemtpropsR texternaltmissingRtnormalt unversionedtnone(RRtRuRr(RRvRt(RZRdReRfRgRhRiRMRZR RRtboolR^( R#R^R>t externalstchangesRsRjRKRoRpRqR text((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt _wcchanged\s,      "cCs:|jds6|jd|jks/|r6tSntS(Nii(R{RRnR^R(R#R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRzyscCsh|j\}}||krdy,|jdd|jd|fg|SWqdtjk r`qdXn|S(NRs%s@%si(RnRZRRR (R#RlRc((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs $c Cs!|j\}}}|s%|jS|rCtjtdn|ratjtdn|jdd|g\}}|jj|tj d|} | s|j stjtdntj|j dn| j d} |jj|jd d | gd| S( Nscannot commit svn externalss!cannot commit missing svn entriesRs-msCommitted revision ([0-9]+).sfailed to commit svn changesiiRs-r( R{RRR RRZR;RRER[RaRVtgroups( R#RRRtchangedt extchangedRst commitinfoR>tnewrev((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs"  &cCs|jr-|jjtd|jdS|jjtd|jd}|jjj|j}t j |d|yt j t j j|Wntk rnXdS(Ns-not removing repo %s because it has changes. sremoving subrepo %s cSst|tjk rntj|}|jtj@dkr@ntj|tj|jtjBtj|dS(Ni(R R}tstattst_modetS_IWRITEtchmodtS_IMODE(tfunctionR texcinfoRo((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pytonerrors#R(RzR;R9RRRR:R]RRRR t removedirsR RtOSError(R#RR ((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR}s   cCs|r|jddgndg}|jdkrD|jdn|jd|d|df|j|d t\}}tjd |sd |kr|jd ttfkr|j|j |d tdSt j |p|j dn|j j|dS(NRs --recursiveR?iis--forces%s@%siRVsChecked out revision [0-9]+.s-is already a working copy for a different URLiRi(ii(RZR`RMRRER[R{R^R}R"RR RVR;R(R#RgRR$RR>((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR"s   "cCs|jd}|d}|j}||kr|||kpH|jd}t|j||||r||j|tq|ndS(Nii(RRoR{RR;R"R^(R#RgtoldtnewtwcrevRz((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR|s    cCstS(N(R(R#R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRscCs|jdddgd}tjjj|}g}x}|jdD]l}t|jd}|dkrtqGndjd |jd dj D}|j |j d qGW|S( NRs --recursives--xmliRbRhtfileRcss*|] }|j|jkr|jVqdS(N(tnodeTypet TEXT_NODER(t.0R.((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pys sRsutf-8( RZRdReRfRgRhR,RiR`t childNodesRMRD(R#R^RjRRKRhR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs  cCs|jdg|dS(Ntcati(RZ(R#R((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs(R&R'R!R^RZt propertycacheR`RnRoR{RzRR5RR}R"R|RRR(((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR8s  $      t gitsubrepocBs:eZdZdZdedZdedZdeddZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZeedZdZeedZedZedZedZedZddZedZRS(cCsz||_||_||_tjjt|j||_|jj ||_ |j|_ |jj |_ |jdS(N(RR:RR R R`RR]RRt_abspathRRAR;t _ensuregit(R#R?R Rg((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR!s   ! cCs/y%d|_|jdg\}}WnXtk r}|jdksUtjdkr[nd|_|jdg\}}nXtjd|}|s|jj t ddSt |j d|j d|j d f}|dkrt jt d n%|dkr+|jj t d ndS(Ntgits --versionitntsgit.cmds ^git version (\d+)\.(\d+)\.(\d+)scannot retrieve git versioniiiis,git subrepo requires at least 1.6.0 or lateri(iii(iii(t_gitexecutablet _gitnodirRR7R RRER[R;R9RR\R]RR (R#toutR>RKR_tversion((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRs"  0  cCs|j|d|d|dS(NRItstreami(t_gitdir(R#RURIR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt _gitcommandscCs"|j|d|d|d|jS(NRIRtcwd(RR(R#RURIR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRsc Cs5|jjd|jdj|fd}|jjrMttjd}nt j |j g|ddd|d|dt j d t jd |}|r|jdfS|jjj}|j|jd kr(|jd kr(|d }|dkr||jfSt jd||j|jfn||jfS(sCalls the git command The methods tries to call the git command. versions prior to 1.6.0 are not supported and very probably fail. s %s: git %s R)RRDiRRIRERFRGiiscat-files symbolic-refsgit %s error %d in %sN(scat-files symbolic-ref(R;RrRR`RQtquietRR tdevnullRKRQRRRRRLRFRRatwaitRTR ( R#RURIRRterrpipeR@tretdatatcommand((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR s$&       cCs#tjjtjj|jd S(Ns.git(R R RR`R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt _gitmissingAscCs|jddgS(Ns rev-parsetHEAD(R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt _gitstateDscCs1|jdddg\}}|r-d}n|S(Ns symbolic-refRs--quiet(RRQ(R#tcurrentR>((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_gitcurrentbranchGs cCsO|jddd|g}|jdd}|jdtd}||S(NRtshows-ns isURL: (RRXtindexR(R#RRtlineRd((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt _gitremoteMscCs(|jdd|g\}}|dkS(Nscat-files-ei(R(R#RfRtcode((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_githavelocallySscCs"|jd||g}||kS(Ns merge-base(R(R#tr1tr2tbase((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_gitisancestorWscCs|jdddgdkS(NRPs--bools core.barettrue(R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt _gitisbare[scCs|jdddgdS(sThis must be run before git diff-index. diff-index only looks at changes to file stat; this command looks at file contents and updates the stat.s update-indexs-qs --refreshN(R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_gitupdatestat^scCsi}i}|jdddg}x|jdD]}|jd\}}|jd ru|jd ruq4n|jdr|jdrq4n|||<|j|gj|q4W||fS( screturns 2 things: a map from git branch to revision a map from revision to branchess for-each-refs--formats%(objectname) %(refname)s R)s refs/heads/s refs/remotes/s/HEAD(RRXRZtendswitht setdefaultRM(R#t branch2revt rev2branchRRRftref((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt _gitbranchmapds   cCsi}x|D]}|jdr(q n|jddd}|jdd|g}|r |jdd|g}||d||jdddf|jd}|dkr>d|| kr>|Sn||_t|S(Ns://t:iR(tfindRR\(R#RGtcolon((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR\s   cCs|jrZ|j|}|jjtd|j|f|jd||jgn|j|rmdS|jjtd|j|j df|j dg|j|st j td||jfndS(Nscloning subrepo %s from %s Rspulling subrepo %s from %s torigintfetchs)revision %s does not exist in subrepo %s ( RR\R;RRRRRRRRRR (R#RGRf((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt_fetchs cCs|jr|jddkS|jr-tS| rQ|jd|jkrQtS|j|jdddg\}}|dkS(NiRs diff-indexs--quietR(RRRRRRR(R#RRR((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRzs    cCs |jS(N(R(R#((s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyRscs|\}}s#jdSj|jrjdddgjkrjdddgdSnHjkrrjddgjdddgndSj\}}fdfd}|kr|dS|}d} xK|D]C} | d krVd gdS| r3| jd  r3| } q3q3W| r| gdSj|j } |d } | | krx'|D]} | | kr| } PqqWn| | kr| j d d d } d| | gndj || | | r{| | j krb| | gnjdd| gn|dS(NRPs core.baretfalsetresets--hardRcsGdg}r2jddg|jdnj||dS(NR?RRs-f(RRM(R$RW(RR#(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR?s  csGjjtdjjjtddgdS(Ns)checking out detached HEAD in subrepo %s s5check out a git branch if you intend to make changes s-q(R;R9RR((R?RfR#(s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyt rawcheckouts srefs/heads/masters refs/remotes/iRis-bR|s--ff( R}RRRRRRQRZRtkeysRXRR(R#RgRRGRhRRRRtfirstlocalbranchRRRR((R?RRfR#s5/sys/lib/python2.7/site-packages/mercurial/subrepo.pyR"s^                cCs|jr+tjtd|jnddd|g}tjj}|re|d|g7}n|rtj|d|ds<T$`     Z  U   vY