# HG changeset patch # User Christian Ebert # Date 1268774938 -3600 # Node ID c118a9c5ca24efa874f2d0fa17ccdc88e7b41312 # Parent ad66e72df1591878b7a62827eebae85f814d428f 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. diff -r ad66e72df159 -r c118a9c5ca24 hgkw/keyword.py --- a/hgkw/keyword.py Tue Mar 16 22:28:23 2010 +0100 +++ b/hgkw/keyword.py Tue Mar 16 22:28:58 2010 +0100 @@ -287,7 +287,6 @@ ui.write('%s = %s\n' % (k, v)) fn = 'demo.txt' - branchname = 'demobranch' tmpdir = tempfile.mkdtemp('', 'kwdemo.') ui.note(_('creating temporary repository at %s\n') % tmpdir) repo = localrepo.localrepository(ui, tmpdir, True) @@ -333,25 +332,17 @@ keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n' repo.wopener(fn, 'w').write(keywords) repo.add([fn]) - path = repo.wjoin(fn) - ui.note(_('\nkeywords written to %s:\n') % path) + ui.note(_('\nkeywords written to %s:\n') % fn) ui.note(keywords) - ui.note('\nhg -R "%s" branch "%s"\n' % (tmpdir, branchname)) - # silence branch command if not verbose - quiet = ui.quiet - ui.quiet = not ui.verbose - commands.branch(ui, repo, branchname) - ui.quiet = quiet + repo.dirstate.setbranch('demobranch') for name, cmd in ui.configitems('hooks'): if name.split('.', 1)[0].find('commit') > -1: repo.ui.setconfig('hooks', name, '') - ui.note(_('unhooked all commit hooks\n')) msg = _('hg keyword configuration and expansion example') - ui.note("hg -R '%s' ci -m '%s'\n" % (tmpdir, msg)) + ui.note("hg ci -m '%s'\n" % msg) repo.commit(text=msg) ui.status(_('\n\tkeywords expanded\n')) ui.write(repo.wread(fn)) - ui.debug('\nremoving temporary repository %s\n' % tmpdir) shutil.rmtree(tmpdir, ignore_errors=True) def expand(ui, repo, *pats, **opts):