hgkw/keyword.py
branchsolo-extension
changeset 58 9b428ae6ff15
parent 57 f95c21f87e9c
child 59 94b26168791d
--- a/hgkw/keyword.py	Fri Dec 29 15:23:58 2006 +0100
+++ b/hgkw/keyword.py	Fri Dec 29 15:36:50 2006 +0100
@@ -94,11 +94,11 @@
                         mf = util.matcher(self._repo.root,
                                 '', [pat], [], [])[1]
                         if mf(self._path):
-                            def kwexpander(matchobj):
-                                return kwexpand(matchobj, self._repo,
-                                        self._path, fileid=node, filelog=self)
                             re_kw = re.compile(r'\$(%s)\$' % hgkeywords)
-                            return re_kw.sub(kwexpander, data)
+                            return re_kw.sub(lambda m:
+                                    kwexpand(m, self._repo, self._path,
+                                        fileid=node, filelog=self),
+                                    data)
             return data
 
         def add(self, text, meta, tr, link, p1=None, p2=None):
@@ -161,9 +161,9 @@
     for f in files:
         data = repo.wfile(f).read()
         if not util.binary(data):
-            def kwexpander(matchobj):
-                return kwexpand(matchobj, repo, f, changeid=args['node'])
-            data, kwct = re_kw.subn(kwexpander, data)
+            data, kwct = re_kw.subn(lambda m:
+                    kwexpand(m, repo, f, changeid=args['node']),
+                    data)
             if kwct:
                 ui.note(_('expanding keywords in %s\n' % f))
                 repo.wfile(f, 'w').write(data)