--- a/hgkw/keyword.py Wed Jul 18 16:12:14 2007 +0200
+++ b/hgkw/keyword.py Wed Jul 18 16:17:04 2007 +0200
@@ -298,12 +298,13 @@
'''
overwrite(ui, repo, files=args)
-def demo(ui, repo, **opts):
+def demo(ui, repo, *args, **opts):
'''print [keywordmaps] configuration and an expansion example
- Show current or default keyword template maps and their expansion
+ show current, custom, or default keyword template maps and their expansion
'''
msg = 'hg keyword config and expansion example'
+ kwstatus = 'current'
fn = 'demo.txt'
tmpdir = tempfile.mkdtemp('', 'kwdemo.')
ui.note(_('creating temporary repo at %s\n') % tmpdir)
@@ -315,7 +316,13 @@
kwstatus = 'default'
kwmaps = deftemplates
else:
- kwstatus = 'current'
+ if args or opts['rcfile']:
+ kwstatus = 'custom'
+ for tmap in args:
+ k, v = tmap.split('=', 1)
+ ui.setconfig('keywordmaps', k.strip(), v.strip())
+ if opts['rcfile']:
+ ui.readconfig(opts['rcfile'])
kwmaps = dict(ui.configitems('keywordmaps')) or deftemplates
if ui.configitems('keywordmaps'):
for k, v in kwmaps.items():
@@ -408,8 +415,9 @@
cmdtable = {
'kwdemo':
(demo,
- [('d', 'default', None, _('show default keyword template maps'))],
- _('hg kwdemo [-d]')),
+ [('d', 'default', None, _('show default keyword template maps')),
+ ('f', 'rcfile', [], _('read maps from RCFILE'))],
+ _('hg kwdemo [-d || [-f RCFILE] TEMPLATEMAP ...]')),
'kwshrink': (shrink, [], _('hg kwshrink [NAME] ...')),
'kwexpand': (expand, [], _('hg kwexpand [NAME] ...')),
}