6h?w SrSSKJr SSKrSSKrSSKrSSKJr SSKJ r SSK J r J r J r JrJrJrJrJrJrJrJrJrJrJrJrJrJrJr SSKJrJr SSK J!r! 0r"\RF"\"5r#S r$S r%S r&S r'S r(SSSSSS.r)\RT"5r*0r+\RX"\+5r,\,"SSSS9 \*"S\RZS9S5r.\*"S\RZS9S5r/\*"S\RZS9S5r0SS 0r1S!r2S"r3S#r4"S$S%5r5"S&S'\R 5r6S(r7S)r8\#"S*S+S,S\"S-54S.S/S \"S05\"S154/\"S25S3S49S55r9\#"S6\ Rt\"S75S3S89S95r;\#"S:S;SS?S\"S@54SASBS\"SC54/\ Rt-\"SD5S3S89SE5r<\#"SF\ Rt\"SG5S3S89SH5r=SRSIjr>SJr?SKr@SLrASSSMjrBSNrCSOrDSPrESQrFg)TaCexpand keywords in tracked files This extension expands RCS/CVS-like or self-customized $Keywords$ in tracked text files selected by your configuration. Keywords are only expanded in local repositories and not stored in the change history. The mechanism can be regarded as a convenience for the current user or for archive distribution. Keywords expand to the changeset data pertaining to the latest change relative to the working directory parent of each file. Configuration is done in the [keyword], [keywordset] and [keywordmaps] sections of hgrc files. Example:: [keyword] # expand keywords in every python file except those matching "x*" **.py = x* = ignore [keywordset] # prefer svn- over cvs-like default keywordmaps svn = True .. note:: The more specific you are in your filename patterns the less you lose speed in huge repositories. For [keywordmaps] template mapping and expansion demonstration and control run :hg:`kwdemo`. See :hg:`help templates` for a list of available templates and filters. Three additional date template filters are provided: :``utcdate``: "2006/09/18 15:13:13" :``svnutcdate``: "2006-09-18 15:13:13Z" :``svnisodate``: "2006-09-18 08:13:13 -700 (Mon, 18 Sep 2006)" The default template mappings (view with :hg:`kwdemo -d`) can be replaced with customized keywords and templates. Again, run :hg:`kwdemo` to control the results of your configuration changes. Before changing/disabling active keywords, you must run :hg:`kwshrink` to avoid storing expanded keywords in the change history. To force expansion after enabling it, or a configuration change, run :hg:`kwexpand`. Expansions spanning more than one line and incremental expansions, like CVS' $Log$, are not supported. A keyword template map "Log = {desc}" expands to the first line of the changeset description. ) annotationsN)_) webcommands)cmdutilcontextdispatcherror extensionsfilelog localrepo logcmdutilmatchmergepatchpathutilpycompat registrarscmutiltemplatefilters templateutilutil)dateutil stringutil) timestampsships-with-hg-coresgadd addremove annotate bundle export grep incoming init log outgoing push tip verify convert email glogz/annotate changeset rev filediff diff comparisonsfmerge kwexpand kwshrink record qrecord resolve transplant unshelve rebase graft backout histedit fetchsrecords green boldscyan bold underlinesgreensboldsnone)skwfiles.enabledskwfiles.deletedskwfiles.enabledunknownskwfiles.ignoredskwfiles.ignoredunknown keywordsetsvnF)defaultsutcdate)intypec>Sn[R"USS4U5$)z?Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".s%Y/%m/%d %H:%M:%Srrdatestrdate dateformats //usr/lib/python3/dist-packages/hgext/keyword.pyutcdater&s$&J   T!WaL* 55s svnisodatec0[R"US5$)zUDate. Returns a date in this format: "2009-08-18 13:00:13 +0200 (Tue, 18 Aug 2009)". s%%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)r )r#s r% svnisodater)s   D"J KKr's svnutcdatec>Sn[R"USS4U5$)zADate. Returns a UTC-date in this format: "2009-08-18 11:00:13Z". s%Y-%m-%d %H:%M:%SZrr r"s r% svnutcdater+s$ 'J   T!WaL* 55r'hgcmdr'cxSSS.nSSSSSSS .S S SSS S .4nURX RS S55 U$)zBReturns default keywordmaps according to keywordset configuration.s {node|short}s {author|user})sRevisionsAuthors{date|utcdate}s{file|basename},vs{root}/{file},vs;{file|basename},v {node|short} {date|utcdate} {author|user}s9{root}/{file},v {node|short} {date|utcdate} {author|user})DatesRCSfilesRCSFilesSourceIdsHeaders{date|svnisodate}s>{file|basename},v {node|short} {date|svnutcdate} {author|user})r.r/sLastChangedRevisions LastChangedBysLastChangedDaterr)update configbool)ui templateskwsetss r%_defaultkwmapsr5sk%#I ',,)QS *T$3. 4  F$VMM-@AB r'cU"SU5$)zhHelper for keyword expansion removal in text. Depending on subfunc also returns number of substitutions.s$\1$)textsubfuncs r% _shrinktextr:s 8T ""r'cURVs/sH o"U;dM UPM nnURVs/sH o"U;dM UPM nnX44$s snfs snf)zRetrieves modified and added files from a working directory state and returns the subset of each contained in given changed files retrieved from a change context.)modifiedadded)wstatuschangedfr<r=s r% _preselectrAsP#++<+aG|+H< 6 1gQ E 6 ?= 6s A A  AAc\rSrSrSrSr\S5r\RS5r \RS5r \RS5r Sr S rS rS rSS jrS rSrSrSrg) kwtemplaterzf Sets up keyword templates, corresponding keyword regex, and provides keyword substitution functions. cXl[R"U5Ul[R"UR S/X45Ul[ S[R5;Ul SUl URRS5nU(a[U5Ul g[UR5Ul g)Nr'r,F keywordmaps)r2weakrefref_reporrootkwtools restrictedsplitrestrict postcommit configitemsdictr3r5)selfr2repoincexckwmapss r%__init__kwtemplater.__init__s[[& [[CS> )Z-=-=-?? $$^4 !&\DN+DGG4DNr'c"UR5$N)rIrRs r%rSkwtemplater.reposzz|r'cSR[[RURR 555$)z+Returns bar-separated and escaped keywords.|)joinmaprreescaper3keysr[s r%escapekwtemplater.escape s-yyZ00$..2E2E2GHIIr'cH[R"SUR-5$)z&Returns regex for unexpanded keywords.s\$(%s)\$recompilercr[s r%rekwkwtemplater.rekwszz,455r'cH[R"SUR-5$)z$Returns regex for expanded keywords.s\$(%s): [^$\n\r]*? \$rfr[s r%rekwexpkwtemplater.rekwexpszz3dkkABBr'c(^^^UUU4SjnU"XQ5$)z1Replaces keywords in data with expanded template.c~>URS5n[R"TRTRTR U5nTRR 5 URTTRRTS9 [R"TRR55nSX4-$)N)rJfiles $%s: %s $) groupr maketemplaterr2rSr3 pushbuffershowrJr firstline popbuffer)mobjkwctekwctxpathrRs r%kwsub%kwtemplater.substitute..kwsubsAB))DNN2$6B GG   GGCdiinn4G 8!++DGG,=,=,?@C2)+ +r'r7)rRdatar}r|r9r~s` `` r% substitutekwtemplater.substitutes ,u##r'cPURRXS9R5$)z4Similar to filelog.linkrev, but returns a changectx.)fileid)rSfilectx changectx)rRr}rs r%linkctxkwtemplater.linkctx's#yy   5??AAr'cUR(dhURU5(aR[R"U5(d7UR X5nUR X1X@R R5$U$)z$Returns data with keywords expanded.)rNrrbinaryrrrisub)rRr}noderr|s r%expandkwtemplater.expand+sW  4  %%d++,,t*C??4sIIMMB B r'cUVs/sH3o0RU5(dMSURU5;dM1UPM5 sn$s snf)zcReturns subset of candidates which are configured for keyword expansion but are not symbolic links.l)rflags)rRcandr|r@s r%iskwfilekwtemplater.iskwfile6s5 N4a::a=T15M4NNNsAAAcUR(dU(dUR(aURX!5nU(dgUR=(a UnUR(dU(aU(aUR5nUR(dU(a URnO UR nU(a [ S5n O [ S5n URSn UGHvn UR(a.URRU 5RWU 5n OURRU 5n [R"U 5(aM{U(aUR5n U(aURU WU 5nO^UR(aM[U 5S:a>U H8nX;dM XR!X5(aM&XR#5n O UR%XXR&5upO:UR(aUR)U 5nO[+XR&5upU(dGMpUR,R/X-5 URR1U SSS9nUR3U 5 UR55 U(anXR75nUR8nUR:n[<R>"U5nUUU4nURR@RCU U5 GM>UR(dGMRURR@REU SS9 GMy g) z7Overwrites selected files expanding/shrinking keywords.Ns"overwriting %s expanding keywords s"overwriting %s shrinking keywords rpswbT) atomictemp) p1_tracked)#rNrOrmanifestrirlrrSrqreadwreadrrparentsrlencmprrsubnsearchr:r2notewvfswritecloselstatst_modest_sizermtime_ofdirstate set_cleanupdate_file_p1)rRr| candidateslookuprrikwcmdmfre_kwmsgwctxr@rrpfoundfpsmodesizemtime cache_datas r% overwritekwtemplater.overwrite;sN ==Fdooz7J  (& ==FvB ==DIIELLE :;C:;CyyA}}yy~~a(--be4yyq)  &&++-,,q"Q%0C]]s7|a'7%6!$((36*:*:"#$.."2C!%#oodsJJG e T*)$ ; u SW%YY^^Au^>  A99D99D%..q1E"&e!4JII&&00J?___II&&55aD5IKr'cURU5(a:[R"U5(d[X RR 5$U$)z4Returns text with all keyword substitutions removed.)rrrr:rlr)rRfnamer8s r%shrinkkwtemplater.shrinkts; ::e  Z%6%6t%<%<t\\%5%56 6 r'cURU5(aZSRU5n[R"U5(d.[ X0R R 5RS5$U$)z1Returns lines with keyword substitutions removed.r'T)rr_rrr:rlr splitlines)rRrlinesr8s r% shrinklineskwtemplater.shrinklineszsT ::e  88E?D$$T**"4)9)9:EEdKK r'cJUR(aURX5$U$)zUIf in restricted mode returns data read from wdir with keyword substitutions removed.)rNr)rRrrs r%rkwtemplater.wreads ==;;u+ + r')rIrrOrNr3r2NF)__name__ __module__ __qualname____firstlineno____doc__rWpropertyrSr propertycachercrirlrrrrrrrr__static_attributes__r7r'r%rCrCs 5 JJ 66 CC $B O 7Jr r'rCcT^\rSrSrSrU4SjrU4SjrSU4SjjrU4SjrSr U=r $) kwfilelogizz Subclass of filelog to hook into its read, add, cmp methods. Keywords are "stored" unexpanded, and processed on reading. c<>[TU]X5 X lX0lgrZ)superrWkwtr})rRopenerrr} __class__s r%rWkwfilelog.__init__s & r'c>[TU]U5nURU5(aU$URR UR X5$)z&Expands keywords when reading filelog.)rrrenamedrrr})rRrrrs r%rkwfilelog.reads>w|D! <<  Kxxtyy$55r'cr>URRURU5n[TU]XX4XV5$)z5Removes keyword substitutions when adding to filelog.)rrr}radd)rRr8metatrlinkp1p2rs r%r kwfilelog.adds.xxtyy$/w{4r88r'cn>URRURU5n[TU]X5$)z-Removes keyword substitutions for comparison.)rrr}rr)rRrr8rs r%r kwfilelog.cmps*xxtyy$/w{4&&r')rr})NN) rrrrrrWrrrr __classcell__)rs@r%rrs!  69 ''r'rc zU(aaUR[R"X$[R"U55SUR S5=(d UR S5S9$UR S5(a[R"[S55e[R"[S55e)zXBails out if [keyword] configuration is not active. Returns status of working directory.Tunknownall)rcleanrkeywords[keyword] patterns cannot matchs no [keyword] patterns configured) statusrrr byteskwargsgetrPr Abortr)r2rSrrpatsoptss r%_statusrs {{--H,@,@,FGHHY':488E?   ~~j!!kk!>?@@ ++a;< ==r'c~USn[UR55S:a[R"[ S55e[ USS5nUR 5 URRU5 [XXV/UQ70UD6nUR(d3UR(d"UR(dUR(a[R"[ S55eURXWRSU5 SSS5 SSS5 g!,(df  N=f!,(df  g=f)z7Selects files and passes them to kwtemplater.overwrite.Nrpsoutstanding uncommitted merge _keywordkwtsoutstanding uncommitted changesT)rrr rrgetattrwlockrchanging_filesrr<r=removeddeletedrr)r2rSrrrrrrs r% _kwfwriters :D 4<<>Qkk!<=>> $ t ,C t}}33D94TRSU-5 [U5HEup#[U[5(a[R "U5nTRSX#4-5 MG g)Ns[%s] s%s = %s )rsorted isinstanceboolrpprint)sectionitemskvr2s r% demoitemsdemo..demoitemssT W$%5MDA!T""%%a( HH\QF* +"r'sdemo.txtr'skwdemo.s$creating temporary repository at %s NT)createrrrrFrcfiles3 configuration using custom keyword template maps s! extending current template maps rs# overriding default svn keywordset s# overriding default cvs keywordset rs[keywordmaps] %s  shgrcs- configuration using default svn keywordset s- configuration using default cvs keywordset s! disabling current template maps s4 configuration using current keyword template maps s[extensions] keyword = $s$ $s$ s keywords written to %s: s demobranchshooks.rprscommits.hg keyword configuration and expansion exampleshg ci -m '%s' )r8s keywords expanded )'rmkdtemprrbaseuir instance setconfigr1rPrr readconfigr_vfsrrQr5ruisetup reposetup writenoi18nrrbrrrrr setbranchcurrenttransactionrMfindr2 notenoi18ncommitrrmtreerJ)r2rSargsrrfntmpdirrsvnuikwmapsrcmapsrVrrkeywordsnamecmdrs` r%demor(s., B   c: .FGGA6 7& @A |   fT :DLLRj1 -- v .CLLZ8~~n-H txx!! !MNO  IIa>? @ 88I  h !DEF !DEF 88H   MM$((9- . +ejj.>>F HHNN7F + MM$((--0 1bnn^45 )    IIaKL M IIaKL M#  IIa>? @  ^Q:>' !NOP (^F#B'F BK b$NN/0 j"..45 mR^^M:; nflln-gll6&++-#899FBHIIOOB!  ]] ) )$ / JNNB4 0 01B67   t/F/F/HI1ID#zz$"1%**95:!!(D#zB2AB (3./   IIa*+,HHTZZ^IITYY0 / s,?UU 1BUAU U U U*skwexpands!hg kwexpand [OPTION]... [FILE]...) inferrepoc$[XS/UQ70UD6 g)zexpand keywords in the working directory Run after (re)enabling keyword expansion. kwexpand refuses to run if given files contain local changes. TNrr2rSrrs r%rr)sb,t,t,r'kwfilesAsalls&show keyword status flags of all filesiignores"show files excluded from expansionusunknowns%only show unknown (not tracked) filess hg kwfiles [OPTION]... [FILE]...c [USS5nUSn[XXT/UQ70UD6nU(aUR5nOSn/nURS5(aURS5(a/[ UR UR -UR-5nURX5n URURU5n URURU5n URS5(aURS5(aXU 4n O///4n URS5(dURS5(aAU UV s/sH oU ;dM U PM sn URV s/sH oU ;dM U PM sn 4- n SR5n[U[R"S5U 5nURS [R "U55nS nURS5(dUR"(aS nUHYunnnS U-nUHGn UR%5 UR'UU S 9 UR)UUUR+X54-US9 MI M[ UR-5 gs sn fs sn f)aGshow files configured for keyword expansion List which files in the working directory are matched by the [keyword] configuration patterns. Useful to prevent inadvertent keyword expansion and to speed up execution by including only files that are actual candidates for expansion. See :hg:`help keyword` on how to construct patterns both for inclusion and exclusion of files. With -A/--all and -v/--verbose the codes used to show the status of files are:: K = keyword expansion candidate k = keyword expansion candidate (not tracked) I = ignored i = ignored (not tracked) rNr'rrignores5enabled deleted enabledunknown ignored ignoredunknownsK!kIir-s%.0s%s s%s %s skwfiles.)kwstatusr})label)rrgetcwdrrr<r=rrrrrMziprbytestr formatterrverbose startitemrplainpathtoend)r2rSrrrrrcwdfileskwfiles kwdeleted kwunknown showfilesr@kwlabelskwstatesfmfmtkwstatechar filenamesr5s r%r@r@:s@ $ t ,C :D Rt 84 84 8F kkm E 88I  $((5//v5 DEll5'G V^^T2I V^^T2I 88H  % 1 BJ  xx$((8,, 21'!1Q 2 =19* x is symlink cp sym x; hg cp -A sym x -> x is file (maybe expanded keywords) For the latter we have to follow the symlink to find out whether its target is configured for expansion and we therefore must unexpand the keywords in the destination.rNsdry_runc>TRRU5nSTRU5;a?[R"TR T[ RRU55nTRU5$)zReturns true if dest is a regular file and configured for expansion or a symlink which points to a file configured for expansion.r) rcopiedrr canonpathrJosr}realpathr)destsourcer?rrSrs r% haskwsourcekw_copy..haskwsourcese]]))$/Ftzz&))!++IIsBGG$4$4V$<99V$ $r'rF)rrrr6rcopiesrr) rNr2rSrrrenamerjr@rr?rrs ` @@@r%kw_copyrns $ t ,C {Bd&11  Rt6* 88J    Dzkkm % %]]))+ +4::a=( -8^ +  dJu5/ $ % s/#C,:C,C'3 C'C'C,'C,, C:c [USS5nUc U"XU/UQ70UD6$UR5 SUlUSnUR5nU"XU/UQ70UD6n USn Xz:wat[ XR 55upSUlURRU5 URXSS5 URXSSS5 SSS5 SUlU sSSS5 $!,(df  N =f!,(df  g=f)z9Wraps record.dorecord expanding keywords after recording.rNTrF) rrrOrrAr@rNrr]r) rNr2rS commitfuncrrrr|r>retrecctxr<r=s r% kw_dorecordrss $ t ,C {Bj848488 4j**,2Z7$7$7d =(,,.AOH CL//5 ft< fUD$?6 CL 65 s$A1C2(C!C2! C/ +C22 DcBUR(aURU5$[URSS5nUcU"X5$URcxURR (dUR UR55(aSUR5;dGUR5S- UR5:Xd"UR5UR5:Xa4URRURUR55$g)NrrT) _customcmprrrI _filenode_encodefilterpatsrr}rr_filelogr)rNrRfctxrs r% kwfilectx_cmpr{s xx~ $**mT 2C {D  JJ ( (yy%%DJJL(yy{Q$))+- 99;$))+ %}}  == r'cvSn[R"[SU5 [R"[RS[ 5 [R"[ RS[5 [R"[ S[5 [R"[S[5 [R"[S[5 [R"[S[5 [R5H#n[R"[ U["5 M% S [$lg ) a Monkeypatches dispatch._parse to retrieve user command. Overrides file method to return kwfilelog instead of filelog if file matches user configuration. Wraps commit to overwrite configured files with updated keyword substitutions. Monkeypatches patch and webcommands.c6U"X5up4p%nU[S'X4X%U4$)z9Monkeypatch dispatch._parse to obtain running hg command.r,)rK)rNr2rr'funcoptions cmdoptionss r%kwdispatch_parse!uisetup..kwdispatch_parse$s)/3B~,4*$33r'_parserrWdiffamendcopydorecordFN)r wrapfunctionrrrr{r patchfilerSrVrrarnrsnokwwebcommandsrMrr[rMAYBE_USE_RUST_UPDATE)r2rcs r%rrs4 Hh0@AGOOUMBEOOZ9IJE662GWh7GVW5GZ=  " " $ Q ;%"'Er'c^UR5(ac[S[R5;dDS[R "UR 5;d URRS5(ag/S/p2URS5H/upEUS:waURU5 MURU5 M1 U(dg[XX#5m"U4SjS UR5nXal TUlg![a Nf=f) z0Sets up repo as kwrepo for keyword substitution.r,s.hgsbundle:Ns.hg*rr0ch>^\rSrSrU4SjrUU4SjrU4SjrSUU4SjjrS UU4SjjrSr U=r $) reposetup..kwrepoiPcN>USS:XaUSSn[URTU5$)Nr/rp)rsvfs)rRr@rs r%rqreposetup..kwrepo.fileQs,tt|abETYYQ/ /r'cD>[TU]U5nTRX5$rZ)rr)rRfilenamerrrs r%rreposetup..kwrepo.wreadVs 7=*D99X, ,r'cZ>URUl[TU] "U0UD6U?$!U?f=frZ) kwcommitctx commitctxrr)rRrrrs r%r reposetup..kwrepo.commitZs3"--DN #w~t4t4NDNs&*c>[TU]XU5nTR(dXTRnSTlTR X[ UR 5UR5-5SS5 UTlU$)NTF)rrrOrNrrr=r<)rRr|r origctxnrNrrs r%r%reposetup..kwrepo.kwcommitctxcsf!#g6A>><<#  GVCIIK#,,.$@A5$ ( Hr'c>UR5 T RnU(dUSR5n[T U]X5nU(dNUSn[ UR 5W5upxST lT RXgSS5 T RXhSS5 UUT lsSSS5 $!UT lf=f!,(df  g=f)NrFT)rrNr@rrollbackrArr) rRdryrunforce origrestrictr?rqr|r<r=rrs r%r"reposetup..kwrepo.rollbackos"||  0!"&t*"2"2"4'*69C!"4j*4SZZ\7*K',  cT4@ c$>#/CL$0CLs# B<A?B0B<0 B99B<< C )r)FN)FF) rrrrrqrrrrrr)rrs@r%kwreporPs& 0  - #   0 0r'r)localrK nokwcommandsrMr splitpathrJ_url startswithAttributeErrorrPappendrCrr)r2rSrTrUpatoptrrs @r%rr7s   x L$6$6$88 22yy##J// 0 G9NN:. )  JJsO JJsO /  b )C.0.0`ND    sA8C?? D  D rZr)Gr __future__rrfrgrGmercurial.i18nrmercurial.hgwebr mercurialrrrr r r r r rrrrrrrrrrmercurial.utilsrrmercurial.dirstateutilsrcmdtablecommand testedwithrrrLrecordextensions colortabletemplatefilter configtable configitemr#r&r)r+rKr5r:rArCrrrr(walkoptsrr@rrSrVr[rarnrsr{rrr7r'r%rs:6r# '(.    H % # 4 D 5 &.'&  ))+  ! !+ .   <#4#45666 l&7&78L9L l&7&78696 S/8# UUp'': > 8  z4#H!IJ y#q!9:AgJG45[ [ |  *+  -  -  vtQHIJ y$"G HI z4#K!LM   )* 8  8 v  *+  .  .= $ "  $6N.,(6Jr'