diff -r 27f2e2126447 -r f56004dedc1e hgkw/keyword.py --- a/hgkw/keyword.py Mon Jan 07 12:02:23 2008 +0100 +++ b/hgkw/keyword.py Wed Jan 09 12:52:59 2008 +0100 @@ -211,7 +211,7 @@ self.ui = ui self.repo = repo self.matcher = util.matcher(repo.root, inc=inc, exc=exc)[1] - self.node = None + self.commitnode = None self.path = '' kwmaps = self.ui.configitems('keywordmaps') @@ -237,18 +237,20 @@ False, None, '', False) def substitute(self, node, data, subfunc): - '''Obtains node if missing, and calls given substitution function.''' - if not self.node: + '''Obtains file's changenode if commit node not given, + and calls given substitution function.''' + if self.commitnode: + fnode = self.commitnode + else: c = context.filectx(self.repo, self.path, fileid=node) - self.node = c.node() + fnode = c.node() def kwsub(mobj): '''Substitutes keyword using corresponding template.''' kw = mobj.group(1) self.ct.use_template(self.templates[kw]) self.ui.pushbuffer() - self.ct.show(changenode=self.node, - root=self.repo.root, file=self.path) + self.ct.show(changenode=fnode, root=self.repo.root, file=self.path) return '$%s: %s $' % (kw, templater.firstline(self.ui.popbuffer())) return subfunc(kwsub, data) @@ -326,17 +328,17 @@ '''Overwrites selected files expanding/shrinking keywords.''' ctx = repo.changectx(node) mf = ctx.manifest() - if files is None: - notify = ui.debug # commit + if node is not None: # commit + _kwtemplater.commitnode = node files = [f for f in ctx.files() if mf.has_key(f)] - else: - notify = ui.note # kwexpand/kwshrink + notify = ui.debug + else: # kwexpand/kwshrink + notify = ui.note candidates = [f for f in files if _iskwfile(f, mf.linkf)] if candidates: overwritten = [] candidates.sort() action = expand and 'expanding' or 'shrinking' - _kwtemplater.node = node or ctx.node() for f in candidates: fp = repo.file(f, kwmatch=True) data, kwfound = fp.kwctread(mf[f], expand) @@ -502,7 +504,8 @@ returns True if keyword expansion not needed.''' nokwcommands = ('add', 'addremove', 'bundle', 'clone', 'copy', 'export', 'grep', 'identify', 'incoming', 'init', - 'outgoing', 'push', 'remove', 'rename', 'rollback', + 'log', 'outgoing', 'push', 'remove', 'rename', + 'rollback', 'tip', 'convert') args = fancyopts(sys.argv[1:], commands.globalopts, {}) if args: