Mercurial > evolve
view tests/test-obsolete.t @ 98:8ad5c760c708
[states] make enabling state saftier
* Fix the lower state heads while enabling a state.
* Add a --clever opiton that do not fix the lower heads (as earlier)
* Add test for enable/disable state
author | Alain Leufroy <alain.leufroy@logilab.fr> |
---|---|
date | Sun, 25 Sep 2011 12:46:45 +0200 |
parents | 5d029a358252 |
children | eae9be0ee00e |
line wrap: on
line source
$ cat >> $HGRCPATH <<EOF > [web] > push_ssl = false > allow_push = * > [extensions] > EOF $ echo "states=$(echo $(dirname $TESTDIR))/hgext/states.py" >> $HGRCPATH $ echo "obsolete=$(echo $(dirname $TESTDIR))/hgext/obsolete.py" >> $HGRCPATH $ mkcommit() { > echo "$1" > "$1" > hg add "$1" > hg ci -m "add $1" > } $ alias qlog="hg log --template='{rev}\n- {node|short}\n'" $ hg init local $ cd local $ hg states ready # XXX should be put in default config when state support it $ mkcommit a # 0 $ hg published 0 $ mkcommit b # 1 $ mkcommit c # 2 $ hg up 1 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ mkcommit obsol_c # 3 created new head $ hg debugobsolete 3 2 Test that obsolete changeset are hidden $ qlog 3 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 $ qlog --hidden 3 - 0d3f46688ccc 2 - 4538525df7e2 1 - 7c3bad9141dc 0 - 1f0dee641bb7 $ qlog -r 'obsolete()' --hidden 2 - 4538525df7e2 test obsolete changeset with no-obsolete descendant $ hg up 1 -q $ mkcommit "obsol_c'" # 4 (on 1) created new head $ hg debugobsolete 4 3 $ qlog 4 - 725c380fe99b 1 - 7c3bad9141dc 0 - 1f0dee641bb7 $ qlog -r 'obsolete()' --hidden 2 - 4538525df7e2 3 - 0d3f46688ccc $ hg up 3 -q Working directory parent is obsolete $ mkcommit d # 5 (on 3) $ qlog -r 'obsolete()' 3 - 0d3f46688ccc Test communication of obsolete relation with a compatible client $ hg init ../other-new $ hg -R ../other-new states ready # XXX should be put in default config when state support it $ hg push --traceback ../other-new pushing to ../other-new searching for changes adding changesets adding manifests adding file changes added 5 changesets with 5 changes to 5 files (+1 heads) $ qlog -R ../other-new -r 'obsolete()' 2 - 0d3f46688ccc $ qlog -R ../other-new 4 - a7a6f2b5d8a5 3 - 725c380fe99b 2 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 $ hg up 3 -q Working directory parent is obsolete $ mkcommit obsol_d # 6 created new head $ hg debugobsolete 6 5 $ qlog 6 - 95de7fc6918d 4 - 725c380fe99b 3 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 $ qlog -r 'obsolete()' 3 - 0d3f46688ccc $ hg push ../other-new -f # XXX should not have to use -f pushing to ../other-new searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) $ qlog -R ../other-new 5 - 95de7fc6918d 3 - 725c380fe99b 2 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 $ qlog -R ../other-new -r 'obsolete()' 2 - 0d3f46688ccc $ hg up -q .^ # 3 Working directory parent is obsolete $ mkcommit "obsol_d'" # 7 created new head $ hg debugobsolete 7 6 $ hg pull -R ../other-new . pulling from . searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 2 files (+2 heads) (run 'hg heads .' to see heads, 'hg merge' to merge) $ qlog -R ../other-new 7 - 909a0fb57e5d 3 - 725c380fe99b 2 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 pushing to stuff that doesn't support obsolete $ hg init ../other-old > # XXX I don't like this but changeset get published otherwise > # remove it when we will get a --keep-state flag for push $ hg -R ../other-old states ready $ echo '[extensions]' > ../other-old/.hg/hgrc $ echo "obsolete=!$(echo $(dirname $TESTDIR))/obsolete.py" >> ../other-old/.hg/hgrc $ hg push ../other-old pushing to ../other-old searching for changes adding changesets adding manifests adding file changes added 5 changesets with 5 changes to 5 files (+1 heads) $ qlog -R ../other-old 4 - 909a0fb57e5d 3 - 725c380fe99b 2 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 clone support $ hg clone . ../cloned > # The warning should go away once we have default value to set ready before we pull requesting all changes adding changesets adding manifests adding file changes added 8 changesets with 8 changes to 8 files (+4 heads) 909a0fb57e5d try to obsolete immutable changeset 95de7fc6918d 95de7fc6918d try to obsolete immutable changeset a7a6f2b5d8a5 725c380fe99b try to obsolete immutable changeset 0d3f46688ccc 0d3f46688ccc try to obsolete immutable changeset 4538525df7e2 updating to branch default 4 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg -R ../cloned states --clever ready # XXX should be put in default config when state support it $ qlog -R ../cloned 7 - 909a0fb57e5d 4 - 725c380fe99b 3 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 Test rollback support $ hg up .^ -q # 3 Working directory parent is obsolete $ mkcommit "obsol_d''" created new head $ hg debugobsolete 8 7 $ hg -R ../other-new pull . pulling from . searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads .' to see heads, 'hg merge' to merge) $ qlog -R ../other-new 8 - 159dfc9fa5d3 3 - 725c380fe99b 2 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 $ hg -R ../other-new rollback repository tip rolled back to revision 7 (undo pull) working directory now based on revision -1 $ qlog -R ../other-new 7 - 909a0fb57e5d 3 - 725c380fe99b 2 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 obsolete published changeset $ hg up null 0 files updated, 0 files merged, 4 files removed, 0 files unresolved $ mkcommit toto # 9 created new head $ hg id -n 9 $ hg debugobsolete 9 0 83b5778897ad try to obsolete immutable changeset 1f0dee641bb7 $ qlog -r 'obsolete()' 3 - 0d3f46688ccc allow to just kill changeset $ qlog 9 - 83b5778897ad 8 - 159dfc9fa5d3 4 - 725c380fe99b 3 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7 $ hg debugobsolete null 9 $ hg up null -q # to be not based on 9 anymore $ qlog 8 - 159dfc9fa5d3 4 - 725c380fe99b 3 - 0d3f46688ccc 1 - 7c3bad9141dc 0 - 1f0dee641bb7