^cpddlZddlZddlZddlmZddlmZmZmZddl m Z ddl m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddl m!Z!m"Z"ddl#m$Z$ej%Z%Gd d Z&Gd d e&Z'Gd dZ(Gdde(Z)Gdde&Z*Gdde*Z+Gdde(Z,Gdde,Z-Gdde*Z.Gdde,Z/Gdde+Z0dZ1d Z2d!Z3Gd"d#e*Z4Gd$d%e,Z5Gd&d'e*Z6Gd(d)Z7dS)*N)_)hexnullrevshort)getattr)dagopencodingerrorfilesetmatch mergestatemetadataobsoletepatchpathutilphasesrepoviewscmutilsparsesubrepo subrepoutilutil)dateutil stringutil) timestampceZdZdZdZdZejeZdZ dZ dZ dZ dZ d Zd Zd Zd Zed ZdZdZdZdZdZdZdZdZdZd6dZdZdZdZ dZ!dZ"dZ#dZ$d Z%d!Z&d"Z'd#Z(d$Z)d%Z*ed&Z+d'Z,d(Z-d7d*Z.d+Z/d,Z0 d8d/Z1 d9d0Z2d1Z3d2Z4 d:d3Z5d;d4Z6d5Z7dS)<basectxaIA basectx object represents the common logic for its children: changectx: read-only context that is already present in the repo, workingctx: a context that represents the working directory and can be committed, memctx: a context that represents changes in-memory and can also be committed.c||_dSN_reposelfrepos 3/usr/lib/python3/dist-packages/mercurial/context.py__init__zbasectx.__init__<s  cDt|Sr )rnoder$s r& __bytes__zbasectx.__bytes__?sTYY[[!!!r(cRdt|jdt|dSN< >type__name__strr+s r&__repr__zbasectx.__repr__D( JJ///T;;r(c t|t|ko|j|jkS#t$rYdSwxYwNF)r3_revAttributeErrorr$others r&__eq__zbasectx.__eq__GsN ::e,Hej1H H   55 s/2 AAc||k Sr r<s r&__ne__zbasectx.__ne__MEM""r(c||jvSr  _manifestr$keys r& __contains__zbasectx.__contains__Psdn$$r(c,||Sr )filectxrFs r& __getitem__zbasectx.__getitem__Ss||C   r(c*t|jSr )iterrEr+s r&__iter__zbasectx.__iter__VsDN###r(c*|S)zBuilds a manifest that includes the given status results, if this is a working copy context. For non-working copy contexts, it just returns the normal manifest.)manifest)r$statuss r&_buildstatusmanifestzbasectx._buildstatusmanifestYs}}r(c|S)zfThis internal method provides a way for child objects to override the match operator. r@)r$r=r s r& _matchstatuszbasectx._matchstatus_s  r(c (d}|?||kr||}|||||}gg} }g} g} |j|j|j}} } t | ||}|D]\}}|vr || |"|\\}}\}}|| |E|| |]||kr||y||j j j vr|||| ||r||| || r,fd| D} fd|D}fd| D} tj|| | | | || S)z.build a status with respect to another contextN)r cleanc6g|]}|vr ||Sr@r@.0fnr mf1s r& z(basectx._buildstatus..:S==%=5599= ==r(c6g|]}|vr ||Sr@r@rXs r&r\z(basectx._buildstatus..r]r(cg|]}|v| Sr@r@)rYrZ deletedsets r&r\z(basectx._buildstatus..s#DDDbr/C/Cr/C/C/Cr()revrRdeletedunknownignoredsetdiffitemsappendr" nodeconstantswdirfilenodeidscmprrQ)r$r=sr listignored listclean listunknownmf2modifiedaddedremovedrVrbrcrddrZvaluenode1flag1node2flag2r`r[s ` @@r& _buildstatuszbasectx._buildstatusess 88:: !dhhjj599;;&>&>++A..C((++ ;++A..Cb%$%Iqy!)'\\ HHSYH 7 7 ! !IBZ} R   -2 *NUENUE} R    r""""%####dj6FFF ####beBi(( !#### R     E!G !G EDDDGDDDG~ eWgw   r(c@tj||jjSr )rstater"uir+s r&substatezbasectx.substates tz}555r(c(|j|dSNr)r~r$subpaths r&subrevzbasectx.subrevs}W%a((r(c|jSr )r:r+s r&raz basectx.revs yr(c|jSr )_noder+s r&r*z basectx.node zr(cDt|Sr )rr*r+s r&rz basectx.hex499;;r(c|jSr rDr+s r&rPzbasectx.manifest ~r(c|jSr ) _manifestctxr+s r& manifestctxzbasectx.manifestctxs   r(c|jSr r!r+s r&r%z basectx.reporr(cJtj|Sr )r phasenamesphaser+s r&phasestrzbasectx.phasestrs ..r(cF|tjkSr )rrpublicr+s r&mutablezbasectx.mutableszz||fm++r(Nc2tj||||S)N)badfn)r r )r$cwdexprrs r& matchfilesetzbasectx.matchfilesets}T3E::::r(c^|tj|jdvS)z!True if the changeset is obsoletesobsoleteraobsmodgetrevsr"r+s r&rzbasectx.obsoletes#xxzzV^DJ DDDDr(c^|tj|jdvS)z True if the changeset is extinctsextinctrr+s r&extinctzbasectx.extincts#xxzzV^DJ CCCCr(c^|tj|jdvS)z:True if the changeset is not obsolete, but its ancestor isorphanrr+s r&orphanzbasectx.orphans#xxzzV^DJ BBBBr(c^|tj|jdvS)zTrue if the changeset tries to be a successor of a public changeset Only non-public and non-obsolete changesets may be phase-divergent. sphasedivergentrr+s r&phasedivergentzbasectx.phasedivergents& xxzzV^DJ8IJJJJr(c^|tj|jdvS)zIs a successor of a changeset with multiple possible successor sets Only non-public and non-obsolete changesets may be content-divergent. scontentdivergentrr+s r&contentdivergentzbasectx.contentdivergents& xxzzV^DJ8KLLLLr(cz|p'|p|S)zTTrue if the changeset is either orphan, phase-divergent or content-divergent)rrrr+s r& isunstablezbasectx.isunstables4{{}}P 3 3 5 5P9N9N9P9PPr(cg}|r|d|r|d|r|d|S)zreturn the list of instabilities affecting this changeset. Instabilities are returned as strings. possible values are: - orphan, - phase-divergent, - content-divergent. rsphase-divergentscontent-divergent)rrhrr)r$ instabilitiess r&rzbasectx.instabilitiess ;;== ,   + + +     5  !3 4 4 4  " " 7  !5 6 6 6r(c|jS)z)return contexts for each parent changeset_parentsr+s r&parentszbasectx.parentss }r(c|jdSNrrr+s r&p1z basectx.p1s}Qr(cj|j}t|dkr|dS|jtS)Nr)rlenr"r)r$rs r&p2z basectx.p2s1- w<<1  1: z'""r(c<d|jvrS |j|S#t$r+t j|jpd|tdwxYwd|jvs||vr0||j vr'|j ||j |fS|j j } ||j j|\}}n8#t$r+t j|jpd|tdwxYw||fS)NrEsNonesnot found in manifest_manifestdelta)__dict__rEfindKeyErrorr ManifestLookupErrorrrfilesrflagsr" manifestlog _changesetrP)r$pathmflr*flags r& _fileinfozbasectx._fileinfosP $- ' ' ~**4000   /J)'43K1L1L  t} , , 0D0Dt***'-'--d33j$ T_56;;DAAJD$$   + %gtQ/G-H-H   Tzs%5A9(C""5Dc8||dSr)rr$rs r&filenodezbasectx.filenodes~~d##A&&r(cf ||dS#tj$rYdSwxYw)Nrr()rr LookupErrorrs r&rz basectx.flags!sC >>$''* *    33 s 00c*tj|Sr )rcomputechangesetcopiesr+s r&_copieszbasectx._copies's.t444r(c|jdSrrr+s r&p1copieszbasectx.p1copies+|Ar(c|jdSrrr+s r&p2copieszbasectx.p2copies.rr(Tc0tj|||S)z>return a subrepo for the stored revision of path, never wdir()) allowcreater)r$rrs r&subz basectx.sub1stT{CCCCr(c.tj|||Sr )r nullsubrepo)r$rpctxs r&nullsubzbasectx.nullsub5s"4t444r(c0tj||dS)z]return a subrepo for the stored revision, or wdir if this is a wdir context. T) allowwdirrrs r& workingsubzbasectx.workingsub8stTT::::r(globFc |j}|s|}tj|j||||||j||| S)N)auditorctx listsubreposr)r"getcwdmatchmodr root nofsauditor) r$patsincludeexcludedefaultrrrrs r&r z basectx.match>s[ J ((**C~ F     M%    r(c ||}| |j|}tj|j||||||||||  S)z;Returns a diff generator for the given contexts and matcherN)r changesopts losedatafnpathfncopycopysourcematch hunksfilterfn)rr"rrf) r$ctx2r rrrrrrrs r&rfz basectx.diffXsd <7799D  :d#Dz J  !+'    r(c4|jSr )rEdirsr+s r&rz basectx.dirsws~""$$$r(c6|j|Sr )rEhasdir)r$dirs r&rzbasectx.hasdirzs~$$S)))r(c |}|j|}d} t|tst|trd} ||}}|j|}|||}t jggggggg} ||| ||||} | r.t j| j| j | j ggg| j } |rt j ||D]\} | } n#t$rd} YnwxYwtj|} | | | |||d}dD]C}t#| |t#||}}|fd|DD| j| j | j | j| j| j| j | S)areturn status of files between two nodes or node and working directory. If other is None, compare this node with working directory. ctx1.status(ctx2) returns the status of change from ctx1 to ctx2 Returns a mercurial.scmutils.status object. Data can be accessed using either tuple notation: (modified, added, removed, deleted, unknown, ignored, clean) or direct attribute access: s.modified, s.added, ... FTN)r rdrVrcr)rqrrrsrbrcrdrVc3&K|] }d|fzV dS)s%s/%sNr@)rYfrs r& z!basectx.status..s,!J!Ja(gq\"9!J!J!J!J!J!Jr()r" isinstance changectx narrowmatchrTrrQrzrqrsrrrV itersubreposrrr subdirmatcherrextendsortrbrcrd)r$r=r rmrnrorctx1rreversedrrrev2submatchrlkrfilessfilesrs @r&rQzbasectx.status}so6z% $ ** $z$ /J/J $Ht$D &&u--!!$.. N2r2r2r2 6 6    !UKK     AIqwBAGA  K ' 4T4 @ @ K K  ;;w//DD    DDD  $1'5AAJJ"'#'!%  K KA&-Q]]GAqMMFFMM!J!J!J!J6!J!J!JJJJJ K         s4D  DDc0td|jz)z)Get a mergestate object for this context.z"%s does not implement mergestate())NotImplementedError __class__r$rVs r&rzbasectx.mergestates! 04> A   r(ct|dkpc||kp'|p| Sr)rrbranchr closesbranchrr+s r&isemptyzbasectx.isemptyss    ! # {{}} 0 0 2 22   "" zz||   r(r TNNNrFNN) NNNNNNNNN)NNFFFFF)8r4 __module__ __qualname____doc__r'r,r strmethod__str__r6r>rArHrKrNrRrTrz propertycacher~rrar*rrPrr%rrrrrrrrrrrrrrrrrrrrrrr rfrrrQrrr@r(r&rr4s"""!h ++G<<< ###%%%!!!$$$  @ @ @ D66]6)))   !!!///,,,;;;;EEEDDDCCCKKKMMMQQQ "   ### 0''' 55]5DDDD555;;;     8      >%%%*** ccccJ         r(rc\eZdZdZd(fd ZdZdZeZedZ edZ e dZ ed Z ed Zd Zd Zd ZdZdZdZdZdZefdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#d Z$d)d"Z%d*d$Z&d%Z'd&Z(d'Z)xZ*S)+rzA changecontext object makes access to data related to a particular changeset convenient. It represents a read-only context already present in the repo.Tctt||||_||_||_dSr )superrr'r:r_maybe_filtered)r$r%rar*maybe_filteredrs r&r'zchangectx.__init__s? i''---   .r(cj t|jS#t$rt|cYSwxYwr )hashr:r;idr+s r&__hash__zchangectx.__hash__s?  ?? "   d88OOO s 22c"|jtkSr )r:rr+s r& __nonzero__zchangectx.__nonzero__syG##r(c|jr|j}n|j}|j|Sr )r!r" unfiltered changelogchangelogrevisionrar#s r&rzchangectx._changeset sG   +:DD:((**D~// ;;;r(c4|jSr )rreadr+s r&rEzchangectx._manifests %%'''r(c:|jj|jjSr )r"rrrPr+s r&rzchangectx._manifestctxsz%do&>??r(c4|jSr )r readdeltar+s r&rzchangectx._manifestdeltas **,,,r(c|j}|jr|j}n|j}||j\}}|t kr't||||dgSt||||dt||||dgS)NFr") r"r!r+r* parentrevsr:rrr*)r$r%clrrs r&rzchangectx._parents!sz   -BB"",Bty))B ==dB EJJJK K dB E B B B dB E B B B  r(c\|j}|j|j|j|j|j|jfSr )rrPuserdater descriptionextrar$cs r& changesetzchangectx.changeset1s1 O J F F G M G   r(c|jjSr )rrPr+s r& manifestnodezchangectx.manifestnode<s ''r(c|jjSr )rr7r+s r&r7zchangectx.user? ##r(c|jjSr )rr8r+s r&r8zchangectx.dateBrAr(c|jjSr )rrr+s r&rzchangectx.filesEs $$r(ct|}||||t |Sr )rerdifference_update filesadded filesremovedsorted)r$rqs r& filesmodifiedzchangectx.filesmodifiedHsctzz||$$""4??#4#4555""4#4#4#6#6777hr(c|jj}d}|jjdkrd}n1|jjdd}|dkrd}n|dkrd}||rt j|}ng}|SNTschangeset-sidedataF experimentalscopies.read-fromschangeset-onlys compatibility)rrFr"filecopiesmoder}configrcomputechangesetfilesadded)r$rFcompute_on_nonesources r&rFzchangectx.filesaddedNs_/  : $(= = =#OOZ]))/;NOOF***"'+++!   %@FF  r(c|jj}d}|jjdkrd}n1|jjdd}|dkrd}n|dkrd}||rt j|}ng}|SrK)rrGr"rMr}rNrcomputechangesetfilesremoved)r$rGrPrQs r&rGzchangectx.filesremovedas3  : $(= = =#OOZ]))/;NOOF***"'+++#   "'DTJJ ! r(c |jj}|jj}d}|jjdkrd}n3|jjdd}|dkrd}n |dkrdx}}|$|rtt|j \}}n|i}|i}||fSrK) rrrr"rMr}rNr rr)r$rrrPrQrs r&rzchangectx._copiests?+?+ : $(= = =#OOZ]))/;NOOF***"'+++&**8   "%*9d%;%;%C"((#!H  H!!r(c|jjSr )rr9r+s r&r9zchangectx.descriptions **r(cdtj|jjdSNbranch)r tolocalrr:getr+s r&rzchangectx.branchs& 5 9 9) D DEEEr(cd|jjvSNscloserr:r+s r&rzchangectx.closesbranchs4?000r(c|jjS)z#Return a dict of extra information.r]r+s r&r:zchangectx.extras $$r(c@|j|jS)zReturn a list of byte tag names)r"nodetagsrr+s r&tagszchangectx.tagssz""4:...r(c@|j|jS)z%Return a list of byte bookmark names.)r" nodebookmarksrr+s r& bookmarkszchangectx.bookmarkssz'' 333r(c|j}|jr|j}n|j}||jSr )r"r!r+r* fast_rankr:)r$r%r5s r&rfzchangectx.fast_ranksCz   -BB"",B||DI&&&r(cV|jj|j|jSr )r" _phasecacherr:r+s r&rzchangectx.phases!z%++DJ BBBr(cD|jtj|jdvS)Nsvisible)r:r filterrevsr"r+s r&hiddenzchangectx.hiddensyH/ JGGGGr(cdSr9r@r+s r& isinmemoryzchangectx.isinmemoryur(chjjj}fd|DS)zreturn list of changectx contexts for each child changeset. This returns only the immediate child changesets. Use descendants() to recursively walk children. c*g|]}j|Sr@r!rYxr$s r&r\z&changectx.children..s)))! 1 )))r()r"r+childrenrr;s` r&rszchangectx.childrens9 J ) )$* 5 5))))q))))r(c#xK|jj|jgD]}|j|VdSr )r"r+ ancestorsr:)r$as r&ruzchangectx.ancestorssK%// <<  A*Q-      r(c#xK|jj|jgD]}|j|VdS)zrRecursively yield all children of the changeset. For just the immediate children, use children() N)r"r+ descendantsr:)r$rts r&rxzchangectx.descendantssM %1149+>>  A*Q-      r(Ncb|||}t|j||||S)z&get a file context from this changesetN)fileidrfilelog)rrJr")r$rrzr{s r&rJzchangectx.filectxs< >]]4((F JVtW    r(Fc F|j}||jdj}|jj|j|}|s|jjjn?t|dkr |dn"|jj ddD]M} tj |j|}n#tj $rY/wxYw||vrn&N|jj|j||r|jjt#dt%t%|jt%|fzdfdt)|Dz|jS) zreturn the "best" ancestor context of self and c2 If there are multiple candidates, it will show a message and check merge.preferancestor configuration before falling back to the revlog ancestor.Nrrsmergespreferancestors(note: using %s as ancestor of %s and %s r(c3bK|])}|ktdt|zV*dS)s: alternatively, use --config merge.preferancestor=%s N)rr)rYnancs r&rz%changectx.ancestor..sX 88 9 (( # $888r()rrr"r+commonancestorsheadsrinullidrr} configlistr revsymbolr RepoLookupErrorr*ancestorrQrrjoinrH)r$c2warnn2cahsrrrs @r&rzchangectx.ancestorsX :Q%Bz#88RHH **1CC YY!^^q'CCZ]--h8IJJ D D!+DJ::CC,Hhhjj$;;Ej*33DJCC  $$FGG ::uTZ'8'8%))DEhh "(  z#sB22CCcV|jj|j|jS)z.True if this changeset is an ancestor of other)r"r+ isancestorrevr:r<s r& isancestorofzchangectx.isancestorofs!z#11$)UZHHHr(cfd}tjj|}j|S)Generates matching file names.ctfdjDrdStdzdS)Nc3TK|]"}|kp|dzV#dS)/N) startswith)rYrlrZs r&rz.changectx.walk..bad..s<MM!275bmmAH55MMMMMMr(sno such file in rev %s)anyr~badr)rZmsgr r$s` r&rzchangectx.walk..badsZMMMMt}MMMMM  IIb!566= > > > > >r()rbadmatchr"rrEwalk)r$r rms`` r&rzchangectx.walk s\ ? ? ? ? ? ?  dj44U;;S A A~""1%%%r(c,||Sr )rr$r s r&matcheszchangectx.matchessyyr(rNNr)+r4rrrr'r&r(__bool__rrrEpropertyrrrr=r?r7r8rrIrFrGrr9rrr:rardrfrrkrmrsrurxrJrrrr __classcell__rs@r&rrs . . . . . . $$$H<<]<((](@@X@--]-   ]      ((($$$$$$%%%   && " " " "] "D+++FFF111%%%///444'''CCCHHH***          ++++ZIII & & &       r(rceZdZdZedZedZedZedZedZ dZ e Z dZ e je Zd Zd Zd Zd Zd ZdZedZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&d Z'd!Z(d"Z)d#Z*d$Z+d%Z,d&Z-d'Z.d(Z/d)Z0d*Z1d+Z2d,Z3d:d.Z4d/Z5d0Z6d;d1Z7d2Z8d3Z9d4Z:d5Z;d6Zd9Z?d-S)> basefilectxaPA filecontext object represents the common logic for its children: filectx: read-only access to a filerevision that is already present in the repo, workingfilectx: a filecontext that represents files from the working directory, memfilectx: a filecontext that represents files in-memory, c@|j|jSr )r"file_pathr+s r&_filelogzbasefilectx._filelog&sztz***r(cd|jvr|jSd|jvr||jS|j|jS)N _changectx_descendantrev)rrra_adjustlinkrevrrlinkrev_filerevr+s r& _changeidzbasefilectx._changeid*sa 4= ( (?&&(( (  . .&&t':;; ;=((77 7r(cd|jvr|j|jS|j|jS)N_fileid)rrlookuprrrrr+s r& _filenodezbasefilectx._filenode5s?  % %='' 55 5?++DJ77 7r(c@|j|jSr )rrarr+s r&rzbasefilectx._filerev<s}  000r(c|jSr rr+s r& _repopathzbasefilectx._repopath@s zr(cB |jdS#tj$rYdSwxYwNTF)rr rr+s r&r(zbasefilectx.__nonzero__Ds8  NN4    55 s  c d||jfzS#tj$rd|zcYSwxYw)Ns%s@%ss%s@???)rrr rr+s r&r,zbasefilectx.__bytes__NsX +tyy{{DO<< <  + + +tyy{{* * * * +s &A A cRdt|jdt|dSr.r2r+s r&r6zbasefilectx.__repr__Vr7r(cx t|j|jfS#t$rt |cYSwxYwr )r$rrr;r%r+s r&r&zbasefilectx.__hash__YsH T^455 5   d88OOO s 99c t|t|ko|j|jko|j|jkS#t$rYdSwxYwr9)r3rrr;r<s r&r>zbasefilectx.__eq___sf T d5kk)6J%+-6Neo5     55 s?A AAc||k Sr r@r<s r&rAzbasefilectx.__ne__irBr(c|jSr )rr+s r&filerevzbasefilectx.filerevl }r(c|jSr )rr+s r&rzbasefilectx.filenodeorr(c@|j|jSr )rrrr+s r&_flagszbasefilectx._flagsrs$$TZ000r(c|jSr )rr+s r&rzbasefilectx.flagsv {r(c|jSr )rr+s r&r{zbasefilectx.filelogyrr(c|jSr )rr+s r&razbasefilectx.rev|rr(c@|j|jSr )rrrr+s r&rzbasefilectx.linkrevs}$$T]333r(c4|jSr )rr*r+s r&r*zbasefilectx.node##%%%r(c4|jSr )rrr+s r&rzbasefilectx.hexs""$$$r(c4|jSr )rr7r+s r&r7zbasefilectx.userrr(c4|jSr )rr8r+s r&r8zbasefilectx.daterr(c4|jSr )rrr+s r&rzbasefilectx.files$$&&&r(c4|jSr )rr9r+s r&r9zbasefilectx.descriptions**,,,r(c4|jSr )rrr+s r&rzbasefilectx.branchs%%'''r(c4|jSr )rr:r+s r&r:zbasefilectx.extrarr(c4|jSr )rrr+s r&rzbasefilectx.phaserr(c4|jSr )rrr+s r&rzbasefilectx.phasestr'')))r(c4|jSr )rrr+s r&rzbasefilectx.obsoleterr(c4|jSr )rrr+s r&rzbasefilectx.instabilitiess,,...r(c4|jSr )rrPr+s r&rPzbasefilectx.manifestrr(c|jSr )rr+s r&rzbasefilectx.changectxs r(c|jSr _copiedr+s r&renamedzbasefilectx.renamed |r(c*|jo |jdSrrr+s r& copysourcezbasefilectx.copysources|/ Q/r(c|jSr r!r+s r&r%zbasefilectx.reporr(cDt|Sr )rdatar+s r&sizezbasefilectx.sizerr(c|jSr rr+s r&rzbasefilectx.pathrr(cr tj|S#t$rYdSwxYwr9)rbinaryrIOErrorr+s r&isbinaryzbasefilectx.isbinarysB $TYY[[11 1   55 s %( 66c.d|vS)Nxrr+s r&isexeczbasefilectx.isexectzz||##r(c.d|vSNlrr+s r&islinkzbasefilectx.islinkrr(cdS)zwhether this filectx represents a file not in self._changectx This is mainly for merge code to detect change/delete conflicts. This is expected to be True for all subclasses of basectx.Fr@r+s r&isabsentzbasefilectx.isabsents ur(Fc|jr||S|jtjd|j|jjr2|j|j|S| dz | kr2|j|j|S| | ks| dkr2|j|j|SdS)Vcompare with other file context returns True if different than fctx. Ns;filectx.cmp() must be reimplemented if not backed by revlogrT) _customcmprkrr ProgrammingErrorr"_encodefilterpatsrrrrr$fctxs r&rkzbasefilectx.cmps ? "88D>> ! > !(N  > !z+ F}((EEEyy{{Q$))++--}((EEE 99;;$))++ % %)=)==$$T^TYY[[AA Atr(Ncx|j}|j}|j}|}||kr|St |dd}d} |,d|jdD} d}n|g} ||| ||x}} ||vr| || ||} |j} |j } | D]g} | | |krdS| | }| |dvr;| ||d | kr| cSh|S)a|return the first ancestor of introducing If the linkrev of the file revision does not point to an ancestor of srcrev, we'll walk down the ancestors until we find one introducing this file revision. :srcrev: the changeset revision we search ancestors from :inclusive: if true, the src revision will also be checked :stoprev: an optional revision to stop the walk at. If no introduction of this file content could be found before this floor revision, the function will returns "None" and stops its iteration. _ancestrycontextNc6g|]}|Sr@rarYps r&r\z.basefilectx._adjustlinkrev..s @@@AEEGG@@@r(T inclusiver) r"r*r+rrrrrurrr.readfastrZ)r$srcrevrstoprevr%r5rlkr memberanciterancrevsfnoderrvacs r&rzbasefilectx._adjustlinkrevsgz __   (llnn S==JD"4d;;  >@@TZ%5%=%=%?%?@@@DII8D  "$,,tSI,"N"N NI i  ,,tSI,FFNE:D ! !&1w;;44WWQZZ2a5==BqE 3 3 5 5 9 9$ ? ???   r(cv||krdS||}|dS||kS)zBTrue if a filectx has been introduced after a given floor revisionTrNF)r _introrev)r$ changelogrevintrorevs r&isintroducedafterzbasefilectx.isintroducedafter.sC <<>>\ ) )4>>,>77  5<''r(c*|S)areturn the rev of the changeset which introduced this file revision This method is different from linkrev because it take into account the changeset the filectx was created from. It ensures the returned revision is one of its ancestors. This prevents bugs from 'linkrev-shadowing' when a file revision is used by multiple changesets. )rr+s r&rzbasefilectx.introrev7s~~r(c(d}t|}d|vr|j}nd|vr|j}|||d|Sd|vr'||j|}|||_|S|S)a? Same as `introrev` but, with an extra argument to limit changelog iteration range in some internal usecase. If `stoprev` is set, the `introrev` will not be searched past that `stoprev` revision and "None" might be returned. This is useful to limit the iteration range. NrrT)rrrr)varsrrrarrr)r$rtoprevattrsrs r&rzbasefilectx._introrevBsT  %  ^FF U " "_((**F  &&vw&OO O  & &**4+>*PPH#!)O<<>> !r(c|}||kr|S|||S)zzReturn filectx having identical contents, but pointing to the changeset revision where this filectx was introduced)changeid)rrarJr)r$rs r& introfilectxzbasefilectx.introfilectx_sG==?? 88:: ! !K||DMMOOh|???r(c@t|j|||}dt|vsdt|vr0||_t |dd|_n3dt|vr"|j|_t |dd|_|S)z@create parent filectx keeping ancestry info for _adjustlinkrev()rzr{rrrNr)rJr"rrarrr)r$rrzr{rs r&_parentfilectxzbasefilectx._parentfilectxgstz4HHH $t** $ $ T (B(B #'((**D $+D2Dd$K$KD ! ! d + +"&"5D $+D2Dd$K$KD ! r(c \jjjj}fd|D}j}|rC|d|d|dj|dffd|DS)NcDg|]}|jjjk|fSr@r"rir)rYr*rflr$s r&r\z'basefilectx.parents..{s=   tz/666D" 666r(rrcFg|]\}}}|||Sr@)r)rYrr lr$s r&r\z'basefilectx.parents..s1MMMeQ##D%33MMMr()rrrrrinsertr"r)r$rplrrr#s` @@r&rzbasefilectx.parentsws  ]-''77          JJt~ & & > IIa!A$!djooad&;&;< = = =MMMM"MMMMr(c6|dSr)rr+s r&rzbasefilectx.p1s||~~a  r(c|}t|dkr|dSt|j|jd|jS)Nrrr)rrrJr"rr)r$rs r&rzbasefilectx.p2sD LLNN q66Q;;Q4Ktz4:b$-PPPPr(ctjfdfd}}t|ddjj}|4|d| Dd}n*||gd}||_ tj ||||S) aDReturns a list of annotateline objects for each line in the file - line.fctx is the filectx of the node where that line was last changed - line.lineno is the line number at the first appearance in the managed file - line.text is the data on that line (including newline character) c8j|Sr )r"r)rrr$s r&z&basefilectx.annotate..sTZ__Q-?-?r(cj}sfd|D}|D]-}d|jvr"||_.|S)Nchg|].}|k,|/Sr@)r)rYrrs r&r\z9basefilectx.annotate..parents..s3<<.parentssz KKB =<<<<<<< 2 2!QZ//!'!1!1AJIr(rNc6g|]}|Sr@rrs r&r\z(basefilectx.annotate..s 555QUUWW555r(Tr)skiprevsdiffopts) r lrucachefuncrrr"r*r+rarurrr annotate) r$r0r3r4rbaser5rr1s `` @r&r6zbasefilectx.annotates "#?#?#?#?@@      *  "" 4+T 2 2 :&&((2Bxxzz!\\55dllnn555"\\488::,$\??$&D !~ 'Hx    r(c#Ki}|}|rd}nd} |d|D]-}||||f<.|sdS|t |}|Vur)rrrpopmax)r$ followfirstvisitr<cutparents r&ruzbasefilectx.ancestorss   CCC ))++dsd+ F F?Ev~~''):):;<<  #e**%%AGGG  r(c|j||S)zReturns `data()` after running repository decoding filters. This is often equivalent to how the data would be expressed on disk. )r" wwritedatarrr+s r& decodeddatazbasefilectx.decodeddatas, z$$TYY[[$))++>>>r()FNr )FNNr)@r4rrrrrrrrrr(rr,r rrr6r&r>rArrrrr{rarr*rr7r8rr9rr:rrrrrPrrrr%rrrrrrrrkrrrrrrrrrr6rurAr@r(r&rrs++]+88]888]8 11]1]H+++ !h ++G<<< ###11]1444&&&%%%&&&&&&'''---(((''''''******///***000    $$$$$$J'''R3333j(((    """":@@@ NNN0!!!QQQ 0 0 0 0 d ?????r(rcteZdZdZ d dZedZd dZdZdZ dZ d Z ed Z d Z dS)rJz^A filecontext object makes access to data related to a particular filerevision convenient.Nc||_||_|||Jd|||fz|||_|||_|||_| ||_dSdS)z`changeid must be a revision number, if specified. fileid can be a file revision or node.Ns.bad args: changeid=%r, fileid=%r, changectx=%r)r"rrrrr)r$r%rrrzr{rs r&r'zfilectx.__init__s    F$6):O:O <   @  ;P:O:O  #DM  %DN  'DO  !DLLL  r(c |j|jS#tj$r'|j|jcYSwxYwr )r"rr FilteredRepoLookupErrorr*r+s r&rzfilectx._changectxsW ;:dn- -, ; ; ;":((**4>: : : :# ;s3A  A cHt|j|j||j|S)zMopens an arbitrary revision of the file without opening a new filelog)rzr{rrJr"rr)r$rzrs r&rJzfilectx.filectxs0 J JM     r(c@|j|jSr )rrawdatarr+s r&rIzfilectx.rawdata(s}$$T^444r(c@|j|jS)zlow-level revlog flags)rrrr+s r&rawflagszfilectx.rawflags+s}""4=111r(c@ |j|jS#tj$rm|jjdddkrYdStjtdt|jztdwxYw)Nscensorspolicysignorer(scensored node: %ss"set censor.policy to ignore errors)hint) rr.rr CensoredNodeErrorr"r}rNAbortrrr+s r&rz filectx.data/s =%%dn55 5&   z}##Iy99YFFss+&''%*?*??<==  s!3BABc@|j|jSr )rrrr+s r&rz filectx.size:s}!!$-000r(cv|j|j}|sdS||kr|S|}|j}|jD]4} |||krdS #tj $rY1wxYw|S)a#check if file was actually renamed in this changeset revision If rename logged in file revision, we report copy for changeset only if file revisions linkrev points back to the changeset in question or both changeset parents contain different file revisions. N) rrrrarrrrrr r)r$rnamer rs r&rzfilectx._copied=s-''77 4 88:: ' 'Nyy{{((**  A AJJt,,,,44-$    sB$$B65B6c^jj}fd|DS)NcTg|]$}tjj|j%SrrGrqs r&r\z$filectx.children..Zs@    DJ 1dm L L L   r()rrsrr;s` r&rszfilectx.childrenWsE M " "4> 2 2        r()NNNNr )r4rrrr'rrrJrIrKrrrrsr@r(r&rJrJs  """"@;;];,     555222   111]2     r(rJcFeZdZdZ d%fd ZdZdZejeZ dZ e Z e dZ e d Ze d Zd Zd Zd ZdZdZdZdZdZdZdZeZeZeZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'd Z(d!Z)d&d$Z*xZ+S)'committablectxzA committablectx object provides common functionality for a context that wants the ability to commit, e.g. workingctx or memctx.r(Nctt||d|_d|_||_|rt j||_|r||_ |r||_ i|_ |r| |_ |tj||j d<|j ds d|j d<dSdS)NrXsdefault)r rWr'r:r_textr parsedate_date_user_status_extrarr fromlocalrZ r$r%textr7r8r:rrrs r&r'zcommittablectx.__init__ds nd##,,T222    2!+D11DJ  DJ  #"DL  '**,,DK  %-%7%?%?DK "{y)) 0%/DK " " " 0 0r(c<t|jddzS)Nr+)bytesrr+s r&r,zcommittablectx.__bytes__sT]1%&&--r(c(|jjjdSr r"riwdirhexr+s r&rzcommittablectx.hexs  ((((r(cdSNTr@r+s r&r(zcommittablectx.__nonzero__tr(c4|jSr )r"rQr+s r&r]zcommittablectx._statussz  """r(c>|jjSr )r"r}usernamer+s r&r\zcommittablectx._usersz}%%'''r(ct|jj}|dd}|tj}|S)Nsdevels default-date)r"r} configdatermakedate)r$r}r8s r&r[zcommittablectx._dates6 Z]}}X77 <$&&D r(cdSr r@rs r&rzcommittablectx.subrevrjr(cdSr r@r+s r&r?zcommittablectx.manifestnoderjr(cL|jp|jjSr )r\r"r}rmr+s r&r7zcommittablectx.usersz5TZ]33555r(c|jSr )r[r+s r&r8zcommittablectx.daterr(c|jSr )rYr+s r&r9zcommittablectx.descriptionrr(cht|jj|jjz|jjzSr )rHr]rqrrrsr+s r&rzcommittablectx.filess0 L !DL$6 69M M   r(c|jjSr )r]rqr+s r&rqzcommittablectx.modifieds |$$r(c|jjSr )r]rrr+s r&rrzcommittablectx.addeds |!!r(c|jjSr )r]rsr+s r&rszcommittablectx.removed |##r(c|jjSr )r]rbr+s r&rbzcommittablectx.deletedrzr(c@tj|jdSrW)r rYr^r+s r&rzcommittablectx.branchs I 6777r(cd|jvSr\r^r+s r&rzcommittablectx.closesbranchs4;&&r(c|jSr r~r+s r&r:zcommittablectx.extrarr(cdSr9r@r+s r&rmzcommittablectx.isinmemoryrnr(cgSr r@r+s r&razcommittablectx.tags r(cg}|D])}||*|Sr )rrrd)r$brs r&rdzcommittablectx.bookmarkss@  $ $A HHQ[[]] # # # #r(ctj|jj}|D]$}t ||}%|Sr )rnewcommitphaser"r}rr:r)r$rrs r&rzcommittablectx.phasesK%djm44 * *Aqwwyy))EE r(cdSr9r@r+s r&rkzcommittablectx.hiddenrnr(cgSr r@r+s r&rszcommittablectx.childrenrr(cd|jvr, |j|S#t$rYdSwxYw ||S#t $rYdSwxYw)NrEr()rrErr _flagfuncOSErrorrs r&rzcommittablectx.flagss $- ' ' ~++D111   ss  >>$'' '   33 s% 33A AAcB|jd|S)z1return the "best" ancestor context of self and c2r)rr)r$rs r&rzcommittablectx.ancestors}Q((,,,r(c#K|jD]}|V|jjd|jDD]}|j|VdS)Nc6g|]}|Sr@rrs r&r\z,committablectx.ancestors..s , , ,QUUWW , , ,r()rr"r+ru)r$rrvs r&ruzcommittablectx.ancestorssz  AGGGG%// , ,dm , , ,    A*Q-      r(cdS)aQPerform post-commit cleanup necessary after committing this ctx Specifically, this updates backing stores this working context wraps to reflect the fact that the changes reflected by this workingctx have been committed. For example, it marks modified and added files as normal in the dirstate. Nr@)r$r*s r& markcommittedzcommittablectx.markcommittedsr(FTcdSr9r@)r$missingmergers r&dirtyzcommittablectx.dirtyrnr()r(NNNNNFTT),r4rrrr'r,rr rrr(rrr]r\r[rr?r7r8r9rrqrrrsrbrIrFrGrrr:rmrardrrkrsrrrurrrrs@r&rWrW`sp??   000000:...)))!h ++GH##]#((](]666   %%%"""$$$$$$MJL888'''     ---      r(rWc4eZdZdZ d$fd ZdZdZdZedZ d%d Z fd Z d Z ed Z d Zd%dZd&dZd'dZd'dZdZ d(dZdZdZdZd)dZedZedZdZfdZdZd Zd!Zd"Z d*d#Z!xZ"S)+ workingctxayA workingctx object makes access to data related to the current working directory convenient. date - any valid date string or (unixtime, offset), or None. user - username string, or None. extra - a dictionary of extra values, or None. changes - a list of file lists as returned by localrepo.status() or None to use the repository status. r(Nc  d}|rd|vrJ |j}n/#t$r"tjt dwxYwt t||||||||dS)NrXsbranch name not in UTF-8!r) dirstaterUnicodeDecodeErrorr rOrr rr'r`s r&r'zworkingctx.__init__s C .. C--//% C C Ck!$@"A"ABBB C j$(( $dE76 )     s %,Ac#hK|jj}|D] }||jr|V!dSr r"r get_entrytracked)r$rtrs r&rNzworkingctx.__iter__ sH J   A{{1~~%   r(cJ|jj|jSr rrFs r&rHzworkingctx.__contains__&sz",,S1199r(c$|jjjSr rfr+s r&rzworkingctx.hex)sz'//r(cjj}|djjjkr |dd}jfd|DS)Nrr*cpg|]2}tjj||d3S)Fr3)rr"r+ra)rYr~r$unfis r&r\z'workingctx._parents..3sU     DN..q111U      r()r"rrrirr*)r$rrs` @r&rzworkingctx._parents,s J  ' ' ) ) Q44:+2 2 2#2#Az$$&&          r(c||jjj}|jj}|5|||}|j|}|r/|D],}||vr&|||vr||||-||jjjkrWt| D]#\}}||vr||vr|d|$ddddS#1swxYwYdSr ) r"rirr parentchange setparentsrrHcopiesrg)r$p1nodep2noderrrrrls r&rzworkingctx.setparents:sh >Z-4F:&  " " $ $ / /((88F:f%D 4 44A}}d):): fQi3331888"8??#4#4#:#:#<#<==//DAq}}$ dA... / / / / / / / / / / / / / / / / / /sCDD Dcb|jtt||Sr )rEr rr)r$rrs r&rzworkingctx._fileinfoMs( Z&&00666r(c |jjj|}t |dkr!|d  fd}n_|\}}||}|||c  fd}|S)NrrcF||}|Sr r)r copiesgetmans r&funcz'workingctx._buildflagfunc..func\s"IaOOyy||#r(c||}|||}}}||kr|S||kr|S||kr|SdSNr(r)rfl1fl2flarm1m2mas r&rz'workingctx._buildflagfunc..funcgslIaOO " RXXa[["((1++#S#::J#::J#::Jsr()r"rrrZrrrPr) r$rrrrparrrrrs @@@@@r&_buildflagfunczworkingctx._buildflagfuncRsJ'..004 ,,.. w<>$'' '   33 s  %%c2t|j|||S)z-get a file context from the working directory)rr{)workingfilectxr"r$rr{s r&rJzworkingctx.filectx~s$ Jw    r(FTct|jD].}|||rdS/|r|p|o;||kpQ|p=|p)| p|o| S)z-check whether a working directory is modified)rT) rHr~rrrrrrqrrrsrb)r$rrrrls r&rzworkingctx.dirtys &&  Axx{{   11 tt  twwyy ,>4;;==DGGII,<,<,>,>> ,}} ,zz|| ,||~~  , *DLLNN  r(c B |j5|jj|jjc} fd}g}|jjj}|D]}t j|tj | ||}nS#t$rF| td||z||YwxYw|dd} | dkrG|j| kr<| td|d|jzdz||fzt#j|js^t#j|jsE| td ||z||p |s.| td ||z|cdddS#1swxYwYdS) NcTtj|Sr pathtorrrdsprefixs r&r-z workingctx.add..ryyvq)A)ABBr(%s does not exist! suislarge-file-limitrso%s: up to %d MB of RAM may be required to manage this file (use 'hg revert %s' to cancel the pending addition) ri@Bs:%s not added: only files and symlinks supported currently s%s already tracked! )r"wlockr}rwvfslstatr checkportableosrrrrrrh configbytesst_sizestatS_ISREGst_modeS_ISLNK set_tracked) r$listrr}uipathrejectedrrstlimitrs ` @r&addzworkingctx.adds Z    & & Z]DJ$7FBBBBBBFHJO)E E E%b"',,vq*A*ABBBqBBGGA566BCCCOOA&&&Hu.ABBA::"*u"4"4GG3 a"*n7C D RZ00 EDL4L4L EGG5!&)) $OOA&&&&**EGGA677&&))CDDDM& & & & & & & & & & & & & & & & & & s8A+H BHA C$!H#C$$D#HHHcf|j5|jjfd}g}|D]d}|sM|jjt d||z||e|cdddS#1swxYwYdS)NcTtj|Sr rrs r&r-z#workingctx.forget..rr(s%s not tracked! )r"rr set_untrackedr}rrrh)r$rrrrrrs ` @r&forgetzworkingctx.forgets Z      $BBBBBBFH ' '''**'JM&&q)='>'>'JKKKOOA&&&                  sA=B&&B*-B*c |jj|}n]#t$rP|jjt d|jj|zYdSwxYwtj |j sgtj |j sN|jjt d|jj|zdS|j 5|jj}|||||ddddS#1swxYwYdS)Nrs1copy failed: %s is not a file or a symbolic link )r"rrFileNotFoundErrorr}rrrrrrrrrrr)r$rQdestrrs r&rzworkingctx.copys &&t,,BB     JM  )**TZ-@-G-G-M-MM    FF    RZ(( &DL,D,D & JM  GHH*%,,T223      !!## & &Z(t$$$%%% & & & & & & & & & & & & & & & & & &s""AA<;A<8EE!$E!rc |j}|s|}tj|j } t j|j||||||j||||  S)N)rrrricasefs)r"rrfscasesensitiverrr r) r$rrrrrrrrrs r&r zworkingctx.matchsu J ((**C*16222~ F     I%    r(cv|r|jjjr|Sg}|D]}||dkrn||}|dks+t |dksd|vst j|r#|jj d|z| ||S)Nrr(i s*ignoring suspect symlink placeholder "%s" ) r"r _checklinkrrrrrr}debugrh)r$rsanerrts r&_filtersuspectsymlinkz workingctx._filtersuspectsymlinks  +6 L   Azz!}}$$GLLNNHH1vv~~zz!(++"JM''FJ KKNNNN r(c|sggggfSg}g}g}g}|jd}t|D] } ||vsM||||ks!||||r||n|||nq||} | j} | j} tj | |} | | | | f} ||| fn||#ttf$r||YwxYw||||fSr) rrHrrkrhrrrrreliable_mtime_ofrr)r$rmtime_boundaryrqrbrVfixuprrrlmoder file_mtime cache_infos r& _checklookupzworkingctx._checklookups} "r2r> !}Q " "A "TMMzz!}} 1 55Aw{{47++6OOA&&&&#+LLOOOOQ A9D9D!*!.Os$8L8L$%$49M9"9"r(s*skip updating dirstate: identity mismatch N)r" postdsstatusr_dirtyidentityrpendingparentchange set_cleancurrenttransactionwriter}rr LockErrorclearpostdsstatus) r$rQr poststatusoldidnormalrpdftrpsrs @r&_poststatusfixupzworkingctx._poststatusfixup?s!Z,,.. * /J* /$*"5"<* /) / +4466 Z%%e,,#z2H((**e33 :';;==<*"*"*"*"*2);*///3 &q# "&!>!>!@!@B J/55b999%1&011 "4 0 0 0 0  ++J7<?     ,,..... ,,....U* /* /sN8E *CD=1 E =EE EE E9 EE9EE99Fc g}d|vrt|j}|jj|||||\}}}g} |r|||\} } } } |j| |j| | r|r|j | | r&|r$|j d| D| || | rP|j s|j s|j r4tj|j|j|j|jggg|_n||_|S)z7Gets the status from the dirstate -- internal use only.s.hgsub)rdrVrcc3 K|] \}}|V dSr r@)rYrrs r&rz-workingctx._dirstatestatus..s&44da444444r()rHr~r"rrQrrqrrbrVr alwaysrcrdrrrrsr]) r$r rdrVrcsubreposrkrlrr modified2deleted2 clean_sets r&_dirstatestatuszworkingctx._dirstatestatusns   dm,,H!%!4!;!; 8WE7"<" " Q   6484E4E^55 1IxE J  i ( ( ( I  X & & & *U *y))) 6 644e444555 a''' <<>> !y !AI ! !&~JAIr2r    ! r(cLi}i}|jj}|j|d}|j|d}t |t |z}|j}|jj D](\}} ||vs ||s| |vr| ||<| |vr| ||<)||fS)Nrr) r"rrrPrerrrqrrrg) r$rrr p1manifest p2manifest changedsetrdstsrcs r&rzworkingctx._copiess*%--//Z +4466 Z +4466 &&T]]__)=)== j,,..  +2244::<< $ $HC*$$KK,<,<$j  #  "" # !!r(c6||jS)aLgenerate a manifest corresponding to the values in self._status This reuse the file nodeid from parent, but we use special node identifiers for added and modified files. This is used by manifests merge to see that files are different and by update logic to avoid deleting newly added files. )rRr]r+s r&rEzworkingctx._manifests((666r(c|}|d}|j}|jjj|jf|jjj|j ffD]?\}}|D]7}|||< | |||(#t$rY4wxYw@|j |j zD] }||vr||= |S)z9Builds a manifest that includes the given status results.r)rrPrrr"ri addednodeidrrmodifiednodeidrqsetflagrrbrs)r$rQrrffir%rs r&rRzworkingctx._buildstatusmanifests,,..aj!!##((** ^ Z % 16< @ Z % 4fo F  DAq  AKK22a55))))D  &.0  ACxxF sB'' B43B4c|||||}||j|jdd<||jdkr-t t |||||||}|S)aCbuild a status with respect to another context This includes logic for maintaining the fast path of status when comparing the working directory against its parent, which is to skip building a new manifest if self (working directory) is not comparing against its parent (repo['.']). N.)rrrqr"r rrz)r$r=rlr rmrnrors r&rzzworkingctx._buildstatuss   Y L L221:>> 111 DJt$ $ $j$''44q%iAr(cFjdkr fd}||_|S)aoverride the match method with a filter for directory patterns We use inheritance to customize the match.bad method only in cases of workingctx since it belongs only to the working directory when comparing against the parent changeset. If we aren't comparing against the working directory's parent, then we just use the default match object sent to us. r"c|vrX|sEjjdjj||fzdSdSdS)Ns%s: %s )rr"r}rrr)rrr=r$s r&rz$workingctx._matchstatus..badsmE>>%,,q//>JM&&#tz':'A'A!'D'Dc&JJ">>>r()r"r)r$r=r rs`` r&rTzworkingctx._matchstatussD DJt$ $ $      EI r(ct|jj|j|t|jddS)rTF)rrcrd)rHr"rrrr~rs r&rzworkingctx.walksW J  $ $ &&u-- .. %     r(c|j|}|jjtfd|DS)Nc3PK|] }|j|V!dSr )rr)rYrrs r&rz%workingctx.matches..s5NNAbll1oo6MNaNNNNNNr()r"rrrHr)r$r rs @r&rzworkingctx.matchessQ &&u-- Z NNNNE!2!2NNNNNNr(c|jj5||zD]$}|jj|dd%|D]$}|jj|dd%|jj||jtj |j|dddn #1swxYwY|jj |j dS)NTrF) r"rrrqrrrrsr!_quick_access_changeid_invalidater aftercommitrr)r$r*rs r&rzworkingctx.markcommittedsz Z - - / / 1 1]]__tzz||3   #//$40\\^^   #//%E0 J  * *4 0 0 0 J 8 8 : : :  tz4 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1" !!$*"?"?"A"ABBBBBsCDD  D c|r$tj|jStj|jSr ) mergestatemodrrVr"r.rs r&rzworkingctx.mergestates<  > +11$*== =',,TZ888r()r(NNNNr rr(rFFFr)#r4rrrr'rNrHrrrrrrrrrJrrrrr rrr rrrErRrzrTrrrrrrs@r&rr sIM        :::000   ]  ////&77777   DAA]A         ''''R    &&&*     >2*/*/*/X-/-/-/^####J""]""77]70*.    OOO CCC(99999999r(rc<eZdZdZd dZdZeZdZdZdZ dZ dS) committablefilectxzA committablefilectx provides common functionality for a file context that wants the ability to commit, e.g. workingfilectx or memfilectx.Nct||_||_d|_dx|_|_|||_|r ||_dSdSr )r"rrrrrr)r$r%rr{rs r&r'zcommittablefilectx.__init__"sO  )--   #DM  "!DOOO " "r(cdSrir@r+s r&r(zcommittablefilectx.__nonzero__-rjr(c*|Sr rr+s r&rzcommittablefilectx.linkrev2sxxzzr(c|}|sdS||jjdj||jjjfSr)rrrrErZr"rirrs r&rzcommittablefilectx.renamed6sX   4  O $Q ' 1 5 5dj.5    r(c"fd}j}j}jj}}|r|dzg}n|||d||fg}|ddD]$}||||||f%fd|DS)z5return parent filectxs, following copies if necessarycX|j|jjjSr )rErZr"rir)rrr$s r&rz,committablefilectx.parents..filenodeDs#=$$T4:+C+JKK Kr(r rrNcrg|]3\}}}|jjjk|||4SrU)r"rirr)rYrr~r%r$s r&r\z.committablefilectx.parents..TsQ   1aDJ,333   !Q  7 7333r()rrrrrrh)r$rrr#pclrr'pcs` r&rzcommittablefilectx.parentsAs L L L L Lz ]o&,,..  6G#$BB#a&$//45Babb' 6 6B IItXXb$//4 5 5 5 5        r(cgSr r@r+s r&rszcommittablefilectx.childrenZrr(r) r4rrrr'r(rrrrrsr@r(r&r0r0sLL " " " "H       2r(r0ceZdZdZdfd ZedZdZdZdZ dZ d Z d Z d Z d Zd ZddZddZdZdZdZxZS)rzrA workingfilectx object makes access to data related to a particular file in the working directory convenient.Nc^tt|||||dSr )r rr')r$r%rr{rrs r&r'zworkingfilectx.__init__bs- nd##,,T4*MMMMMr(c*t|jSr )rr"r+s r&rzworkingfilectx._changectxes$*%%%r(c@|j|jSr )r"wreadrr+s r&rzworkingfilectx.dataisz +++r(cJ|jj|jSr )r"rcopiedrr+s r&rzworkingfilectx.copysourcelsz"))$*555r(cT|jj|jjSr )r"rrrrr+s r&rzworkingfilectx.sizeosz$$TZ0088r(cJ|jj|jSr )r"rrrr+s r&rzworkingfilectx.lstatrz$$TZ000r(c|j\}} |jj|jt j|fS#t$r||fcYSwxYwr ) rr8r"rrrrST_MTIMEr)r$ttzs r&r8zworkingfilectx.dateusl$$&&2 JO))$*55dmDbI I    r7NNN s5AA%$A%cJ|jj|jSr )r"rexistsrr+s r&rJzworkingfilectx.exists|sz%%dj111r(cJ|jj|jSr )r"rlexistsrr+s r&rLzworkingfilectx.lexistssz&&tz222r(cJ|jj|jSr )r"rauditrr+s r&rNzworkingfilectx.auditrDr(c,||S)r)rkrs r&rkzworkingfilectx.cmpsxx~~r(Fc|jjdd}|jj|j||dS)+wraps unlink for a repo's working directoryrLsremoveemptydirs) ignoremissingrmdirN)r"r} configboolr unlinkpathr)r$rRrSs r&removezworkingfilectx.removesP ((:LMM "" Jm5 #     r(c :|jj|j||fd|i|S)wraps repo.wwritebackgroundclose)r"wwriterr$rrrYkwargss r&rzworkingfilectx.writes9 tz Je  5D HN   r(cP|jj||jdS)zmarks this file a copy of `src`N)r"rrr)r$rs r& markcopiedzworkingfilectx.markcopieds%   dj11111r(c^|jj}|j}|||jjddr||r,||s||dtttj |D]/}| |r||dS0dS||r,||s||dSdSdS)zsRemoves conflicting items in the working directory so that ``write()`` can be called successfully. rLsmerge.checkpathconflictsT)forciblyN)r"rrrNr}rTisdirrrmtreerrrfinddirs isfileorlinkunlink removedirs)r$rrrs r& clearunknownzworkingfilectx.clearunknowns6z J 1 := # # 8   # zz!}} .T[[^^ . A ---d8#4Q#7#78899  $$Q''KKNNNEE   zz!}} #T[[^^ #""""" # # # #r(cR|jj|j||dSr )r"rsetflagsr)r$r%rrs r&rizworkingfilectx.setflagss&   Q22222r(rr)r4rrrr'rrrrrrr8rJrLrNrkrVrr^rgrirrs@r&rr^sD11NNNNNN&&]&,,,666999111222333111        222###.3333333r(rc"eZdZdZfdZdZd'dZdZedZ edZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZd(dZdZdZdZdZdZ d)dZdZ d Z!d!Z"d"Z# d*d#Z$d'd$Z%d+d&Z&xZ'S),overlayworkingctxaWraps another mutable context with a write-back cache that can be converted into a commit context. self._cache[path] maps to a dict with keys: { 'exists': bool? 'date': date? 'data': str? 'flags': str? 'copied': str? (path or None) } If `exists` is True, `flags` must be non-None and 'date' is non-None. If it is `False`, the file was deleted. ctt|||dSr )r rkr'rV)r$r%rs r&r'zoverlayworkingctx.__init__s3 &&//555 r(cN||_|g|_tj|ddS)N _manifest) _wrappedctxrrclearcachedproperty)r$ wrappedctxs r&setbasezoverlayworkingctx.setbases.%#    |44444r(Nc||jjj}||jksJ|j|j|g|_dSr )r"rirror*r*r)r$rrs r&rzoverlayworkingctx.setparentssZ >Z-4F)..000000)4:+@+@+B+B6+JK r(cH||ro|j|drE|j|d|j|dS|j|St jd|z|j|SNexistsdataNo such file or directory: %s)isdirty_cacherorr rrs r&rzoverlayworkingctx.datas <<   1{4 + ;t$W-9;t,W55 +D166888,4t;#D)..00 0r(c|}|d}|j}|D]5}|jjj||<||||6| D]5}|jjj ||<||||6| D]}||=|Sr) rrPrrrrr"rirrrqrrs)r$rrrrs r&rEzoverlayworkingctx._manifests,,..aj!!##((**~JJLL * *D 0.fs;t$X. .r(r@)r$rs` r&rzoverlayworkingctx._flagfuncs# / / / / /r(ct||z|zSr )rHrrrqrsr+s r&rzoverlayworkingctx.files s2djjllT]]__4t||~~EFFFr(cNfdjDS)Ncdg|],}j|d|*|-Srvrz_existsinparentrYrr$s r&r\z.overlayworkingctx.modified.. sR   {1~i( .2-A-A!-D-D    r(rzkeysr+s`r&rqzoverlayworkingctx.modified <    [%%''    r(cNfdjDS)Ncdg|],}j|d|*|-Srrrs r&r\z+overlayworkingctx.added.. sR   {1~i( 261E1Ea1H1H    r(rr+s`r&rrzoverlayworkingctx.added rr(cNfdjDS)Ncdg|],}j|d|*|-Srrrs r&r\z-overlayworkingctx.removed.. sR   ;q>), 261E1Ea1H1H    r(rr+s`r&rszoverlayworkingctx.removed rr(ci}|j}|jD]>}||s||d|j|d}|r|||<?|SNcopiedr"rrzrr9r$rrrrQs r&rzoverlayworkingctx.p1copies j,,.. !!## # #A;q>>  JJq$   [^I.F #"q  r(ci}|j}|jD]>}||s||d|j|d}|r|||<?|Srrrs r&rzoverlayworkingctx.p2copies% rr(cdSrir@r+s r&rmzoverlayworkingctx.isinmemory1 rjr(c||r|j|dS|j|S)Ndate)ryrzror8rs r&filedatezoverlayworkingctx.filedate4 sB <<   1;t$W- -#D)..00 0r(c||d|||||dS)NT)rJr8rrA) _markdirtyrr)r$rorigins r&r^zoverlayworkingctx.markcopied: sN  t$$**T""      r(cV||r|j|dSdSr)ryrzrs r&copydatazoverlayworkingctx.copydataC s- <<   ;t$Y/ /4r(c||r=|j|dr|j|dStjd|z|j|S)Nrvr~rx)ryrzr rrorrs r&rzoverlayworkingctx.flagsI su <<   2{4 + {4(22,4t;#D)//11 1r(cf||jvr|j|dS||vS)Nrv)rzrrFs r&rHzoverlayworkingctx.__contains__T s4 $+  ;s#I. .dggiir(cN |j|dS#tj$rYdSwxYwr)ror rrs r&rz!overlayworkingctx._existsinparentY sA   T " "4(   55 s $$c fd}|d}tt|D]/}d|d|}|vr |||0|gd}t |}t|dkrt|dkr|d|krdSfd|D}|sdStj d ||t|d |fzdS) a$Replicates conflict checks done by wvfs.write(). Since we never write to the filesystem and never call `applyupdates` in IMM, we'll never check that a path is actually writable -- e.g., because it adds `a/foo`, but `a` is actually a file in the other commit. cXd|vr>tjd||fztjd||fz)Nrs*error: %s conflicts with symlink %s in %d.s+error: '%s' conflicts with file '%s' in %d.)rrr rOra)r componentr$s r&failz/overlayworkingctx._auditconflicts..failk stwwyy+113333k!%y$''))--// BC k"Itwwyy}}?@r(rrspath)rrNcg|]}|v| Sr@r@)rYrr$s r&r\z5overlayworkingctx._auditconflicts.. s555A199a999r(sberror: file '%s' cannot be written because '%s/' is a directory in %s (containing %d entries: %s)s, ) splitrangerrr rrrPrr rO)r$rr componentsr rr mfiless` r&_auditconflictsz!overlayworkingctx._auditconflictsc st      ZZ%% s:'' & &A *QqS/22ID  T9%%% D67 33dggii((**//6677 v;;??6{{aF1I$5$55555555F + twwyy#f++uzz&7I7IJK  ?r(r(c |tjd||||d|t j|dS)Nsdata must be non-NoneT)rJrr8r)r rrrrrp)r$rrrr\s r&rzoverlayworkingctx.write sf <()ABB B T"""  Dx/@/B/B%      r(cpd}|rd}n|rd}||dtj|dS)Nr(rrT)rJr8r)rrrp)r$rr%rrrs r&rizoverlayworkingctx.setflags sL  DD  D T0A0C0C4PPPPPr(c4||ddS)NF)rJ)rrs r&rVzoverlayworkingctx.remove s U+++++r(c<||rs|j|drMd|j|dvr8||j|dS|j|dS||S)zqexists behaves like `lexists`, but needs to follow symlinks and return False if they are broken. rvrr~rw)ryrzrJstriprrs r&rJzoverlayworkingctx.exists s <<   4 D!), 4DK-h777{{4;t#4W#=#C#C#E#EFFF{4(33##D)))r(c|||r|j|dS||S)z'lexists returns True if the path existsrv)ryrzrrs r&rLzoverlayworkingctx.lexists s< <<   0;t$Y/ /##D)))r(c||rJ|j|dr t|j|dStjd|z|j|Sru)ryrzrr rrorrs r&rzoverlayworkingctx.size s} <<   {4 + 4;t,W5666,4t;%**,,,r(c |1}t|dkr |ddf}|dj|ddf}n&j|dj|df}}fd} |j}t j|||| ||||| S)zConverts this ``overlayworkingctx`` into a ``memctx`` ready to be committed. ``text`` is the commit message. ``parents`` (optional) are rev numbers. Nrrc j|dr]t|||j|ddj|dvdj|dvj|dSdS)Nrvrwrr~rr)rz memfilectx)r%memctxrr$s r&getfilez+overlayworkingctx.tomemctx..getfile s{4 + !K%g.DK-h77DK-h77K%i0tr()r8r:r7reditor)rrr"rrorr) r$rarr:r8rr7rrrs ` r&tomemctxzoverlayworkingctx.tomemctx s" ?llnnG7||q  "1:t, 1: z'!*-t4GGz'!*-tz'!*/EFG       >%,,..F J        r(c@|}||d<||||||S)Ns amend_source)rarr:r8r7)r:rrrr9rr8r7)r$ precursorr:s r&tomemctx_for_amendz$overlayworkingctx.tomemctx_for_amend s!!&&((!*o}}&&((##%%!!!!    r(c||jvSr rrs r&ryzoverlayworkingctx.isdirty st{""r(c"d|_i|_dSr ) _mergestaterzr+s r&rVzoverlayworkingctx.clean s r(c rg}tj||tj||jfg|jD]}|j|} |j|}| |dkr3| |dkr| |o#tj $rYwxYw|D] }|j|= |S)zRemoves keys from the cache that are actually clean, by comparing them with the underlying context. This can occur during the merge process, e.g. by passing --tool :local to resolve a conflict. rwr~)r prefetchfilesr%rra matchfilesrzrrorrrhr r)r$rrcache underlyings r&_compactzoverlayworkingctx._compact s:  IIKKGGIIMMOO&tyy{{DK4D4D4F4FGG    K$$&&  DK%E !-d3 OO%%w77"((**eHo==KK%%%,     " "D D!! s6ADD'&D'c|rT|R|j|pi}|d}||j|}|||||d|j|<t j|ddS)Nrw)rvrwrr~rrn)rzrZrorrrp)r$rrJrr8rrAoldentrys r&rzoverlayworkingctx._markdirty= s  5dl{t,,2H<<((D|'-2244    D  |44444r(c2t|j|||S)N)r>r{)overlayworkingfilectxr"rs r&rJzoverlayworkingctx.filectxR s$$ JT7    r(Fc^|s|jtj|j|_|jSr )rr, memmergestater"rs r&rzoverlayworkingctx.mergestateW s1  GD$,,:4:FFD r(r r-NNNNNN)NNr(Nr)(r4rrrr'rrrrrrErrrqrrrsrrrmrr^rrrHrrrrirVrJrLrrrryrVrrrJrrrs@r&rkrks  555LLLL 1 1 1  ] ] GGG               111     2 2 2   ...`    QQQ,,,***"***---  < < < < |    ######LEI5555*            r(rkceZdZdZdfd ZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZddZddZdZxZS)rzWrap a ``workingfilectx`` but intercepts all writes into an in-memory cache, which can be flushed through later by calling ``flush()``.Nctt|||||||_||_||_dSr )r rr'r"_parentr)r$r%rr{r>rs r&r'zoverlayworkingfilectx.__init__a sA #T**33D$PPP   r(cV||kSr rrs r&rkzoverlayworkingfilectx.cmpg yy{{diikk))r(c|jSr )rr+s r&rzoverlayworkingfilectx.changectxj rr(c@|j|jSr )rrrr+s r&rzoverlayworkingfilectx.datam |  ,,,r(c@|j|jSr )rrrr+s r&r8zoverlayworkingfilectx.datep |$$TZ000r(c*|Sr )rLr+s r&rJzoverlayworkingfilectx.existss s||~~r(c@|j|jSr )rrJrr+s r&rLzoverlayworkingfilectx.lexistsv |""4:...r(c@|j|jSr )rrrr+s r&rz overlayworkingfilectx.copysourcey rr(c@|j|jSr )rrrr+s r&rzoverlayworkingfilectx.size| rr(cF|j|j|dSr )rr^r)r$rs r&r^z overlayworkingfilectx.markcopied s"  F33333r(cdSr r@r+s r&rNzoverlayworkingfilectx.audit  r(c@|j|jSr )rrrr+s r&rzoverlayworkingfilectx.flags s|!!$*---r(cD|j|j||Sr )rrir)r$rrs r&rizoverlayworkingfilectx.setflags s|$$TZ@@@r(Fc 6|jj|j||fi|Sr )rrrr[s r&rzoverlayworkingfilectx.write s%!t|!$*dEDDVDDDr(c@|j|jSr )rrVrr$rRs r&rVzoverlayworkingfilectx.remove rr(cdSr r@r+s r&rgz"overlayworkingfilectx.clearunknown rr(rr)r4rrrr'rkrrr8rJrLrrr^rNrrirrVrgrrs@r&rr] s;II ***---111///111---444   ...AAAEEEE////       r(rcDeZdZdZ dfd Zd dZedZxZS) workingcommitctxzA workingcommitctx object makes access to data related to the revision being committed convenient. This hides changes in the working directory, if they aren't committed in this context. r(Ncbtt|||||||dSr )r rr')r$r%rrar7r8r:rs r&r'zworkingcommitctx.__init__ s? %%.. $dE7     r(Fc |rfdjD}ng}tjfdjjDfdjjDfdjjDggg|S)zReturn matched files only in ``self._status`` Uncommitted files appear "clean" via this context, even if they aren't actually so in the working directory. c&g|] }|jv |Sr@) _changedsetrs r&r\z4workingcommitctx._dirstatestatus.. s&LLL1!4;K2K2KQ2K2K2Kr(c*g|]}| |Sr@r@rYrr s r&r\z4workingcommitctx._dirstatestatus.. s& : : :1q :Q : : :r(c*g|]}| |Sr@r@rs r&r\z4workingcommitctx._dirstatestatus.. s& 7 7 71eeAhh 7Q 7 7 7r(c*g|]}| |Sr@r@rs r&r\z4workingcommitctx._dirstatestatus.. s& 9 9 91a 9Q 9 9 9r()rErrQr]rqrrrs)r$r rdrVrcs`` r&rz workingcommitctx._dirstatestatus s  LLLLLLLEEE~ : : : : - : : : 7 7 7 7 * 7 7 7 9 9 9 9 , 9 9 9       r(ct|jj}||jj||jj|S)z/Return the set of files changed in this context)rer]rqupdaterrrs)r$changeds r&rzworkingcommitctx._changedset sIdl+,,t|)***t|+,,,r()r(NNNr.) r4rrrr'rrrrrs@r&rr s}DH          (]r(rcifd}|S)zCreate a filectxfn that caches based on the path. We can't use util.cachefunc because it uses all arguments as the cache key and this creates a cycle since the arguments include the repo and memctx. c<|vr||||<|Sr r@)r%rrrrs r& getfilectxz(makecachingfilectxfn..getfilectx s/ u  $tVT22E$KT{r(r@)rrrs` @r&makecachingfilectxfnr s1 E r(cfd}|S)zGiven a context return a memfilectx for ctx[path] This is a convenience method for building a memctx based on another context. c |}|}t|||||||SN)rrr)rrrrr)r%rrrrrs r&rz"memfilefromctx..getfilectx s_4y__&&     IIKK;;==;;==!    r(r@)rrs` r&memfilefromctxr s$       r(cfd}|S)zGiven a patch (e.g. patchstore object) return a memfilectx This is a convenience method for building a memctx based on a patchstore. c t|\}}}|dS|\}}t|||||||Sr)rr) r%rrrrrrr patchstores r&rz$memfilefrompatch..getfilectx s\!+!3!3D!9!9dJ <4    !    r(r@)rrs` r&memfilefrompatchr s$       r(creZdZdZdZ d fd Zd dZdZedZ edZ d Z xZ S) raNUse memctx to perform in-memory commits via localrepo.commitctx(). Revision information is supplied at initialization time while related files data and is made available through a callback mechanism. 'repo' is the current localrepo, 'parents' is a sequence of two parent revisions identifiers (pass None for every missing parent), 'text' is the commit message and 'files' lists names of files touched by the revision (normalized and relative to repository root). filectxfn(repo, memctx, path) is a callable receiving the repository, the current memctx object and the normalized path of requested file, relative to repository root. It is fired by the commit function for every file in 'files', but calls order is undefined. If the file is available in the revision being committed (updated or added), filectxfn returns a memfilectx object. If the file was removed, filectxfn return None for recent Mercurial. Moved files are represented by marking the source file removed and the new file added with copy information (see memfilectx). user receives the committer name and defaults to current repository username, date is the commit date in any format supported by dateutil.parsedate() and defaults to current date, extra is a dictionary of metadata or is left empty. TNc Rtt|||||| d_d_fd|D}|\} } fd| | fD_t t|}|_i_ t|tj rt|}nt|st|}t!|_| r8| jg_jjdSdS)Nrc6g|]}|pjjjSr@r"rYrr$s r&r\z#memctx.__init__..4 s&KKKaA818KKKr(c*g|]}j|Sr@r!rs r&r\z#memctx.__init__..6 s9991A999r()r rr'r:rrrHre_filesr~rr filestorercallablerr _filectxfnr"rYsavecommitmessage)r$r%rrar filectxfnr7r8r:rrrrrs` r&r'zmemctx.__init__" sD fd$$ $dE& %     KKKK7KKKB9999R999 s5zz""  i 1 1 2(33II)$$ 2&y11I/y99  5 D"55DJ J ( ( 4 4 4 4 4 5 5r(c:||j||S)zpget a file context from the working directory Returns None if file doesn't exist and should be removed.)rr"rs r&rJzmemctx.filectxH stz4666r(c6|j|Szcommit context to the repor" commitctxr+s r&commitz memctx.commitN z##D)))r(c$|jd}|}|jjD]}|jjj||<|jjD]}|jjj ||<|jj D] }||vr||= |S)z;generate a manifest based on the return values of filectxfnr) rrPrr]rqr"rirrrrrs)r$rrrs r&rEzmemctx._manifestR s }Qmmoo""$$& = =AZ-.p d!7a4ir(c |vSr r@rrs r&r-z memctx._status..r dr( rrPrrarrrhrrQ r$rmanagingrqrrrsrrrs @@r&r]zmemctx._statusf swwyy!!## ]1  6688w  ;;==D77777HH****H#%r2% " "A8A;; " Qa """""q!!!!~hwBBGGGr(c||jdtkr|jdgS|jS)Nrr)rrarr+s r&rzmemctx.parents s8 =    ! !W , ,M!$% %}r()NNNNNr ) r4rrr_returnnoneformissingfilesr'rJrrrEr]rrrs@r&rr s<"& $5$5$5$5$5$5L7777 ***]&HH]H0r(rcJeZdZdZ d fd ZdZdZdZd dZd Z xZ S) rzpmemfilectx represents an in-memory file to commit. See memctx and committablefilectx for more details. FNctt|||d|||_|rd|_n|rd|_nd|_||_dS)aQ path is the normalized file path relative to repository root. data is the file content as a string. islink is True if the file is a symbolic link. isexec is True if the file is executable. copied is the source file path if current file was copied in the revision being committed, or None.Nrrr()r rr'_datar _copysource) r$r%rrrrrrrs r&r'zmemfilectx.__init__ sg" j$((tT9EEE  DKK  DKKDK%r(c|jSr )r"r+s r&rzmemfilectx.copysource s r(cV||kSr rrs r&rkzmemfilectx.cmp rr(c|jSr r!r+s r&rzmemfilectx.data rr(c |j|j=dS)rQN)rrrs r&rVzmemfilectx.remove s ODJ ' ' 'r(c ||_dS)rXNr&r$rrr\s r&rzmemfilectx.write s  r()FFNr) r4rrrr'rrkrrVrrrs@r&rr s&&&&&&6   ***(((( r(rceZdZdZ d fd ZdZedZd dZdZ edZ e d Z xZ S) metadataonlyctxaLike memctx but it's reusing the manifest of different commit. Intended to be used by lightweight operations that are creating metadata-only changes. Revision information is supplied at initialization time. 'repo' is the current localrepo, 'ctx' is original revision which manifest we're reuisng 'parents' is a sequence of two parent revisions identifiers (pass None for every missing parent), 'text' is the commit. user receives the committer name and defaults to current repository username, date is the commit date in any format supported by dateutil.parsedate() and defaults to current date, extra is a dictionary of metadata or is left empty. Nc ||}tt|||||d|_d|_||_||_|| }nfd|D}|dd}t|dkr3| tt|dk3|x\} } |_ |j \} } | |jjjkr'| | krt%d| |jjjkr'| | krt%d||_i|_|r8||j|g|_|j|jdSdS)Nc$g|] }|| Sr r@)rYrr%s r&r\z,metadataonlyctx.__init__.. sAAA11=tAw===r(rz=can't reuse the manifest: its p1 doesn't match the new ctx p1z=can't reuse the manifest: its p2 doesn't match the new ctx p2)r9r r+r'r:r _originalctxr? _manifestnoderrrhrrrr"rir RuntimeErrorrrr~rYr)r$r% originalctxrrar7r8r:rrrmp1mp2rs ` r&r'zmetadataonlyctx.__init__ s <**,,D ot$$--dD$eLLL  '(5577 ?!))++GGAAAAAAAG!!!*'llQ NN4= ) ) )'llQ!((B##%%-S )0 0 0R__5F5F#5M5M0  )0 0 0R__5F5F#5M5M7  "''))   5 D"55DJ J ( ( 4 4 4 4 4 5 5r(c|jSr )r/r+s r&r?zmetadataonlyctx.manifestnode s !!r(c0|jj|jSr )r"rr/r+s r&rzmetadataonlyctx._manifestctx sz%d&899r(c:|j||S)N)r{)r.rJrs r&rJzmetadataonlyctx.filectx s ((w(???r(c6|j|Sr r r+s r&rzmetadataonlyctx.commit rr(c4|jSr )r.rPr+s r&rEzmetadataonlyctx._manifest s ))+++r(c ||jd}|tkr|fd}nfd}ggg}}}|jD]R}||s||#||vr||=||Stj|||ggggS)zjCalculate exact status from ``files`` specified in the ``origctx`` and parents manifests. rc|vp|vSr r@rs r&r-z)metadataonlyctx._status.. rr(c |vSr r@rs r&r-z)metadataonlyctx._status.. rr(rrs @@r&r]zmetadataonlyctx._status s wwyy!!## ]1  6688w  ;;==D77777HH****H#%r2% " "A8A;; " Qd""""q!!!!~hwBBGGGr(rr )r4rrrr'r?rrrJrrErr]rrs@r&r+r+ s  &   .5.5.5.5.5.5`"""::X:@@@@***,,X,HH]HHHHHr(r+cDeZdZdZd dZdZdZdZdZdZ d Z d Z dS) arbitraryfilectxzAllows you to use filectx-like functions on a file in an arbitrary location on disk, possibly not in the working directory. Nc"||_||_dSr )r"r)r$rr%s r&r'zarbitraryfilectx.__init__, s  r(cd|vpd|v}|snt|trY|jrRt j||j| S||kSr) rrrr"filecmprkrwjoinr)r$rsymlinkss r&rkzarbitraryfilectx.cmp1 s4::<<'?44::<<+? OJt^<< O O{499;; 0@0@0M0MNNN Nyy{{diikk))r(c|jSr rr+s r&rzarbitraryfilectx.path< rr(cdSrr@r+s r&rzarbitraryfilectx.flags? ssr(c4tj|jSr rreadfilerr+s r&rzarbitraryfilectx.dataB }TZ(((r(c4tj|jSr rFr+s r&rAzarbitraryfilectx.decodeddataE rHr(c8tj|jdSr )rrerr+s r&rVzarbitraryfilectx.removeH s DJr(c B|rJtj|j|dSr )r writefilerr)s r&rzarbitraryfilectx.writeK s( tz4(((((r(r ) r4rrrr'rkrrrrArVrr@r(r&r=r=' s * * *))))))   )))))r(r=)8r@rri18nrr*rrrpycompatrr r r r r rrr,rrrrrrrrrrrrutilsrr dirstateutilsrrrrrrJrWrr0rrkrrrrrrrr+r=r@r(r&rRs  &" z z z z z z z z z i i i i i i i i X B?B?B?B?B?B?B?B?J{ { { { { k{ { { |fffffWfffRR9R9R9R9R9R9R9R9j========@Y3Y3Y3Y3Y3'Y3Y3Y3x` ` ` ` ` ` ` ` F 5 5 5 5 5 .5 5 5 p)))))z)))X".0AAAAA^AAAH11111#111hkHkHkHkHkHnkHkHkH\&)&)&)&)&)&)&)&)&)&)r(