changeset 321:103df4b7a0c8

A new more flexible syntax for custom keyword expansion: with Python template format syntax now
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 20 Feb 2019 23:09:10 +0100
parents 82aed4bbb916
children 950a9bd55d7e
files extensions/kwarchive.py tests/lib-test-kwarchive.sh tests/test-kwarchive.t
diffstat 3 files changed, 127 insertions(+), 126 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/kwarchive.py	Wed Feb 20 22:48:46 2019 +0100
+++ b/extensions/kwarchive.py	Wed Feb 20 23:09:10 2019 +0100
@@ -59,14 +59,13 @@
     Revision =
     #
     # Additionally: `MyKeyword' is expanded with the contents of the
-    # pre-defined `JustDate'
+    # pre-defined `JustDate' (this is in Python's format syntax).
     #
-    MyKeyword = JustDate
+    MyKeyword = {JustDate}
     #
-    # `MyCustomSubstKeyword' is a substitution keyword. It's value is the
-    # plain string after "replace:: ".
+    # `MyCustomSubstKeyword' is a substitution keyword.
     #
-    MyCustomSubstKeyword = replace:: This is my replacement content
+    MyCustomSubstKeyword = This is my replacement content
 
 A non-existing ``.hgkwarchive`` file deactivates keyword expansion as does
 an empty ``[patterns]`` section.
@@ -506,7 +505,7 @@
         if filterdata is None:
             return data
         matcher, matcher_rcs, matcher_rst, manifest, \
-            keyword_whitelist, keyword_substitutions, keywords  = filterdata
+            keyword_substitutions, keywords  = filterdata
 
         if not matcher(rel_name_in_subrepo):
             #ui.write("NOT MATCHER for " + real_name + " (name: " + name + ") \n")
@@ -518,17 +517,28 @@
         # file specific keywords
         file_keywords = make_file_keywords(
             keywords, rel_name_in_subrepo, nodeid)
+        _predef_keywords = keywords.copy()
+        _predef_keywords.update(file_keywords)
         # This prevents unwanted keyword expansion here
         _MARKER_RCS = '$'
         _MARKER_RST = '|'
         for kw, value in itertools.chain(keyword_substitutions.items(), keywords.items(), file_keywords.items()):
             #
-            # an empty database means: all keywords allowed, no aliases,
-            # no substitutions
+            # Non-empty keyword_substitutions are an implicit whitelist and
+            # the value are Python format templates when expanding.
             #
-            if keyword_whitelist:
-                kwds = keyword_whitelist.get(kw, [])
+            if keyword_substitutions:
+                if kw in keyword_substitutions:
+                    kwds = [kw]
+                    if value:
+                        value = value.format(**_predef_keywords)
+                    else:
+                        value = _predef_keywords[kw]
+                else:
+                    # not whitelisted -> ignore
+                    kwds = []
             else:
+                # Empty keyword_substitutions mean: expand built-in keywords 
                 kwds = [kw]
             for kw in kwds:
                 if matcher_rcs(rel_name_in_subrepo):
@@ -621,25 +631,16 @@
                                       include=[], exclude=[])
 
         #
-        # This is the mapping from all the (white-listed) pre-defined
-        # keywords to the keywords to be expanded in files (which can be
-        # aliases. An empty right-side keyword maps the "alias" to itself.
-        #
-        keyword_whitelist = {}
-        #
-        # This are the substitution keywords:
-        # this keywords are substituted with just another plain text
-        # (no real templates!)
+        # This are the settings of the [keywords] section in .hgkwarchive.
+        # An empty section means: all default keywords are enabled.
+        # Otherwise only the given keywords are enabled with their expanded
+        # values on the right side. An empty right side means: use the default
+        # expansion.
         #
         keyword_substitutions = {}
 
         for alias, value in cfg.items("keywords"):
