view tests/test-kwarchive.t @ 440:72df885a1012 default tip trunk

===== signature for changeset e1ae0c15acfc
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 30 May 2026 13:16:08 +0200
parents f30f31577c8b
children
line wrap: on
line source


Setup

  $ . $TESTDIR/lib-test-kwarchive.sh
  $ prepare_repo "repo1"
  $ cd "repo1"

kwprint (defaults -- nopwd/user)

  $ hg kwprint --path=.
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: file://$TESTTMP/repo1 $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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

  $ hg kwprint --path=. --path-filter=full --user-filter=full
  $Author: First+Second+<first.second@example.com> $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: file://$TESTTMP/repo1 $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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

  $ hg kwprint --path=. --user-filter=person --path-filter=last
  $Author: First+Second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: .../repo1 $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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

  $ hg kwprint --path=. --user-filter=email --path-filter=short
  $Author: first.second@example.com $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: file://$TESTTMP/repo1 $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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)

  $ hg kwprint
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: hg+https://hg/repo.hg $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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 full default path

  $ hg kwprint --path-filter=full
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: https://theuser:thepass@hg.example.com:4443/repo.hg $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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

  $ hg kwprint --path-filter=nopwd
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: https://theuser:***@hg.example.com:4443/repo.hg $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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

  $ hg kwprint --path-filter=nouser
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: https://hg.example.com:4443/repo.hg $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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

  $ hg kwprint --path-filter=last
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: .../repo.hg $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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 "repo" path

  $ hg kwprint --path-filter=repo
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: repo:32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $HGheader: repo:32ee1d210af8d5434587ac0b0494e90d69bbfce8/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 first.second draft $
  $HGid: repo:32ee1d210af8d5434587ac0b0494e90d69bbfce8/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
  $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
  $HGsource: repo:32ee1d210af8d5434587ac0b0494e90d69bbfce8/dir1/dir2/test.file $
  $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 "reposhort" path

  $ hg kwprint --path-filter=reposhort
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: repo:32ee1d210af8 $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 54f2f8d67c37 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $HGheader: repo:32ee1d210af8/dir1/dir2/test.file 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 first.second draft $
  $HGid: repo:32ee1d210af8/dir1/dir2/test.file 54f2f8d67c37 1970-01-01 00:00:00 +0000 first.second draft $
  $HGnodeid: a4dd6f4b22e11fec41158eec187630c24a43120a $
  $HGsource: repo:32ee1d210af8/dir1/dir2/test.file $
  $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 $


Archiving ...

  $ hg kwarchive --path-filter=full --user-filter=full _archive

... check not expanded files for identity

  $ cmp .hgkwarchive _archive/.hgkwarchive
  $ cmp test2-not-expanded.txt _archive/test2-not-expanded.txt
  $ cmp src/f1.txt _archive/src/f1.txt
  $ cmp src/f2.txt _archive/src/f2.txt

.. check expanded files

  $ cat _archive/VERSION
  0.0.dev1
  54f2f8d67c3781f41d8bebd01cd19ddb86f41574
  $ cat _archive/README
  .. -*- coding: utf-8 -*-
   (?)
   (?)
  Testing the kwarchive extension
  ===============================
   (?)
  :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 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 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
  # $HGnodeid: d1aadfd82662afe0cb942b8ff3bc39112c5bb2cd $
  #
  __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 54f2f8d67c3781f41d8bebd01cd19ddb86f41574 1970-01-01 00:00:00 +0000 First+Second+<first.second@example.com> draft $
  # $HGnodeid: 8cee1e6f9d9a53eb720ab3b1dddd025db992bc76 $
  #
  __revision__ = "$Revision: 54f2f8d67c37 $"
  __author__ = "Franz Glasner"
   (?)

  $ cd ..

Archiving with subrepos

  $ prepare_repo "repo2"
  $ cd "repo2"
  $ prepare_subrepo "subrepo1"
  $ echo `pwd`
  $TESTTMP/repo2
  $ cat .hgsubstate
  ^[a-f0-9]+\s+subrepo1$ (re)

