%helpkeywordextension-expandkeywordsintrackedfilesThisextensionexpandsRCS/CVS-likeorself-customized$Keywords$intrackedtextfilesselectedbyyourconfiguration.Keywordsareonlyexpandedinlocalrepositoriesandnotstoredinthechangehistory.Themechanismcanberegardedasaconvenienceforthecurrentuserorforarchivedistribution.Configurationisdoneinthe[keyword]and[keywordmaps]sectionsofhgrcfiles.Example:[keyword]#expandkeywordsineverypythonfileexceptthosematching"x*"**.py=x*=ignoreNote:themorespecificyouareinyourfilenamepatternsthelessyoulosespeedinhugerepositories.For[keywordmaps]templatemappingandexpansiondemonstrationandcontrolrun"hg kwdemo".Anadditionaldatetemplatefilter{date|utcdate}isprovided.Thedefaulttemplatemappings(viewwith"hg kwdemo -d")canbereplacedwithcustomizedkeywordsandtemplates.Again,run"hgkwdemo"tocontroltheresultsofyourconfigchanges.Beforechanging/disablingactivekeywords,run"hg kwshrink"toavoidtheriskofinadvertentlystoringexpandedkeywordsinthechangehistory.Toforceexpansionafterenablingit,oraconfigurationchange,run"hg kwexpand".Also,whencommittingwiththerecordextensionorusingmq's qrecord,be aware that keywords cannot be updated. Again, run "hg kwexpand" onthe files in question to update keyword expansions after all changeshave been checked in.Expansions spanning more than one line and incremental expansions,like CVS'$Log$,arenotsupported.Akeywordtemplatemap"Log = {desc}"expandstothefirstlineofthechangesetdescription.Caveat:WithMercurialversionspriorto4574925db5c0"hg import"mightcauserejectsifthepatchcontextcontainsanactivekeyword.Inthatcaserun"hg kwshrink",andthenreimport.Or,better,usebundle/unbundletosharechanges.kwdemoprint[keywordmaps]configurationandanexpansionexamplekwexpandexpandkeywordsintheworkingdirectorykwfilesprintfilenamesconfiguredforkeywordexpansionkwshrinkrevertexpandedkeywordsintheworkingdirectory%hgkwdemo[extensions]hgext.keyword=[keyword]*=b=ignoredemo.txt=[keywordmaps]RCSFile={file|basename},vAuthor={author|user}Header={root}/{file},v{node|short}{date|utcdate}{author|user}Source={root}/{file},vDate={date|utcdate}Id={file|basename},v{node|short}{date|utcdate}{author|user}Revision={node|short}$RCSFile:demo.txt,v$$Author:test$$Header:/TMP/demo.txt,vxxxxxxxxxxxx2000/00/0000:00:00test$$Source:/TMP/demo.txt,v$$Date:2000/00/0000:00:00$$Id:demo.txt,vxxxxxxxxxxxx2000/00/0000:00:00test$$Revision:xxxxxxxxxxxx$[extensions]hgext.keyword=[keyword]*=b=ignoredemo.txt=[keywordmaps]Branch={branches}$Branch:demobranch$%kwshrinkshouldexitsilentlyinempty/invalidrepopullingfromtest-keyword.hgrequestingallchangesaddingchangesetsaddingmanifestsaddingfilechangesadded1changesetswith1changesto1files1filesupdated,0filesmerged,0filesremoved,0filesunresolved%catexpand$Id$donotprocess$Id:xxx$ignore$Id$%addremoveaddingaaddingb%statusAaAb%defaultkeywordexpansionincludingcommithook%commitaboverwritingaexpandingkeywordsrunninghookcommit.test:cpahooktest%status?hooktest%identify475643d17242%catexpand$Id:a,v475643d172421970/01/0100:00:00user$donotprocess$Id:xxx$ignore$Id$%hgcatexpand$Id:a,v475643d172421970/01/0100:00:00user$donotprocess$Id:xxx$ignore$Id$%diffahooktest%removingcommithookfromconfig%bundle%pullfrombundlepullingfrom../kw.hgrequestingallchangesaddingchangesetsaddingmanifestsaddingfilechangesadded2changesetswith3changesto3files3filesupdated,0filesmerged,0filesremoved,0filesunresolved%touch%status%update2filesupdated,0filesmerged,0filesremoved,0filesunresolved%catexpand$Id:a,v475643d172421970/01/0100:00:00user$donotprocess$Id:xxx$ignore$Id$%checkwhetherexpansionisfilewise%commitcaddingc%forceexpansionoverwritingaexpandingkeywordsoverwritingcexpandingkeywords%comparechangenodesinacexpand$Id:a,v475643d172421970/01/0100:00:00user$donotprocess$Id:xxx$$Id:c,vc08ff8b9d54e1970/01/0100:00:01user$testsfordifferentchangenodes%qinit-c%qimport%qcommit%keywordsshouldnotbeexpandedinpatch#HGchangesetpatch#UserUserName<user@example.com>#Date10#NodeIDc08ff8b9d54ebf87b428631bd34b3d8b69cbf72f#Parent475643d17242703d20c30af0fc52b30fd231c6f6cndiffdiff-r475643d17242-rc08ff8b9d54ec---/dev/nullThuJan0100:00:001970+0000+++b/cThuJan0100:00:011970+0000@@-0,0+1,2@@+$Id$+testsfordifferentchangenodes%qpopPatchqueuenowempty%qpushapplyingmqtest.diffNowat:mqtest.diff%cat$Id:c,vc08ff8b9d54e1970/01/0100:00:01user$testsfordifferentchangenodes%qpopandmoveonPatchqueuenowempty%copy%kwfilesaddedac%commitcc:copya:0045e12f6c5791aac80ca6cbfd97709a88307292overwritingcexpandingkeywords%catacexpand$Id:a,v475643d172421970/01/0100:00:00user$donotprocess$Id:xxx$expand$Id:c,v1acf8f3ab6111970/01/0100:00:01user$donotprocess$Id:xxx$%touchcopiedcafter1second%status%kwfilesac%diff--revdiff-r475643d17242c---/dev/nullThuJan0100:00:001970+0000@@-0,0+1,3@@+expand$Id$+donotprocess$Id:+xxx$%rollbackrollingbacklasttransaction%statusAc%update-C0filesupdated,0filesmerged,1filesremoved,0filesunresolved%customkeywordexpansion%trywithkwdemo[extensions]hgext.keyword=[keyword]*=b=ignoredemo.txt=[keywordmaps]Xinfo={author}:{desc}$Xinfo:test:hgkeywordconfigandexpansionexample$%catexpand$Id:a,v475643d172421970/01/0100:00:00user$donotprocess$Id:xxx$ignore$Id$%hgcatexpand$Id:a475643d17242Thu,01Jan197000:00:00+0000user$donotprocess$Id:xxx$ignore$Id$%commitaoverwritingaexpandingkeywords%status%verifycheckingchangesetscheckingmanifestscrosscheckingfilesinchangesetsandmanifestscheckingfiles3files,3changesets,4totalrevisions%catexpand$Id:a9ea11ce3ca13Thu,01Jan197000:00:02+0000user$donotprocess$Id:xxx$$Xinfo:UserName<user@example.com>:firstline$ignore$Id$%hgcatexpand$Id:a9ea11ce3ca13Thu,01Jan197000:00:02+0000user$donotprocess$Id:xxx$$Xinfo:UserName<user@example.com>:firstline$ignore$Id$a%annotate1:expand$Id$1:donotprocess$Id:1:xxx$2:$Xinfo$%remove%status%rollbackrollingbacklasttransaction%statusRa%reverta%cataexpand$Id:a9ea11ce3ca13Thu,01Jan197000:00:02+0000user$donotprocess$Id:xxx$$Xinfo:UserName<user@example.com>:firstline$%clonetotestincomingrequestingallchangesaddingchangesetsaddingmanifestsaddingfilechangesadded2changesetswith3changesto3files3filesupdated,0filesmerged,0filesremoved,0filesunresolved%incomingsearchingforchangeschangeset:2:9ea11ce3ca13tag:tipuser:UserName<user@example.com>date:ThuJan0100:00:021970+0000summary:firstline%kwexpand/kwshrinkonselectedfiles%copyax/a%kwexpandaoverwritingaexpandingkeywords%kwexpandx/ashouldabortabort:outstandinguncommittedchangesx/ax/a:copya:779c764182ce5d43e2b1eb66ce06d7b47bfe342eoverwritingx/aexpandingkeywords%cataexpand$Id:x/a93c8b61c99cdThu,01Jan197000:00:03+0000user$donotprocess$Id:xxx$$Xinfo:UserName<user@example.com>:xa$%kwshrinkainsidedirectoryxoverwritingx/ashrinkingkeywords%cataexpand$Id$donotprocess$Id:xxx$$Xinfo$%kwexpandnonexistentnonexistent:%switchoffexpansion%kwshrinkwithunknownfileuoverwritingashrinkingkeywordsoverwritingx/ashrinkingkeywords%catexpand$Id$donotprocess$Id:xxx$$Xinfo$ignore$Id$%hgcatexpand$Id:a9ea11ce3ca13Thu,01Jan197000:00:02+0000user$donotprocess$Id:xxx$$Xinfo:UserName<user@example.com>:firstline$ignore$Id$%catexpand$Id$donotprocess$Id:xxx$$Xinfo$ignore$Id$%hgcatexpand$Id$donotprocess$Id:xxx$$Xinfo$ignore$Id$