Postpone commit hooks until keywords are expanded
If a commit hook acts on a file with keywords, it now does so
on the file with keywords already expanded.
Unhook all hooks with "commit" in name during kwdemo.
#!/bin/shcat<<EOF >> $HGRCPATH[extensions]hgext.keyword =[keyword]* =b = ignoreEOFecho%helphghelpkeywordecho%hgkwdemohg--quietkwdemo--default\|sed-e's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!'\-e's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /'\-e'/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /'\-e's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!'hg--quietkwdemo"Branch = {branches}"echo%donotexpanddebugtemplateshg--debugkwdemo"ADD = empty{file_adds}"|grep'ADD'hginitTestcdTestecho%kwshrinkshouldexitsilentlyinempty/invalidrepohgkwshrinkecho'expand $Id$'>aecho'do not process $Id:'>>aecho'xxx $'>>aecho'ignore $Id$'>bln-sasymecho%catcatsymabecho%defaultkeywordexpansionecho%commithg--debugcommit-A-mabsym-d'0 0'-u'User Name <user@example.com>'echo%statushgstatusecho%identifyhg--quietidentifyecho%catcatsymabecho%hgcathgcatsymabechoecho%touchtouchabecho%statushgstatusrmsymabecho%updatehgupdateecho%catcatsymabecho%copyhgcpacecho%kwfilesaddedhgkwfilesecho%commithg--debugcommit-ma2c-d'1 0'-u'User Name <user@example.com>'echo%cataccatacecho%touchcopiedcafter1secondsleep1touchcecho%statushgstatusecho%kwfileshgkwfilesecho%diff--revhgdiff--rev0|grep-v'b/c'echo%rollbackhgrollbackecho%statushgstatusecho%update-Chgupdate--cleanecho%customkeywordexpansionecho%trywithkwdemohg--quietkwdemo"Xinfo = {author}: {desc}"cat<<EOF >>$HGRCPATH[keywordmaps]Id = {file} {node|short} {date|rfc822date} {author|user}Xinfo = {author}: {desc}EOFecho%catcatsymabecho%hgcathgcatsymabechoecho'$Xinfo$'>>acat<<EOF >> logfirstlinesecondlineEOFecho%interruptedcommitHGEDITOR=falsehgcommitecho%statushgstatusecho%commithg--debugcommit-llog-d'2 0'-u'User Name <user@example.com>'rmlogecho%statushgstatusecho%catcatsymabecho%hgcathgcatsymabechoecho%removehgremoveahg--debugcommit-mrmaecho%statushgstatusecho%rollbackhgrollbackecho%statushgstatusecho%revertahgrevert--no-backup--revtipaecho%catacataecho%clonetotestincomingcd..hgclone-r0TestTest-acdTest-acat<<EOF >> .hg/hgrc[paths]default = ../TestEOFecho%incoming# remove path to temp dirhgincoming|sed-e's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'cd../Testecho%kwexpand/kwshrinkonselectedfilesmkdirxecho%copyax/ahgcopyax/aecho%kwexpandahg--verbosekwexpandaecho%kwexpandx/ashouldaborthg--verbosekwexpandx/acdxhg--debugcommit-mxa-d'3 0'-u'User Name <user@example.com>'echo%catacataecho%kwshrinkainsidedirectoryxhg--verbosekwshrinkaecho%catacatacd-echo%kwexpandnonexistenthgkwexpandnonexistentecho%switchoffexpansionecho%kwshrinkwithunknownfileucpauhg--verbosekwshrinkecho%catcatsymabecho%hgcathgcatsymabechorm$HGRCPATHecho%catcatsymabecho%hgcathgcatsymabecho