changeset 827:f62ff54c893b

exchange: add test case for A.1 Testcase defined here: http://mercurial.selenic.com/wiki/ObsolescenceMarkersExchange
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 28 Feb 2014 16:21:22 -0800
parents bee5e1105e6c
children c362513b3c7e
files tests/test-exchange-A1.t
diffstat 1 files changed, 339 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-exchange-A1.t	Fri Feb 28 16:21:22 2014 -0800
@@ -0,0 +1,339 @@
+
+Initial setup
+
+  $ cat >> $HGRCPATH <<EOF
+  > [web]
+  > push_ssl = false
+  > allow_push = *
+  > [ui]
+  > logtemplate ="{node|short} ({phase}): {desc}\n"
+  > [phases]
+  > publish=False
+  > [extensions]
+  > hgext.rebase=
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
+
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "$1"
+  > }
+  $ getid() {
+  >    hg id --hidden --debug -ir "$1"
+  > }
+
+==== A.1.1 pushing a single head ====
+..
+.. {{{
+..     ⇠◔ A
+..      |
+..      ● O
+.. }}}
+..
+.. Marker exist from:
+..
+..  * A
+..
+.. Command run:
+..
+..  * hg push -r A
+..  * hg push
+..
+.. Expected exchange:
+..
+..  * chain from A
+
+Setup
+---------------
+
+initial
+
+  $ mkdir A.1.1
+  $ cd A.1.1
+  $ hg init source
+  $ hg init dest
+  $ hg init other
+  $ cd source
+  $ mkcommit O
+  $ hg phase --public .
+  $ hg push -q ../dest
+  $ hg push -q ../other
+  $ mkcommit A
+  $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A)'`
+  $ hg log -G
+  @  f5bc6836db60 (draft): A
+  |
+  o  a9bdc8b26820 (public): O
+  
+  $ hg debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ cd ..
+  $ cd ..
+
+setup both variants
+
+  $ cp -r A.1.1 A.1.1.a
+  $ cp -r A.1.1 A.1.1.b
+
+
+Variante a: push -r A
+---------------------
+
+  $ cd A.1.1.a
+  $ hg -R source id -r 'desc(A)'
+  f5bc6836db60 tip
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  $ hg -R other  debugobsolete
+
+  $ hg -R source push -r 'desc(A)' dest
+  pushing to dest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
+  OBSEXC: encoding 1 markers
+  OBSEXC: sending 1 pushkey payload (78 bytes)
+  OBSEXC: DONE
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R other  debugobsolete
+
+  $ hg -R other pull -r 'f5bc6836db60' dest
+  pulling from dest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  OBSEXC: pull obsolescence markers
+  OBSEXC: merging obsolescence markers (62 bytes)
+  OBSEXC: 1 markers added
+  OBSEXC: DONE
+  (run 'hg update' to get a working copy)
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R other  debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+
+  $ cd ..
+
+Variante b: push
+---------------------
+
+  $ cd A.1.1.b
+  $ hg -R source id -r 'desc(A)'
+  f5bc6836db60 tip
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  $ hg -R other  debugobsolete
+
+  $ hg -R source push dest
+  pushing to dest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
+  OBSEXC: encoding 1 markers
+  OBSEXC: sending 1 pushkey payload (78 bytes)
+  OBSEXC: DONE
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R other  debugobsolete
+
+  $ hg -R other pull dest
+  pulling from dest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  OBSEXC: pull obsolescence markers
+  OBSEXC: merging obsolescence markers (62 bytes)
+  OBSEXC: 1 markers added
+  OBSEXC: DONE
+  (run 'hg update' to get a working copy)
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R other  debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+
+  $ cd ..
+
+
+
+==== A.1.2 pushing a multiple changeset into a single head  ====
+
+.. {{{
+..      ◔ B
+..      |
+..     ⇠◔ A
+..      |
+..      ● O
+.. }}}
+..
+.. Marker exist from:
+..
+..  * A
+..
+.. Command run:
+..
+..  * hg push -r B
+..  * hg push
+..
+.. Expected exchange:
+..
+..  * chain from A
+
+Setup
+---------------
+
+initial
+
+  $ mkdir A.1.2
+  $ cd A.1.2
+  $ hg init source
+  $ hg init dest
+  $ hg init other
+  $ cd source
+  $ mkcommit O
+  $ hg phase --public .
+  $ hg push -q ../dest
+  $ hg push -q ../other
+  $ mkcommit A
+  $ mkcommit B
+  $ hg log -G
+  @  f6fbb35d8ac9 (draft): B
+  |
+  o  f5bc6836db60 (draft): A
+  |
+  o  a9bdc8b26820 (public): O
+  
+  $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A)'`
+  $ hg debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ cd ..
+  $ cd ..
+
+setup both variants
+
+  $ cp -r A.1.2 A.1.2.a
+  $ cp -r A.1.2 A.1.2.b
+
+
+Variante a: push -r A
+---------------------
+
+  $ cd A.1.2.a
+  $ hg -R source id -r 'desc(B)'
+  f6fbb35d8ac9 tip
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  $ hg -R other  debugobsolete
+
+  $ hg -R source push -r 'desc(B)' dest
+  pushing to dest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 3 nodes
+  OBSEXC: encoding 1 markers
+  OBSEXC: sending 1 pushkey payload (78 bytes)
+  OBSEXC: DONE
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R other  debugobsolete
+
+  $ hg -R other pull -r 'f6fbb35d8ac9' dest
+  pulling from dest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  OBSEXC: pull obsolescence markers
+  OBSEXC: merging obsolescence markers (62 bytes)
+  OBSEXC: 1 markers added
+  OBSEXC: DONE
+  (run 'hg update' to get a working copy)
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R other  debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+
+  $ cd ..
+
+Variante b: push
+---------------------
+
+  $ cd A.1.2.b
+  $ hg -R source id -r 'desc(B)'
+  f6fbb35d8ac9 tip
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  $ hg -R other  debugobsolete
+
+  $ hg -R source push dest
+  pushing to dest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 3 nodes
+  OBSEXC: encoding 1 markers
+  OBSEXC: sending 1 pushkey payload (78 bytes)
+  OBSEXC: DONE
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R other  debugobsolete
+
+  $ hg -R other pull dest
+  pulling from dest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  OBSEXC: pull obsolescence markers
+  OBSEXC: merging obsolescence markers (62 bytes)
+  OBSEXC: 1 markers added
+  OBSEXC: DONE
+  (run 'hg update' to get a working copy)
+  $ hg -R source debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R dest   debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ hg -R other  debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+
+  $ cd ..