-            if value.startswith("replace:: "):
-                # allow is to be replaced: put it into the global white list
-                keyword_whitelist[alias] = [alias]
-                keyword_substitutions[alias] = value[len("replace:: "):]
-            else:
-                keyword_whitelist.setdefault(value or alias, []).append(alias)
+            keyword_substitutions[alias] = value
 
         #
         # Get the manifest to be able to determine a file's NodeId
@@ -648,7 +649,7 @@
 
         return (matcher, matcher_rcs, matcher_rst,
                 manifest,
-                keyword_whitelist, keyword_substitutions, keywords,)
+                keyword_substitutions, keywords,)
 
 
 def _amend_filterdata_by_subrepos(filterdata_by_subrepos,
--- a/tests/lib-test-kwarchive.sh	Wed Feb 20 22:48:46 2019 +0100
+++ b/tests/lib-test-kwarchive.sh	Wed Feb 20 23:09:10 2019 +0100
@@ -61,9 +61,9 @@
 HGrevision =
 Author =
 
-MyFullRevision = HGrevision
+MyFullRevision = {HGrevision}
 
-MySubstKeyword = replace:: This is a custom replacement
+MySubstKeyword = This is a custom replacement
 EOF
     cat >>$LOCAL_HGRCPATH <<EOF
 [extensions]
@@ -174,9 +174,9 @@
 HGrevision =
 Author =
 
-MyFullRevision = HGrevision
+MyFullRevision = {HGrevision}
 
-MySubstKeyword = replace:: This is a custom replacement
+MySubstKeyword = This is a custom replacement
 EOF
     cat >f1.txt <<EOF
 f1.txt: Some file content
--- a/tests/test-kwarchive.t	Wed Feb 20 22:48:46 2019 +0100
+++ b/tests/test-kwarchive.t	Wed Feb 20 23:09:10 2019 +0100
@@ -17,20 +17,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: file://$TESTTMP/repo1 $
-  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 8c27876b7952 $
+  $Revision: 54f2f8d67c37 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $
-  $HGid: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGheader: file://$TESTTMP/repo1/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGid: file://$TESTTMP/repo1/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: file://$TESTTMP/repo1/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
-  $Id: test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $Header: dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
+  $Id: test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $Source: dir1/dir2/test.file $
 
 kwprint full
@@ -45,20 +45,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: file://$TESTTMP/repo1 $
-  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 8c27876b7952 $
+  $Revision: 54f2f8d67c37 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
-  $HGid: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  $HGheader: file://$TESTTMP/repo1/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  $HGid: file://$TESTTMP/repo1/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: file://$TESTTMP/repo1/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
-  $Id: test.file 8c27876b7952 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  $Header: dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  $Id: test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
   $Source: dir1/dir2/test.file $
 
 kwprint last/person
@@ -73,20 +73,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: .../repo1 $
-  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 8c27876b7952 $
+  $Revision: 54f2f8d67c37 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: .../repo1/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 First+Second draft $
-  $HGid: .../repo1/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 First+Second draft $
+  $HGheader: .../repo1/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 First+Second draft $
+  $HGid: .../repo1/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 First+Second draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: .../repo1/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 First+Second draft $
-  $Id: test.file 8c27876b7952 1970-01-01 00:00:00 +0000 First+Second draft $
+  $Header: dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 First+Second draft $
+  $Id: test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 First+Second draft $
   $Source: dir1/dir2/test.file $
 
 kwprint short/email
@@ -101,20 +101,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: file://$TESTTMP/repo1 $
-  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 8c27876b7952 $
+  $Revision: 54f2f8d67c37 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second@example.com draft $
-  $HGid: file://$TESTTMP/repo1/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second@example.com draft $
+  $HGheader: file://$TESTTMP/repo1/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 first.second@example.com draft $
+  $HGid: file://$TESTTMP/repo1/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second@example.com draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: file://$TESTTMP/repo1/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second@example.com draft $
-  $Id: test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second@example.com draft $
+  $Header: dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second@example.com draft $
+  $Id: test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second@example.com draft $
   $Source: dir1/dir2/test.file $
 
 kwprint with default path (short)
@@ -129,20 +129,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: hg+https://hg/repo.hg $
-  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 8c27876b7952 $
+  $Revision: 54f2f8d67c37 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: hg+https://hg/repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $
-  $HGid: hg+https://hg/repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGheader: hg+https://hg/repo.hg/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGid: hg+https://hg/repo.hg/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: hg+https://hg/repo.hg/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
-  $Id: test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $Header: dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
+  $Id: test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $Source: dir1/dir2/test.file $
 
 
@@ -158,20 +158,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: https://theuser:thepass@hg.example.com:4443/repo.hg $
-  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 8c27876b7952 $
+  $Revision: 54f2f8d67c37 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $
-  $HGid: https://theuser:thepass@hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGid: https://theuser:thepass@hg.example.com:4443/repo.hg/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: https://theuser:thepass@hg.example.com:4443/repo.hg/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
-  $Id: test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $Header: dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
+  $Id: test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $Source: dir1/dir2/test.file $
 
 kwprint with nopwd default path
@@ -186,20 +186,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: https://theuser:***@hg.example.com:4443/repo.hg $
-  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 8c27876b7952 $
+  $Revision: 54f2f8d67c37 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: https://theuser:***@hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $
-  $HGid: https://theuser:***@hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGheader: https://theuser:***@hg.example.com:4443/repo.hg/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGid: https://theuser:***@hg.example.com:4443/repo.hg/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: https://theuser:***@hg.example.com:4443/repo.hg/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
-  $Id: test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $Header: dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
+  $Id: test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $Source: dir1/dir2/test.file $
 
 kwprint with nouser default path
@@ -214,20 +214,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: https://hg.example.com:4443/repo.hg $
-  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 8c27876b7952 $
+  $Revision: 54f2f8d67c37 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: https://hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $
-  $HGid: https://hg.example.com:4443/repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGheader: https://hg.example.com:4443/repo.hg/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGid: https://hg.example.com:4443/repo.hg/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: https://hg.example.com:4443/repo.hg/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
-  $Id: test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $Header: dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
+  $Id: test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $Source: dir1/dir2/test.file $
 
 kwprint with "last" path
@@ -242,20 +242,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: .../repo.hg $
-  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 8c27876b7952 $
+  $Revision: 54f2f8d67c37 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: .../repo.hg/dir1/dir2/test.file 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 first.second draft $
-  $HGid: .../repo.hg/dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGheader: .../repo.hg/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGid: .../repo.hg/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: .../repo.hg/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
-  $Id: test.file 8c27876b7952 1970-01-01 00:00:00 +0000 first.second draft $
+  $Header: dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
+  $Id: test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
   $Source: dir1/dir2/test.file $
 
 
@@ -274,7 +274,7 @@
 
   $ cat _archive/VERSION
   0.0.dev1
-  8c27876b79524a660c64a133b3d72361cdc947e4
+  54f2f8d67c3781f41d8bebd01cd19ddb86f41574
   $ cat _archive/README
   .. -*- coding: utf-8 -*-
    (?)
@@ -285,24 +285,24 @@
   :Author:  Franz Glasner
   :When:    $Date: 1970-01-01 00:00:00 +0000 $
   :Date:    1970-01-01
-  :ID:      @(#) $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/README 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  :ID:      @(#) $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/README 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
    (?)
   $ cat _archive/src/f1.py
   # -*- coding: utf-8 -*-
   # f1.py
-  # @(#) $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/src/f1.py 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  # @(#) $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/src/f1.py 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
   # $HGnodeid: d1aadfd82662afe0cb942b8ff3bc39112c5bb2cd $
   #
-  __revision__ = "$Revision: 8c27876b7952 $"
+  __revision__ = "$Revision: 54f2f8d67c37 $"
   __author__ = "Franz Glasner"
    (?)
   $ cat _archive/src/f2.py
   # -*- coding: utf-8 -*-
   # f2.py
-  # @(#) $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/src/f2.py 8c27876b79524a660c64a133b3d72361cdc947e4 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  # @(#) $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/src/f2.py 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
   # $HGnodeid: 8cee1e6f9d9a53eb720ab3b1dddd025db992bc76 $
   #
-  __revision__ = "$Revision: 8c27876b7952 $"
+  __revision__ = "$Revision: 54f2f8d67c37 $"
   __author__ = "Franz Glasner"
    (?)
 
@@ -324,12 +324,12 @@
   $ cat _archive/subrepo1/test2.txt
   test2.txt: This is a file with some replacement tests
   ^$ (re)
-  $HGheader: subrepo1/test2.txt 0c95c26060e11bb02614a08140e64df4bf9f4db1 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  $HGheader: subrepo1/test2.txt fb36e107ea3bc98cfabecbed9f4292777533cdbf 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
   $HGnodeid: a6d464aee6d2eee611b33b6ab88de136fc9eadf6 $
   $Date: 1970-01-01 00:00:00 +0000 $
   $JustDate: 1970-01-01 $
-  $HGrevision: 0c95c26060e11bb02614a08140e64df4bf9f4db1 $
-  $Revision: 0c95c26060e1 $
+  $HGrevision: fb36e107ea3bc98cfabecbed9f4292777533cdbf $
+  $Revision: fb36e107ea3b $
   $Author: First+Second+<first.second@example.com> $
   ^$ (re)
   $MySubstKeyword: This is a custom replacement $
@@ -372,17 +372,17 @@
   $ echo `pwd`
   $TESTTMP/repo3
   $ cat .hgsubstate
-  0c95c26060e11bb02614a08140e64df4bf9f4db1 subrepos1/subrepo1
+  fb36e107ea3bc98cfabecbed9f4292777533cdbf subrepos1/subrepo1
   $ cd subrepos1/subrepo1
   $ prepare_subrepo "subrepo2" "subrepos2"
   $ echo `pwd`
   $TESTTMP/repo3/subrepos1/subrepo1
   $ cat .hgsubstate
-  0c95c26060e11bb02614a08140e64df4bf9f4db1 subrepos2/subrepo2
+  fb36e107ea3bc98cfabecbed9f4292777533cdbf subrepos2/subrepo2
   $ cd ../..
   $ hg ci -m 'Include the nested subrepo'
   $ cat .hgsubstate
-  d1b8815da083673940df64aa6e450308e6b493b0 subrepos1/subrepo1
+  ea2a4310dad4d276467e2c342f8bc54d4e6a74a7 subrepos1/subrepo1
 
   $ hg kwprint -S
   $Author: first.second $
@@ -394,20 +394,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: hg+https://hg/repo.hg $
-  $HGrevision: 5da89dae8d25aa4d9c6973c1269cca7d37822e6e $
+  $HGrevision: 959ffd1bae463906774177568fdf853416cb5ca2 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 5da89dae8d25 $
+  $Revision: 959ffd1bae46 $
   $State: draft $
   ^$ (re)
   $File: test.file $
-  $HGheader: hg+https://hg/repo.hg/dir1/dir2/test.file 5da89dae8d25aa4d9c6973c1269cca7d37822e6e 1970-01-01 00:00:00 +0000 first.second draft $
-  $HGid: hg+https://hg/repo.hg/dir1/dir2/test.file 5da89dae8d25 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGheader: hg+https://hg/repo.hg/dir1/dir2/test.file 959ffd1bae463906774177568fdf853416cb5ca2 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGid: hg+https://hg/repo.hg/dir1/dir2/test.file 959ffd1bae46 1970-01-01 00:00:00 +0000 first.second draft $
   $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
   $HGsource: hg+https://hg/repo.hg/dir1/dir2/test.file $
-  $Header: dir1/dir2/test.file 5da89dae8d25 1970-01-01 00:00:00 +0000 first.second draft $
-  $Id: test.file 5da89dae8d25 1970-01-01 00:00:00 +0000 first.second draft $
+  $Header: dir1/dir2/test.file 959ffd1bae46 1970-01-01 00:00:00 +0000 first.second draft $
+  $Id: test.file 959ffd1bae46 1970-01-01 00:00:00 +0000 first.second draft $
   $Source: dir1/dir2/test.file $
   ^$ (re)
   ^$ (re)
@@ -420,20 +420,20 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: file:///subrepo1 $
-  $HGrevision: d1b8815da083673940df64aa6e450308e6b493b0 $
+  $HGrevision: ea2a4310dad4d276467e2c342f8bc54d4e6a74a7 $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: d1b8815da083 $
+  $Revision: ea2a4310dad4 $
   $State: draft $
   ^$ (re)
   $File: test-s.file $
-  $HGheader: file:///subrepo1/dir3/dir4/test-s.file d1b8815da083673940df64aa6e450308e6b493b0 1970-01-01 00:00:00 +0000 first.second draft $
-  $HGid: file:///subrepo1/dir3/dir4/test-s.file d1b8815da083 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGheader: file:///subrepo1/dir3/dir4/test-s.file ea2a4310dad4d276467e2c342f8bc54d4e6a74a7 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGid: file:///subrepo1/dir3/dir4/test-s.file ea2a4310dad4 1970-01-01 00:00:00 +0000 first.second draft $
   $HGnodeid: ffffffff22e11fec41158eec187630c24a43120a $
   $HGsource: file:///subrepo1/dir3/dir4/test-s.file $
-  $Header: dir3/dir4/test-s.file d1b8815da083 1970-01-01 00:00:00 +0000 first.second draft $
-  $Id: test-s.file d1b8815da083 1970-01-01 00:00:00 +0000 first.second draft $
+  $Header: dir3/dir4/test-s.file ea2a4310dad4 1970-01-01 00:00:00 +0000 first.second draft $
+  $Id: test-s.file ea2a4310dad4 1970-01-01 00:00:00 +0000 first.second draft $
   $Source: dir3/dir4/test-s.file $
   ^$ (re)
   ^$ (re)
@@ -446,67 +446,67 @@
   $HGlatesttagjustdate: 1970-01-01 $
   $HGlatesttags: null $
   $HGpath: file:///subrepo2 $
-  $HGrevision: 0c95c26060e11bb02614a08140e64df4bf9f4db1 $
+  $HGrevision: fb36e107ea3bc98cfabecbed9f4292777533cdbf $
   $HGshortdate: 1970-01-01 $
   $HGtags:  $
   $JustDate: 1970-01-01 $
-  $Revision: 0c95c26060e1 $
+  $Revision: fb36e107ea3b $
   $State: draft $
   ^$ (re)
   $File: test-s.file $
-  $HGheader: file:///subrepo2/dir3/dir4/test-s.file 0c95c26060e11bb02614a08140e64df4bf9f4db1 1970-01-01 00:00:00 +0000 first.second draft $
-  $HGid: file:///subrepo2/dir3/dir4/test-s.file 0c95c26060e1 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGheader: file:///subrepo2/dir3/dir4/test-s.file fb36e107ea3bc98cfabecbed9f4292777533cdbf 1970-01-01 00:00:00 +0000 first.second draft $
+  $HGid: file:///subrepo2/dir3/dir4/test-s.file fb36e107ea3b 1970-01-01 00:00:00 +0000 first.second draft $
   $HGnodeid: ffffffff22e11fec41158eec187630c24a43120a $
   $HGsource: file:///subrepo2/dir3/dir4/test-s.file $
-  $Header: dir3/dir4/test-s.file 0c95c26060e1 1970-01-01 00:00:00 +0000 first.second draft $
-  $Id: test-s.file 0c95c26060e1 1970-01-01 00:00:00 +0000 first.second draft $
+  $Header: dir3/dir4/test-s.file fb36e107ea3b 1970-01-01 00:00:00 +0000 first.second draft $
+  $Id: test-s.file fb36e107ea3b 1970-01-01 00:00:00 +0000 first.second draft $
   $Source: dir3/dir4/test-s.file $
 
   $ hg kwarchive -S --user-filter=full --path-filter=full _archive
   $ cat _archive/VERSION
   0.0.dev1
-  5da89dae8d25aa4d9c6973c1269cca7d37822e6e
+  959ffd1bae463906774177568fdf853416cb5ca2
   $ cat _archive/test2.txt
   This is a file with some replacement tests
   ^$ (re)
-  $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/test2.txt 5da89dae8d25aa4d9c6973c1269cca7d37822e6e 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  $HGheader: https://theuser:thepass@hg.example.com:4443/repo.hg/test2.txt 959ffd1bae463906774177568fdf853416cb5ca2 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
   $HGnodeid: 070aa91690d7b1f757fdc373fe61c03c5b28e0b0 $
   $Date: 1970-01-01 00:00:00 +0000 $
   $JustDate: 1970-01-01 $
-  $HGrevision: 5da89dae8d25aa4d9c6973c1269cca7d37822e6e $
-  $Revision: 5da89dae8d25 $
+  $HGrevision: 959ffd1bae463906774177568fdf853416cb5ca2 $
+  $Revision: 959ffd1bae46 $
   $Author: First+Second+<first.second@example.com> $
   ^$ (re)
   $MySubstKeyword: This is a custom replacement $
   This is a custom replacement
   $ cat _archive/subrepos1/subrepo1/VERSION
   0.0.dev1
-  d1b8815da083673940df64aa6e450308e6b493b0
+  ea2a4310dad4d276467e2c342f8bc54d4e6a74a7
   $ cat _archive/subrepos1/subrepo1/test2.txt
   test2.txt: This is a file with some replacement tests
   ^$ (re)
-  $HGheader: file:///subrepo1/test2.txt d1b8815da083673940df64aa6e450308e6b493b0 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  $HGheader: file:///subrepo1/test2.txt ea2a4310dad4d276467e2c342f8bc54d4e6a74a7 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
   $HGnodeid: a6d464aee6d2eee611b33b6ab88de136fc9eadf6 $
   $Date: 1970-01-01 00:00:00 +0000 $
   $JustDate: 1970-01-01 $
-  $HGrevision: d1b8815da083673940df64aa6e450308e6b493b0 $
-  $Revision: d1b8815da083 $
+  $HGrevision: ea2a4310dad4d276467e2c342f8bc54d4e6a74a7 $
+  $Revision: ea2a4310dad4 $
   $Author: First+Second+<first.second@example.com> $
   ^$ (re)
   $MySubstKeyword: This is a custom replacement $
   This is a custom replacement
   $ cat _archive/subrepos1/subrepo1/subrepos2/subrepo2/VERSION
   0.0.dev1
-  0c95c26060e11bb02614a08140e64df4bf9f4db1
+  fb36e107ea3bc98cfabecbed9f4292777533cdbf
   $ cat _archive/subrepos1/subrepo1/subrepos2/subrepo2/test2.txt
   test2.txt: This is a file with some replacement tests
   ^$ (re)
-  $HGheader: file:///subrepo2/test2.txt 0c95c26060e11bb02614a08140e64df4bf9f4db1 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
+  $HGheader: file:///subrepo2/test2.txt fb36e107ea3bc98cfabecbed9f4292777533cdbf 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
   $HGnodeid: a6d464aee6d2eee611b33b6ab88de136fc9eadf6 $
   $Date: 1970-01-01 00:00:00 +0000 $
   $JustDate: 1970-01-01 $
-  $HGrevision: 0c95c26060e11bb02614a08140e64df4bf9f4db1 $
-  $Revision: 0c95c26060e1 $
+  $HGrevision: fb36e107ea3bc98cfabecbed9f4292777533cdbf $
+  $Revision: fb36e107ea3b $
   $Author: First+Second+<first.second@example.com> $
   ^$ (re)
   $MySubstKeyword: This is a custom replacement $