Fix ui inheritance for kwdemo kwmap-templates
authorChristian Ebert <blacktrash@gmx.net>
Sun, 15 Jul 2007 10:45:39 +0200
branchkwmap-templates
changeset 179 8ddd39a79dc7
parent 178 4a27c306c6a2
child 180 5d20f5d642f3
Fix ui inheritance for kwdemo kwdemo config changes had no effect if keyword.py was not in hgext. For backwards compatibility we use repo.ui in reposetup, so inside kwdemo the temporary _repo.ui has to obtain the paramters.
hgkw/keyword.py
--- a/hgkw/keyword.py	Sun Jul 15 01:19:20 2007 +0200
+++ b/hgkw/keyword.py	Sun Jul 15 10:45:39 2007 +0200
@@ -99,21 +99,21 @@
     '''
     log = 'hg keyword config and expansion example'
     fn = 'demo.txt'
-    ui.setconfig('keyword', fn, '')
-    if opts['default']:
-        kwstatus = 'default'
-        kwmaps = deftemplates
-        if ui.configitems('keywordmaps'):
-            for k, v in kwmaps.items():
-                ui.setconfig('keywordmaps', k, v)
-    else:
-        kwstatus = 'current'
-        kwmaps = dict(ui.configitems('keywordmaps')) or deftemplates
     tmpdir = tempfile.mkdtemp('', 'kwdemo.')
     if ui.verbose:
         ui.status(_('creating temporary repo at %s\n') % tmpdir)
     _repo = localrepo.localrepository(ui, path=tmpdir, create=True)
-    reposetup(ui, _repo)
+    _repo.ui.setconfig('keyword', fn, '')
+    if opts['default']:
+        kwstatus = 'default'
+        kwmaps = deftemplates
+    else:
+        kwstatus = 'current'
+        kwmaps = dict(ui.configitems('keywordmaps')) or deftemplates
+    if ui.configitems('keywordmaps'):
+        for k, v in kwmaps.items():
+            _repo.ui.setconfig('keywordmaps', k, v)
+    reposetup(_repo.ui, _repo)
     ui.status(_('config with %s keyword maps:\n') % kwstatus)
     ui.write('[keyword]\n%s =\n[keywordmaps\n' % fn)
     for k, v in kwmaps.items():