--- a/hgkw/keyword.py Sat Oct 13 15:01:55 2007 +0200
+++ b/hgkw/keyword.py Sat Oct 13 15:25:06 2007 +0200
@@ -215,7 +215,7 @@
except AttributeError:
self.repo.dirstate.update(files, 'n')
- def _kwsub(self, mobj):
+ def kwsub(self, mobj):
'''Substitutes keyword using corresponding template.'''
kw = mobj.group(1)
self.t.use_template(self.templates[kw])
@@ -224,7 +224,7 @@
keywordsub = templater.firstline(self.ui.popbuffer())
return '$%s: %s $' % (kw, keywordsub)
- def _substitute(self, node, data, subfunc):
+ def substitute(self, node, data, subfunc):
'''Obtains node if missing.
Ensures consistent templates regardless of ui.debugflag.
Calls given substitution function.'''
@@ -232,7 +232,7 @@
c = context.filectx(self.repo, self.path, fileid=node)
self.node = c.node()
self.ui.debugflag = False
- result = subfunc(self._kwsub, data)
+ result = subfunc(self.kwsub, data)
self.ui.debugflag = self.debug
return result
@@ -240,7 +240,7 @@
'''Returns data with keywords expanded.'''
if util.binary(data):
return data
- return self._substitute(node, data, self.re_kw.sub)
+ return self.substitute(node, data, self.re_kw.sub)
def process(self, node, data):
'''Returns a tuple: data, count.
@@ -249,7 +249,7 @@
if util.binary(data):
return data, None
if self.t:
- return self._substitute(node, data, self.re_kw.subn)
+ return self.substitute(node, data, self.re_kw.subn)
return data, self.re_kw.search(data)
def shrink(self, text):
@@ -393,10 +393,10 @@
Override current keyword template maps with "default" option.
'''
- def _demostatus(stat):
+ def demostatus(stat):
ui.status(_('\n\t%s\n') % stat)
- def _showitems(section, items):
+ def demoitems(section, items):
ui.write('[%s]\n' % section)
for k, v in items:
ui.write('%s = %s\n' % (k, v))
@@ -434,10 +434,10 @@
if k.endswith('keyword'):
extension = '%s = %s' % (k, v)
break
- _demostatus('config using %s keyword template maps' % kwstatus)
+ demostatus('config using %s keyword template maps' % kwstatus)
ui.write('[extensions]\n%s\n' % extension)
- _showitems('keyword', ui.configitems('keyword'))
- _showitems('keywordmaps', kwmaps.items())
+ demoitems('keyword', ui.configitems('keyword'))
+ demoitems('keywordmaps', kwmaps.items())
keywords = '$' + '$\n$'.join(kwmaps.keys()) + '$\n'
repo.wopener(fn, 'w').write(keywords)
repo.add([fn])
@@ -454,7 +454,7 @@
ui.note('hg -R "%s" ci -m "%s"\n' % (tmpdir, msg))
repo.commit(text=msg)
pathinfo = ('', ' in %s' % path)[ui.verbose]
- _demostatus('%s keywords expanded%s' % (kwstatus, pathinfo))
+ demostatus('%s keywords expanded%s' % (kwstatus, pathinfo))
ui.write(repo.wread(fn))
ui.debug(_('\nremoving temporary repo %s\n') % tmpdir)
shutil.rmtree(tmpdir, ignore_errors=True)