... archiving subrepos does expand correctly configured subrepos also

  $ hg kwarchive -S --path-filter=full --user-filter=full _archive
  $ cat _archive/subrepo1/test2.txt
  test2.txt: This is a file with some replacement tests
  ^$ (re)
  $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: fb36e107ea3bc98cfabecbed9f4292777533cdbf $
  $Revision: fb36e107ea3b $
  $Author: First+Second+<first.second@example.com> $
  ^$ (re)
  $MySubstKeyword: This is a custom replacement $
  This is a custom replacement

... but simply configuring it in the parent within the "patterns" yields
... an error

  $ cat >.hgkwarchive <<EOF
  > [patterns]
  > subrepo1/** = RCS, reST
  > src/**.py = RCS, reST
  > path:VERSION = reST
  > path:README = RCS, reST
  > path:test2.txt = RCS, reST
  > subrepo1/** = RCS, reST
  > [keywords]
  > JustDate =
  > HGheader =
  > HGnodeid =
  > Date =
  > Revision =
  > HGrevision =
  > Author =
  > MyFullRevision = HGrevision
  > MySubstKeyword = replace:: This is a custom replacement
  > EOF
  $ hg commit -m "New kwarchive configuration"
  $ hg kwarchive -S --path-filter=full --user-filter=full _archive2
  abort: path 'subrepo1/**' is inside nested repo 'subrepo1'
  [255]

  $ cd ..

Archiving with nested subrepos

  $ prepare_repo "repo3"
  $ cd "repo3"
  $ prepare_subrepo "subrepo1" "subrepos1"
  $ echo `pwd`
  $TESTTMP/repo3
  $ cat .hgsubstate
  fb36e107ea3bc98cfabecbed9f4292777533cdbf subrepos1/subrepo1
  $ cd subrepos1/subrepo1
  $ prepare_subrepo "subrepo2" "subrepos2"
  $ echo `pwd`
  $TESTTMP/repo3/subrepos1/subrepo1
  $ cat .hgsubstate
  fb36e107ea3bc98cfabecbed9f4292777533cdbf subrepos2/subrepo2
  $ cd ../..
  $ hg ci -m 'Include the nested subrepo'
  $ cat .hgsubstate
  ea2a4310dad4d276467e2c342f8bc54d4e6a74a7 subrepos1/subrepo1

  $ hg kwprint -S
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 5 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: hg+https://hg/repo.hg $
  $HGrepoid: 32ee1d210af8d5434587ac0b0494e90d69bbfce8 $
  $HGrevision: 959ffd1bae463906774177568fdf853416cb5ca2 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 32ee1d210af8 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: 959ffd1bae46 $
  $State: draft $
  ^$ (re)
  $File: test.file $
  $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 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)
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 4 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: file:///subrepo1 $
  $HGrepoid: 934bf0defe66f2b1b5d46777f115e53f34a96016 $
  $HGrevision: ea2a4310dad4d276467e2c342f8bc54d4e6a74a7 $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 934bf0defe66 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: ea2a4310dad4 $
  $State: draft $
  ^$ (re)
  $File: test-s.file $
  $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 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)
  $Author: first.second $
  $Date: 1970-01-01 00:00:00 +0000 $
  $HGbookmarks:  $
  $HGbranch: default $
  $HGlatesttagdate: 1970-01-01 00:00:00 +0000 $
  $HGlatesttagdistance: 3 $
  $HGlatesttagjustdate: 1970-01-01 $
  $HGlatesttags: null $
  $HGpath: file:///subrepo2 $
  $HGrepoid: 934bf0defe66f2b1b5d46777f115e53f34a96016 $
  $HGrevision: fb36e107ea3bc98cfabecbed9f4292777533cdbf $
  $HGshortdate: 1970-01-01 $
  $HGshortrepoid: 934bf0defe66 $
  $HGtags:  $
  $JustDate: 1970-01-01 $
  $Revision: fb36e107ea3b $
  $State: draft $
  ^$ (re)
  $File: test-s.file $
  $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 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
  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 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: 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
  ea2a4310dad4d276467e2c342f8bc54d4e6a74a7
  $ cat _archive/subrepos1/subrepo1/test2.txt
  test2.txt: This is a file with some replacement tests
  ^$ (re)
  $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: 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
  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 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: fb36e107ea3bc98cfabecbed9f4292777533cdbf $
  $Revision: fb36e107ea3b $
  $Author: First+Second+<first.second@example.com> $
  ^$ (re)
  $MySubstKeyword: This is a custom replacement $
  This is a custom replacement