diff -r 01c42124151a -r 849e28e03fb4 hgkw/keyword.py --- a/hgkw/keyword.py Wed Jun 20 13:16:38 2007 +0200 +++ b/hgkw/keyword.py Wed Jun 20 13:22:11 2007 +0200 @@ -99,7 +99,7 @@ } kwcommands = ('status', 'commit', 'update', 'revert', 'backout', 'diff', 'cat', - 'archive', 'pull', 'unbundle', 'import') + 'archive', 'pull', 'unbundle', 'import') def utcdate(date): '''Returns hgdate in cvs-like UTC format.''' @@ -132,18 +132,17 @@ # parse templates here for less overhead in kwsub matchfunc for k in templates.keys(): templates[k] = templater.parsestring(templates[k], - quoted=False) + quoted=False) self.templates = templates or deftemplates - self.re_kw = re.compile(r'\$(%s)[^$]*?\$' % - '|'.join([re.escape(k) for k in self.templates.keys()])) + escaped = [re.escape(k) for k in self.templates.keys()] + self.re_kw = re.compile(r'\$(%s)[^$]*?\$' % '|'.join(escaped)) templater.common_filters['utcdate'] = utcdate try: - self.t = cmdutil.changeset_templater(ui, repo, - False, '', False) + 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) + False, None, '', False) def kwsub(self, mobj): '''Substitutes keyword using corresponding template.''' @@ -201,8 +200,7 @@ def add(self, text, meta, tr, link, p1=None, p2=None): '''Removes keyword substitutions when adding to filelog.''' text = self.kwtemplater.shrink(text) - return super(kwfilelog, self).add(text, - meta, tr, link, p1=p1, p2=p2) + return super(kwfilelog, self).add(text, meta, tr, link, p1=p1, p2=p2) def cmp(self, node, text): '''Removes keyword substitutions for comparison.''' @@ -245,8 +243,8 @@ return filelog.filelog(self.sopener, f) def commit(self, files=None, text="", user=None, date=None, - match=util.always, force=False, lock=None, wlock=None, - force_editor=False, p1=None, p2=None, extra={}): + match=util.always, force=False, lock=None, wlock=None, + force_editor=False, p1=None, p2=None, extra={}): '''Wraps commit, expanding keywords of committed and configured files in working directory.''' wrelease = False @@ -256,17 +254,19 @@ try: removed = self.status()[2] - node = super(kwrepo, self).commit(files=files, - text=text, user=user, date=date, - match=match, force=force, lock=lock, wlock=wlock, - force_editor=force_editor, p1=p1, p2=p2, extra=extra) + node = super(kwrepo, + self).commit(files=files, text=text, user=user, + date=date, match=match, force=force, + lock=lock, wlock=wlock, + force_editor=force_editor, + p1=p1, p2=p2, extra=extra) if node is None: return node candidates = self.changelog.read(node)[3] candidates = [f for f in candidates if self.kwfmatcher(f) - and f not in removed - and not os.path.islink(self.wjoin(f))] + and f not in removed + and not os.path.islink(self.wjoin(f))] if not candidates: return node