Make all ui config and kwfmatcher a local repo attribute kwmap-templates
authorChristian Ebert <blacktrash@gmx.net>
Wed, 07 Feb 2007 15:50:57 +0100
branchkwmap-templates
changeset 123 6cf933de685a
parent 122 d5c80df59655
child 124 99dc49c5bcfb
Make all ui config and kwfmatcher a local repo attribute See Mercurial changeset: 5d9ede002453
hgkw/keyword.py
--- a/hgkw/keyword.py	Fri Jan 26 12:10:53 2007 +0000
+++ b/hgkw/keyword.py	Wed Feb 07 15:50:57 2007 +0100
@@ -142,7 +142,7 @@
         return
 
     inc, exc = [], ['.hg*']
-    for pat, opt in ui.configitems('keyword'):
+    for pat, opt in repo.ui.configitems('keyword'):
         if opt != 'ignore':
             inc.append(pat)
         else:
@@ -150,7 +150,7 @@
     if not inc:
         return
 
-    ui.kwfmatcher = util.matcher(repo.root, inc=inc, exc=exc)[1]
+    repo.kwfmatcher = util.matcher(repo.root, inc=inc, exc=exc)[1]
 
     class kwrepo(repo.__class__):
         def file(self, f):
@@ -169,8 +169,8 @@
             self._repo = repo
             self._path = path
             # only init kwtemplater if needed
-            if not isinstance(repo, int) and ui.kwfmatcher(path):
-                self.kwt = kwtemplater(ui, repo)
+            if not isinstance(repo, int) and repo.kwfmatcher(path):
+                self.kwt = kwtemplater(repo.ui, repo)
             else:
                 self.kwt = None
 
@@ -204,7 +204,7 @@
     filelog.filelog = kwfilelog
     repo.__class__ = kwrepo
     # configure pretxncommit hook
-    ui.setconfig('hooks', 'pretxncommit.keyword',
+    repo.ui.setconfig('hooks', 'pretxncommit.keyword',
             'python:%s.pretxnkw' % getmodulename())
 
 
@@ -218,7 +218,7 @@
 
     files, match, anypats = cmdutil.matchpats(repo, sysargs, cmdopts)
     modified, added = repo.status(files=files, match=match)[:2]
-    candidates = [f for f in modified + added if ui.kwfmatcher(f)]
+    candidates = [f for f in modified + added if repo.kwfmatcher(f)]
     if not candidates:
         return