diff -r d8cd07b798f2 -r 56a61a5c696d hgkw/pretxnkw.py --- a/hgkw/pretxnkw.py Thu Dec 14 13:52:53 2006 +0100 +++ b/hgkw/pretxnkw.py Thu Dec 14 16:24:30 2006 +0100 @@ -1,8 +1,8 @@ -# $Hg: pretxnkw.py,v$ +# $Hg: hgkw/pretxnkw.py,v$ from mercurial.i18n import gettext as _ from mercurial.demandload import demandload -demandload(globals(), 'hgkw:kwutil mercurial:util os.path re') +demandload(globals(), 'hgkw:kwutil mercurial:util re') kwencodefilter = 'hgkwencode' @@ -37,16 +37,17 @@ for filename in files: data = repo.wfile(filename).read() - bn = os.path.basename(filename) - # check for keywords with incorrect basename - # eg. if you forgot to update basename manually after "hg mv" - failures = [m for m in map(str, re_kwcheck.findall(data)) if m != bn] - if failures: - failures = ['%sHg: %s,v$' % ('$', nobn) for nobn in failures] - ui.warn(_('%d incorrect basenames in file %s:\n' + # check for keywords with incorrect filename + # eg. if you forgot to update filename manually after "hg mv" + invalids = [m for m in map(str, re_kwcheck.findall(data)) + if m != filename] + if invalids: + invalids = ['%sHg: %s,v$' % ('$', i) for i in invalids] + ui.warn(_('%d invalid keyword filenames in file %s:\n' '%s\nplease correct to %sHg: %s,v$\n' - % (len(failures), filename, ', '.join(failures), '$', bn))) + % (len(invalids), filename, ', '.join(invalids), '$', filename) + )) return True # substitute (Hg|Id): ,v.*