diff -r b0db8ec7ac78 -r ac67adabce13 hgkw/keyword.py --- a/hgkw/keyword.py Fri Dec 29 13:02:29 2006 +0100 +++ b/hgkw/keyword.py Fri Dec 29 13:57:57 2006 +0100 @@ -15,9 +15,10 @@ files (like LaTeX packages), that are mostly addressed to an audience not running a version control system. -The extension consists actually in 2 parts: +The extension, according to its hackish nature, is a hybrid and consists +actually in 2 parts: - 1. extension code (reposetup) that is triggered on checkout and + 1. pure extension code (reposetup) that is triggered on checkout and logging of changes. 2. a pretxncommit hook (hgrc (5)) that expands keywords immediately at commit time in the working directory. @@ -82,7 +83,6 @@ def read(self, node): data = super(kwfilelog, self).read(node) if not self._path.startswith('.hg') and not util.binary(data): - c = context.filectx(self._repo, self._path, fileid=node, filelog=self) for pat, opt in self._repo.ui.configitems('keyword'): @@ -140,27 +140,22 @@ # validity checks should have been done already modified, added = repo.status(files=files, match=match)[:2] candidates = [f for f in modified + added if not f.startswith('.hg')] - if not candidates: return False # only check files that are configured in keyword section files = [] - # python2.4: files = set() for pat, opt in repo.ui.configitems('keyword'): if opt == 'expand': mf = util.matcher(repo.root, '', [pat], [], [])[1] for candidate in candidates: if mf(candidate) and candidate not in files: files.append(candidate) - # python2.4: - # if mf(candidate): files.add(candidate) - if not files: return False user, date = repo.changelog.read(repo.changelog.tip())[1:3] - # expand both expanded and unexpanded keywords + # update both expanded and unexpanded keywords re_kw = re.compile(r'\$(%s)(: [^$]+? )?\$' % hgkeywords) for f in files: @@ -174,5 +169,4 @@ data, kwct = re_kw.subn(kwexpander, data) if kwct: ui.note(_('expanding keywords in %s\n' % f)) - # backup file? repo.wfile(f, 'w').write(data)