Make kwdemo less verbose
1) Set the branchname always silently with
dirstate.setbranch().
We create a branch so that testing the {branches} template
does not come up empty. But kwdemo is hardly the place to
inform the user by inference why {branches} is empty on the
default branch.
"demobranch" is ascii and cannot be changed, so using the
internal command instead of commands.branch() is safe.
2) Do not show full path to temporary directory
(distracting long lines on Mac OS X).
3) No special debug output. Output only related to keyword,
no internals like unsetting of commit hooks etc.
#!/bin/shcat<<EOF >> $HGRCPATH[extensions]keyword =mq =notify =transplant =EOF# demo before [keyword] files are set up# would succeed without uisetup otherwiseecho%hgkwdemohg--quietkwdemo\|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}"cat<<EOF >> $HGRCPATH[keyword]* =b = ignore[hooks]commit=commit.test=cp a hooktestEOFhginitTest-bndlcdTest-bndlecho%kwshrinkshouldexitsilentlyinempty/invalidrepohgkwshrink# Symlinks cannot be created on Windows. The bundle was made with:## hg init t# cd t# echo a > a# ln -s a sym# hg add sym# hg ci -m addsym -u mercurial# hg bundle --base null ../test-keyword.hg#hgpull-u"$TESTDIR/test-keyword.hg"\|sed's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/'echo'expand $Id$'>aecho'do not process $Id:'>>aecho'xxx $'>>aecho'ignore $Id$'>becho%catcatabecho%nokwfileshgkwfilesecho%untrackedcandidateshg-vkwfiles--unknownecho%addremovehgaddremoveecho%statushgstatusecho%defaultkeywordexpansionincludingcommithookecho%interruptedcommitshouldnotchangestateorruncommithookhg--debugcommitecho%statushgstatusecho%commithg--debugcommit-mabsym-u'User Name <user@example.com>'echo%statushgstatusecho%identifyhgdebugrebuildstatehg--quietidentifyecho%catcatabecho%hgcathgcatsymabechoecho%diffahooktestdiffahooktestecho%removingcommithookfromconfigsed-e'/\[hooks\]/,$ d'$HGRCPATH>$HGRCPATH.nohookmv$HGRCPATH.nohook$HGRCPATHrmhooktestecho%bundlehgbundle--basenull../kw.hgcd..hginitTestcdTestecho%notifyonpulltocheckwhetherkeywordsstayasisinemailecho%ie.ifpatch.diffwrapperactsasitshouldcat<<EOF >> $HGRCPATH[hooks]incoming.notify = python:hgext.notify.hook[notify]sources = pulldiffstat = False[reposubs]* = TestEOFecho%pullfrombundlehgpull-u../kw.hg2>&1|sed-e'/^Content-Type:/,/^diffs (/ d'echo%removenotifyconfigsed-e'/\[hooks\]/,$ d'$HGRCPATH>$HGRCPATH.nonotifymv$HGRCPATH.nonotify$HGRCPATHecho%touchtouchabecho%statushgstatusrmsymabecho%updatehgupdate-Cecho%catcatabecho%checkwhetherexpansionisfilewiseecho'$Id$'>cecho'tests for different changenodes'>>cecho%commitchgcommit-A-mcndiff-d'1 0'-u'User Name <user@example.com>'echo%forceexpansionhg-vkwexpandecho%comparechangenodesinaccatacecho%qinit-chgqinit-cecho%qimporthgqimport-rtip-nmqtest.diffecho%qcommithgqcommit-mqtestecho%keywordsshouldnotbeexpandedinpatchcat.hg/patches/mqtest.diffecho%qpophgqpopecho%qgoto-shouldimplyqpushhgqgotomqtest.diffecho%catcatcecho%qpopandmoveonhgqpopecho%copyhgcpacecho%kwfilesaddedhgkwfilesecho%commithg--debugcommit-ma2c-d'1 0'-u'User Name <user@example.com>'echo%cataccatacecho%touchcopiedctouchcecho%statushgstatusecho%kwfileshgkwfilesecho%ignoredfileshg-vkwfiles--ignoreecho%allfileshgkwfiles--allecho%diff--revhgdiff--rev1|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%catcatabecho%hgcathgcatsymabechoecho'$Xinfo$'>>acat<<EOF >> logfirstlinesecondlineEOFecho%interruptedcommitshouldnotchangestatehgcommitecho%statushgstatusecho%commithg--debugcommit-llog-d'2 0'-u'User Name <user@example.com>'rmlogecho%statushgstatusecho%verifyhgverifyecho%catcatabecho%hgcathgcatsymabechoecho%annotatehgannotateaecho%removehgdebugrebuildstatehgremoveahg--debugcommit-mrmaecho%statushgstatusecho%rollbackhgrollbackecho%statushgstatusecho%revertahgrevert--no-backup--revtipaecho%catacataecho%clonetotestincomingcd..hgclone-r1TestTest-acdTest-acat<<EOF >> .hg/hgrc[paths]default = ../TestEOFecho%incoming# remove path to temp dirhgincoming|sed-e's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'sed-e's/Id.*/& rejecttest/'a>a.newmva.newaecho%commitrejecttesthg--debugcommit-m'rejects?'-d'3 0'-u'User Name <user@example.com>'echo%exporthgexport-o../rejecttest.difftipcd../Testecho%importhgimport../rejecttest.diffecho%catcatabechoecho%rollbackhgrollbackecho%cleanupdatehgupdate--cleanecho%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%kwexpandnonexistenthgkwexpandnonexistent2>&1|sed's/nonexistent:.*/nonexistent:/'echo%hgservehgserve-p$HGPORT-d--pid-file=hg.pid-Aaccess.log-Eerrors.logcathg.pid>>$DAEMON_PIDSecho%expansionecho%hgwebfile("$TESTDIR/get-with-headers.py"localhost:$HGPORT'/file/tip/a/?style=raw')echo%noexpansionecho%hgwebannotate("$TESTDIR/get-with-headers.py"localhost:$HGPORT'/annotate/tip/a/?style=raw')echo%hgwebchangeset("$TESTDIR/get-with-headers.py"localhost:$HGPORT'/rev/tip/?style=raw')echo%hgwebfilediff("$TESTDIR/get-with-headers.py"localhost:$HGPORT'/diff/bb948857c743/a?style=raw')echo%errorsencounteredcaterrors.logecho%merge/resolveecho'$Id$'>mhgaddmhgcommit-m4kwechofoo>>mhgcommit-m5fooecho%simplemergehgupdate4echofoo>>mhgcommit-m6foohgmergehgcommit-msimplemergecatmecho%conflicthgupdate4echobar>>mhgcommit-m8barhgmergeecho%keywordstaysoutsideconflictzonecatmecho%resolvetolocalHGMERGE=internal:localhgresolve-ahgcommit-mlocalresolvecatmecho%testrestrictedmodewithtransplant-bhgupdate6hgbranchfoomvaa.bakechofoobranch>acata.bak>>arma.bakhgcommit-m9foobranchhgupdatedefaulthg-ytransplant-bfootipecho%noexpansioninchangesethgtip-pecho%expansioninfilehead-n2ahg-qrollbackhg-qupdate-Cecho%switchoffexpansionecho%kwshrinkwithunknownfileucpauhg--verbosekwshrinkecho%catcatabecho%hgcathgcatsymabechorm$HGRCPATHecho%catcatabecho%hgcathgcatsymabecho