Show More
@@ -88,6 +88,7 b' from __future__ import absolute_import' | |||||
88 | import os |
|
88 | import os | |
89 | import re |
|
89 | import re | |
90 | import tempfile |
|
90 | import tempfile | |
|
91 | import weakref | |||
91 |
|
92 | |||
92 | from mercurial.i18n import _ |
|
93 | from mercurial.i18n import _ | |
93 | from mercurial.hgweb import webcommands |
|
94 | from mercurial.hgweb import webcommands | |
@@ -212,7 +213,7 b' class kwtemplater(object):' | |||||
212 |
|
213 | |||
213 | def __init__(self, ui, repo, inc, exc): |
|
214 | def __init__(self, ui, repo, inc, exc): | |
214 | self.ui = ui |
|
215 | self.ui = ui | |
215 | self.repo = repo |
|
216 | self._repo = weakref.ref(repo) | |
216 | self.match = match.match(repo.root, '', [], inc, exc) |
|
217 | self.match = match.match(repo.root, '', [], inc, exc) | |
217 | self.restrict = kwtools['hgcmd'] in restricted.split() |
|
218 | self.restrict = kwtools['hgcmd'] in restricted.split() | |
218 | self.postcommit = False |
|
219 | self.postcommit = False | |
@@ -223,6 +224,10 b' class kwtemplater(object):' | |||||
223 | else: |
|
224 | else: | |
224 | self.templates = _defaultkwmaps(self.ui) |
|
225 | self.templates = _defaultkwmaps(self.ui) | |
225 |
|
226 | |||
|
227 | @property | |||
|
228 | def repo(self): | |||
|
229 | return self._repo() | |||
|
230 | ||||
226 | @util.propertycache |
|
231 | @util.propertycache | |
227 | def escape(self): |
|
232 | def escape(self): | |
228 | '''Returns bar-separated and escaped keywords.''' |
|
233 | '''Returns bar-separated and escaped keywords.''' | |
@@ -658,6 +663,9 b' def reposetup(ui, repo):' | |||||
658 | finally: |
|
663 | finally: | |
659 | kwt.restrict = origrestrict |
|
664 | kwt.restrict = origrestrict | |
660 |
|
665 | |||
|
666 | repo.__class__ = kwrepo | |||
|
667 | repo._keywordkwt = kwt | |||
|
668 | ||||
661 | # monkeypatches |
|
669 | # monkeypatches | |
662 | def kwpatchfile_init(orig, self, ui, gp, backend, store, eolmode=None): |
|
670 | def kwpatchfile_init(orig, self, ui, gp, backend, store, eolmode=None): | |
663 | '''Monkeypatch/wrap patch.patchfile.__init__ to avoid |
|
671 | '''Monkeypatch/wrap patch.patchfile.__init__ to avoid | |
@@ -768,4 +776,3 b' def reposetup(ui, repo):' | |||||
768 | extensions.wrapfunction(cmdutil, 'dorecord', kw_dorecord) |
|
776 | extensions.wrapfunction(cmdutil, 'dorecord', kw_dorecord) | |
769 | for c in nokwwebcommands.split(): |
|
777 | for c in nokwwebcommands.split(): | |
770 | extensions.wrapfunction(webcommands, c, kwweb_skip) |
|
778 | extensions.wrapfunction(webcommands, c, kwweb_skip) | |
771 | repo.__class__ = kwrepo |
|
General Comments 0
You need to be logged in to leave comments.
Login now