hgkw/keyword.py
branchkwmap-templates
changeset 184 30b3e6a09a9d
parent 183 80fa00250c6d
child 185 bc5cd6cf69bc
--- a/hgkw/keyword.py	Tue Jul 17 09:24:27 2007 +0200
+++ b/hgkw/keyword.py	Tue Jul 17 09:45:36 2007 +0200
@@ -222,7 +222,9 @@
     tmpdir = tempfile.mkdtemp('', 'kwdemo.')
     ui.note(_('creating temporary repo at %s\n') % tmpdir)
     _repo = localrepo.localrepository(ui, path=tmpdir, create=True)
-    _repo.ui.setconfig('keyword', fn, '')
+    # for backwards compatibility
+    ui = _repo.ui
+    ui.setconfig('keyword', fn, '')
     if opts['default']:
         kwstatus = 'default'
         kwmaps = deftemplates
@@ -231,8 +233,8 @@
         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.setconfig('keywordmaps', k, v)
+    reposetup(ui, _repo)
     ui.status(_('config with %s keyword template maps:\n') % kwstatus)
     ui.write('[keyword]\n%s =\n[keywordmaps]\n' % fn)
     for k, v in kwmaps.items():
@@ -261,16 +263,16 @@
     This is done for local repos only, and only if there are
     files configured at all for keyword substitution.'''
 
-    if not repo.local() or getcmd(repo.ui) in nokwcommands:
+    # for backwards compatibility
+    ui = repo.ui
+
+    if not repo.local() or getcmd(ui) in nokwcommands:
         return
 
     kwfmatcher = keywordmatcher(ui, repo)
     if kwfmatcher is None:
         return
 
-    # for backwards compatibility
-    ui = repo.ui
-
     class kwrepo(repo.__class__):
         def file(self, f):
             if f[0] == '/':