Patchwork [05,of,11] test-obsolete-bundle-strip: test bundling in the first case

login
register
mail settings
Submitter Pierre-Yves David
Date May 28, 2017, 4:32 p.m.
Message ID <e76908ceeb5226ae119a.1495989126@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20990/
State Accepted
Headers show

Comments

Pierre-Yves David - May 28, 2017, 4:32 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1495761113 -7200
#      Fri May 26 03:11:53 2017 +0200
# Node ID e76908ceeb5226ae119ad0a9c6544628e26d5d70
# Parent  a4da14c3c095bf4f566c655cb4a82dc3b1ccd5e9
# EXP-Topic obsstrip
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e76908ceeb52
test-obsolete-bundle-strip: test bundling in the first case

We adds a shell function checking that the relevant markers and the bundled
markers matches. Updating all cases in the file at the same time is a bit
overwhelming and harder to double checks. So each cases come in its own patch.

Patch

diff --git a/tests/test-obsolete-bundle-strip.t b/tests/test-obsolete-bundle-strip.t
--- a/tests/test-obsolete-bundle-strip.t
+++ b/tests/test-obsolete-bundle-strip.t
@@ -2,12 +2,8 @@ 
 Test obsmarkers interaction with bundle and strip
 ==================================================
 
-In practice, this file does not yet contains any tests for bundle and strip.
-But their will be some soon (tm).
-
-For now this test check the logic computing markers relevant to a set of
-revision. That logic will be use by "hg bundle" to select the markers to
-include, and strip to find the markers to backup.
+The file currently only contains test for bundle.
+Testing of strip will happen some time soon (tm).
 
 Setup a repository with various case
 ====================================
@@ -53,6 +49,32 @@  Config setup
   >     mkcommit ROOT
   > }
 
+Function to compare the expected bundled obsmarkers with the actually bundled
+obsmarkers.
+
+  $ testrevs () {
+  >     revs="$1"
+  >     testname=`basename \`pwd\``
+  >     revsname=`hg --hidden log -T '-{desc}\n' --rev "${revs}"`
+  >     prefix="${TESTTMP}/${testname}${revsname}"
+  >     markersfile="${prefix}-relevant-markers.txt"
+  >     bundlefile="${prefix}-bundle.hg"
+  >     contentfile="${prefix}-bundle-markers.hg"
+  >     hg debugobsolete --hidden --rev "${revs}" | sed 's/^/    /' > "${markersfile}"
+  >     echo '### Matched revisions###'
+  >     hg log --hidden --rev "${revs}" | sort
+  >     echo '### Relevant markers ###'
+  >     cat "${markersfile}"
+  >     printf "# bundling: "
+  >     hg bundle --hidden --base "parents(roots(${revs}))" --rev "${revs}" "${bundlefile}"
+  >     hg debugbundle "${bundlefile}" | grep "obsmarkers --" -A 100 | sed 1,2d > "${contentfile}"
+  >     echo '### Bundled markers ###'
+  >     cat "${contentfile}"
+  >     echo '### diff <relevant> <bundled> ###'
+  >     cmp "${markersfile}" "${contentfile}" || diff -u "${markersfile}" "${contentfile}"
+  >     echo '#################################'
+  > }
+
 root setup
 -------------
 
@@ -94,12 +116,47 @@  setup
 Actual testing
 --------------
 
-  $ hg debugobsolete --rev 'desc("C-A0")'
-  a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  $ hg debugobsolete --rev 'desc("C-A1")'
-  84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
-  a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  $ testrevs 'desc("C-A0")'
+  ### Matched revisions###
+  84fcb0dfe17b: C-A0
+  ### Relevant markers ###
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  # bundling: 1 changesets found
+  ### Bundled markers ###
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <relevant> <bundled> ###
+  #################################
+
+  $ testrevs 'desc("C-A1")'
+  ### Matched revisions###
+  cf2c22470d67: C-A1
+  ### Relevant markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  # bundling: 1 changesets found
+  ### Bundled markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <relevant> <bundled> ###
+  #################################
+
+  $ testrevs 'desc("C-A")'
+  ### Matched revisions###
+  84fcb0dfe17b: C-A0
+  cf2c22470d67: C-A1
+  ### Relevant markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  # bundling: 2 changesets found
+  ### Bundled markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <relevant> <bundled> ###
+  #################################
 
 chain with prune children
 =========================