diff -r f869c65156f7 -r a4c748fc7e00 hgkw/keyword.py --- a/hgkw/keyword.py Fri Feb 09 14:43:01 2007 +0100 +++ b/hgkw/keyword.py Fri Feb 09 16:13:51 2007 +0100 @@ -71,11 +71,17 @@ hgrc files. ''' -from mercurial.i18n import gettext as _ -# above line for backwards compatibility of standalone version -from mercurial import cmdutil, templater, util -from mercurial import context, filelog, revlog -import os.path, re, time +try: + from mercurial.demandload import * # stable + from mercurial.i18n import gettext as _ + demandload(globals(), 'mercurial:cmdutil,templater,util') + demandload(globals(), 'mercurial:context,filelog,revlog') + demandload(globals(), 'os.path re time') +except ImportError: # demandimport + from mercurial.i18n import _ + from mercurial import cmdutil, templater, util + from mercurial import context, filelog, revlog + import os.path, re, time deftemplates = { 'Revision': '{node|short}', @@ -103,7 +109,13 @@ self.re_kw = re.compile(r'\$(%s)[^$]*?\$' % '|'.join(re.escape(k) for k in self.templates.keys())) templater.common_filters['utcdate'] = utcdate - self.t = cmdutil.changeset_templater(ui, repo, False, '', False) + try: + self.t = cmdutil.changeset_templater(ui, repo, + False, '', False) + except TypeError: + # depending on hg rev changeset_templater has extra "brinfo" arg + self.t = cmdutil.changeset_templater(ui, repo, + False, None, '', False) def kwsub(self, mobj, path, node): '''Substitutes keyword using corresponding template.'''