diff tests/test-kwarchive.t @ 250:9a3dacfc3be6

Mercurial unit-tests for the "kwarchive" extension
author Franz Glasner <hg@dom66.de>
date Sun, 06 Jan 2019 18:23:12 +0100
parents
children 0080dab59fac
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-kwarchive.t	Sun Jan 06 18:23:12 2019 +0100
@@ -0,0 +1,271 @@
+
+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 $
+  $HGpath: file://$TESTTMP/repo1 $
+  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGshortdate: 1970-01-01 $
+  $HGtags:  $
+  $JustDate: 1970-01-01 $
+  $Revision: 8c27876b7952 $
+  $State: draft $
+   (?)
+  $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 $
+  $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 $
+  $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 $
+  $HGpath: file://$TESTTMP/repo1 $
+  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGshortdate: 1970-01-01 $
+  $HGtags:  $
+  $JustDate: 1970-01-01 $
+  $Revision: 8c27876b7952 $
+  $State: draft $
+   (?)
+  $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 $
+  $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 $
+  $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 $
+  $HGpath: .../repo1 $
+  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGshortdate: 1970-01-01 $
+  $HGtags:  $
+  $JustDate: 1970-01-01 $
+  $Revision: 8c27876b7952 $
+  $State: draft $
+   (?)
+  $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 $
+  $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 $
+  $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 $
+  $HGpath: file://$TESTTMP/repo1 $
+  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGshortdate: 1970-01-01 $
+  $HGtags:  $
+  $JustDate: 1970-01-01 $
+  $Revision: 8c27876b7952 $
+  $State: draft $
+   (?)
+  $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 $
+  $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 $
+  $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 $
+  $HGpath: hg+https://hg/repo.hg $
+  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGshortdate: 1970-01-01 $
+  $HGtags:  $
+  $JustDate: 1970-01-01 $
+  $Revision: 8c27876b7952 $
+  $State: draft $
+   (?)
+  $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 $
+  $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 $
+  $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 $
+  $HGpath: https://theuser:thepass@hg.example.com:4443/repo.hg $
+  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGshortdate: 1970-01-01 $
+  $HGtags:  $
+  $JustDate: 1970-01-01 $
+  $Revision: 8c27876b7952 $
+  $State: draft $
+   (?)
+  $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 $
+  $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 $
+  $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 $
+  $HGpath: https://theuser:***@hg.example.com:4443/repo.hg $
+  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGshortdate: 1970-01-01 $
+  $HGtags:  $
+  $JustDate: 1970-01-01 $
+  $Revision: 8c27876b7952 $
+  $State: draft $
+   (?)
+  $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 $
+  $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 $
+  $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 $
+  $HGpath: https://hg.example.com:4443/repo.hg $
+  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGshortdate: 1970-01-01 $
+  $HGtags:  $
+  $JustDate: 1970-01-01 $
+  $Revision: 8c27876b7952 $
+  $State: draft $
+   (?)
+  $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 $
+  $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 $
+  $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 $
+  $HGpath: .../repo.hg $
+  $HGrevision: 8c27876b79524a660c64a133b3d72361cdc947e4 $
+  $HGshortdate: 1970-01-01 $
+  $HGtags:  $
+  $JustDate: 1970-01-01 $
+  $Revision: 8c27876b7952 $
+  $State: draft $
+   (?)
+  $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 $
+  $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 $
+  $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
+  8c27876b79524a660c64a133b3d72361cdc947e4
+  $ 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 8c27876b79524a660c64a133b3d72361cdc947e4 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 $
+  # $HGnodeid: d1aadfd82662afe0cb942b8ff3bc39112c5bb2cd $
+  #
+  __revision__ = "$Revision: 8c27876b7952 $"
+  __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 $
+  # $HGnodeid: 8cee1e6f9d9a53eb720ab3b1dddd025db992bc76 $
+  #
+  __revision__ = "$Revision: 8c27876b7952 $"
+  __author__ = "Franz Glasner"
+   (?)