Switch to complete filename in first keyword field decodefilter
authorChristian Ebert <blacktrash@gmx.net>
Thu, 14 Dec 2006 16:24:30 +0100
branchdecodefilter
changeset 11 56a61a5c696d
parent 10 d8cd07b798f2
child 12 d9c4fc735963
Switch to complete filename in first keyword field This will hopefully allow to iterate over the stream in hgkwdecode, and lookup the relatively latest revision of corresponding file.
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 <Dollar>(Hg|Id): <basename>,v.*<Dollar>