# HG changeset patch # User Christian Ebert # Date 1296064151 0 # Node ID 20db7f6aba9a743aa961f1d60e422249f05def3b # Parent 67aaf09289bb4fd8281bc9f5c1c61f431b3d57ba# Parent e01f1b4a62e9c78e0be5fa42148f2e46704a7795 stable: merge with default diff -r 67aaf09289bb -r 20db7f6aba9a hgkw/keyword.py --- a/hgkw/keyword.py Sat Dec 11 12:49:10 2010 +0100 +++ b/hgkw/keyword.py Wed Jan 26 17:49:11 2011 +0000 @@ -70,9 +70,8 @@ replaced with customized keywords and templates. Again, run :hg:`kwdemo` to control the results of your configuration changes. -Before changing/disabling active keywords, run :hg:`kwshrink` to avoid -the risk of inadvertently storing expanded keywords in the change -history. +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`. @@ -356,6 +355,9 @@ ui.note(_('creating temporary repository at %s\n') % tmpdir) repo = localrepo.localrepository(ui, tmpdir, True) ui.setconfig('keyword', fn, '') + svn = ui.configbool('keywordset', 'svn') + # explicitly set keywordset for demo output + ui.setconfig('keywordset', 'svn', svn) uikwmaps = ui.configitems('keywordmaps') if args or opts.get('rcfile'): @@ -363,7 +365,10 @@ if uikwmaps: ui.status(_('\textending current template maps\n')) if opts.get('default') or not uikwmaps: - ui.status(_('\toverriding default template maps\n')) + if svn: + ui.status(_('\toverriding default svn keywordset\n')) + else: + ui.status(_('\toverriding default cvs keywordset\n')) if opts.get('rcfile'): ui.readconfig(opts.get('rcfile')) if args: @@ -375,7 +380,10 @@ ui.readconfig(repo.join('hgrc')) kwmaps = dict(ui.configitems('keywordmaps')) elif opts.get('default'): - ui.status(_('\n\tconfiguration using default keyword template maps\n')) + if svn: + ui.status(_('\n\tconfiguration using default svn keywordset\n')) + else: + ui.status(_('\n\tconfiguration using default cvs keywordset\n')) kwmaps = _defaultkwmaps(ui) if uikwmaps: ui.status(_('\tdisabling current template maps\n')) @@ -389,6 +397,7 @@ reposetup(ui, repo) ui.write('[extensions]\nkeyword =\n') demoitems('keyword', ui.configitems('keyword')) + demoitems('keywordset', ui.configitems('keywordset')) demoitems('keywordmaps', kwmaps.iteritems()) keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n' repo.wopener(fn, 'w').write(keywords) @@ -465,8 +474,7 @@ def shrink(ui, repo, *pats, **opts): '''revert expanded keywords in the working directory - Run before changing/disabling active keywords or if you experience - problems with :hg:`import` or :hg:`merge`. + Must be run before changing/disabling active keywords. kwshrink refuses to run if given files contain local changes. ''' @@ -628,8 +636,6 @@ finally: wlock.release() - repo.__class__ = kwrepo - def kwfilectx_cmp(orig, self, fctx): # keyword affects data size, comparing wdir and filelog size does # not make sense @@ -653,6 +659,8 @@ except KeyError: pass + repo.__class__ = kwrepo + cmdtable = { 'kwdemo': (demo, diff -r 67aaf09289bb -r 20db7f6aba9a tests/test-keyword.t --- a/tests/test-keyword.t Sat Dec 11 12:49:10 2010 +0100 +++ b/tests/test-keyword.t Wed Jan 26 17:49:11 2011 +0000 @@ -17,6 +17,8 @@ keyword = [keyword] demo.txt = + [keywordset] + svn = False [keywordmaps] Author = {author|user} Date = {date|utcdate} @@ -40,6 +42,8 @@ keyword = [keyword] demo.txt = + [keywordset] + svn = False [keywordmaps] Branch = {branches} $Branch: demobranch $ @@ -633,6 +637,8 @@ b = ignore demo.txt = i = ignore + [keywordset] + svn = False [keywordmaps] Xinfo = {author}: {desc} $Xinfo: test: hg keyword configuration and expansion example $