[PATCH 1 of 5] test: add a test file for relevant obsmarkers and its usage

Martin von Zweigbergk martinvonz at google.com
Tue May 30 02:39:23 EDT 2017


On Fri, May 26, 2017 at 3:35 AM, Pierre-Yves David
<pierre-yves.david at ens-lyon.org> wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at octobus.net>
> # Date 1495733827 -7200
> #      Thu May 25 19:37:07 2017 +0200
> # Node ID 787fc44da84c7dff4e14b0fca9c247d74bc92ec4
> # Parent  fe4d931431ab849db7814d162817ee9db7d4c84f
> # 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 787fc44da84c
> test: add a test file for relevant obsmarkers and its usage
>
> The logic around obsmarkers "relevant" to a set of revs have a couple of test
> around in other places but no systematic testing. In addition, all the current
> testing focus on the exchange case (we looks at relevant markers for
> '::heads').
>
> For bundles, we'll need something a bit different. We'll no longer have set of
> revision going down to the repository roots. So we'll have to test these cases
> too. In addition, stripping obsmarkers will introduce new logic around
> obsmarkers that will need testing too. So a new test file make sense here.
>
> We start with a simple tests, more advanced cases are coming in the next
> changesets. The extra testing catch a minor bug (later in the series).
>
> diff --git a/tests/test-obsolete-bundle-strip.t b/tests/test-obsolete-bundle-strip.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-obsolete-bundle-strip.t
> @@ -0,0 +1,102 @@
> +==================================================
> +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.
> +
> +Setup a repository with various case
> +====================================
> +
> +Config setup
> +------------
> +
> +  $ cat >> $HGRCPATH <<EOF
> +  > [ui]
> +  > # simpler log output
> +  > logtemplate = "{node|short}: {desc}\n"
> +  >
> +  > [experimental]
> +  > # enable evolution
> +  > evolution = all
> +  >
> +  > # include obsmarkers in bundle
> +  > evolution.bundle-obsmarker = yes
> +  >
> +  > [extensions]
> +  > # needed for some tests
> +  > strip =
> +  > [defaults]
> +  > # we'll query many hidden changeset
> +  > debugobsolete = --hidden
> +  > EOF
> +
> +  $ mkcommit() {
> +  >    echo "$1" > "$1"
> +  >    hg add "$1"
> +  >    hg ci -m "$1"
> +  > }
> +
> +  $ getid() {
> +  >    hg log --hidden --template '{node}\n' --rev "$1"
> +  > }
> +
> +  $ mktestrepo () {
> +  >     [ -n "$1" ] || exit 1
> +  >     cd $TESTTMP
> +  >     hg init $1
> +  >     cd $1
> +  >     mkcommit ROOT
> +  > }
> +
> +root setup
> +-------------
> +
> +simple chain
> +============
> +
> +.    A0
> +.   ⇠ø⇠◔ A1
> +.    |/
> +.    ●

Why are these graphs drawn mirrored compared the the "hg log -G"
output? Don't mirrored versions of the arrows exist in unicode?

> +
> +setup
> +-----
> +
> +  $ mktestrepo simple-chain
> +  $ mkcommit 'C-A0'
> +  $ hg up 'desc("ROOT")'
> +  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
> +  $ mkcommit 'C-A1'
> +  created new head
> +  $ hg debugobsolete a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 `getid 'desc("C-A0")'`
> +  $ hg debugobsolete `getid 'desc("C-A0")'` a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1
> +  $ hg debugobsolete a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 `getid 'desc("C-A1")'`
> +
> +  $ hg up 'desc("ROOT")'
> +  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
> +  $ hg log --hidden -G
> +  o  cf2c22470d67: C-A1
> +  |
> +  | x  84fcb0dfe17b: C-A0
> +  |/
> +  @  ea207398892e: ROOT
> +
> +  $ hg debugobsolete
> +  a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
> +  84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
> +  a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
> +
> +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'}
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list