Mercurial > hg
changeset 9143:a604c98dbf62
test-tags: clarify test output; simplify test script a bit (issue548).
- use simpler way ('hg id') to get current changeset id
- add 'echo' statements to guide the eye when reading output
- add some more output to clarify the state of .hgtags
- drop '-d' option from every commit/tag, since run-tests.py
does this (although with a different timestamp, so changeset
ids differ)
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Thu, 16 Jul 2009 10:39:41 -0400 |
parents | 63cfacb7917e |
children | ad72e3b08bc0 |
files | tests/test-tags tests/test-tags.out |
diffstat | 2 files changed, 116 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-tags Wed Jul 15 17:44:47 2009 +0200 +++ b/tests/test-tags Thu Jul 16 10:39:41 2009 -0400 @@ -1,24 +1,31 @@ #!/bin/sh +echo "% setup" mkdir t cd t hg init hg id echo a > a hg add a -hg commit -m "test" -d "1000000 0" +hg commit -m "test" hg co hg identify -T=`hg tip --debug | head -n 1 | cut -d : -f 3` + +echo "% create local tag with long name" +T=`hg identify --debug --id` hg tag -l "This is a local tag with a really long name!" hg tags rm .hg/localtags + +echo "% create a tag behind hg's back" echo "$T first" > .hgtags cat .hgtags hg add .hgtags -hg commit -m "add tags" -d "1000000 0" +hg commit -m "add tags" hg tags hg identify + +echo "% create a branch" echo bb > a hg status hg identify @@ -28,89 +35,94 @@ hg status echo 1 > b hg add b -hg commit -m "branch" -d "1000000 0" +hg commit -m "branch" hg id + +echo "% merge the two heads" hg merge 1 hg id hg status -hg commit -m "merge" -d "1000000 0" +hg commit -m "merge" -# create fake head, make sure tag not visible afterwards +echo "% create fake head, make sure tag not visible afterwards" cp .hgtags tags -hg tag -d "1000000 0" last +hg tag last hg rm .hgtags -hg commit -m "remove" -d "1000000 0" +hg commit -m "remove" mv tags .hgtags hg add .hgtags -hg commit -m "readd" -d "1000000 0" +hg commit -m "readd" hg tags -# invalid tags +echo "% add invalid tags" echo "spam" >> .hgtags echo >> .hgtags echo "foo bar" >> .hgtags echo "$T invalid" | sed "s/..../a5a5/" >> .hg/localtags -hg commit -m "tags" -d "1000000 0" +echo "committing .hgtags:" +cat .hgtags +hg commit -m "tags" -# report tag parse error on other head +echo "% report tag parse error on other head" hg up 3 echo 'x y' >> .hgtags -hg commit -m "head" -d "1000000 0" +hg commit -m "head" hg tags hg tip -# test tag precedence rules +echo "% test tag precedence rules" cd .. hg init t2 cd t2 echo foo > foo hg add foo -hg ci -m 'add foo' -d '1000000 0' # rev 0 -hg tag -d '1000000 0' bar # rev 1 +hg ci -m 'add foo' # rev 0 +hg tag bar # rev 1 echo >> foo -hg ci -m 'change foo 1' -d '1000000 0' # rev 2 +hg ci -m 'change foo 1' # rev 2 hg up -C 1 -hg tag -r 1 -d '1000000 0' -f bar # rev 3 +hg tag -r 1 -f bar # rev 3 hg up -C 1 echo >> foo -hg ci -m 'change foo 2' -d '1000000 0' # rev 4 +hg ci -m 'change foo 2' # rev 4 hg tags -# test tag removal -hg tag --remove -d '1000000 0' bar -hg tip +echo "% test tag removal" +hg tag --remove bar # rev 5 +hg tip -vp hg tags echo '% remove nonexistent tag' -hg tag --remove -d '1000000 0' foobar +hg tag --remove foobar hg tip -# test tag rank +echo "% test tag rank" cd .. hg init t3 cd t3 echo foo > foo hg add foo -hg ci -m 'add foo' -d '1000000 0' # rev 0 -hg tag -d '1000000 0' -f bar # rev 1 bar -> 0 -hg tag -d '1000000 0' -f bar # rev 2 bar -> 1 -hg tag -d '1000000 0' -fr 0 bar # rev 3 bar -> 0 -hg tag -d '1000000 0' -fr 1 bar # rev 3 bar -> 1 -hg tag -d '1000000 0' -fr 0 bar # rev 4 bar -> 0 +hg ci -m 'add foo' # rev 0 +hg tag -f bar # rev 1 bar -> 0 +hg tag -f bar # rev 2 bar -> 1 +hg tag -fr 0 bar # rev 3 bar -> 0 +hg tag -fr 1 bar # rev 4 bar -> 1 +hg tag -fr 0 bar # rev 5 bar -> 0 hg tags hg co 3 echo barbar > foo -hg ci -m 'change foo' -d '1000000 0' # rev 0 +hg ci -m 'change foo' # rev 6 hg tags -hg tag -d '1000000 0' -r 3 bar # should complain +echo "% don't allow moving tag without -f" +hg tag -r 3 bar hg tags -# test tag rank with 3 heads +echo "% test tag rank with 3 heads" cd .. hg init t4 cd t4 @@ -124,10 +136,11 @@ hg tags hg up -qC 0 hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2 -echo % bar should still point to rev 2 +echo "% bar should still point to rev 2" hg tags +echo "% remove local as global and global as local" # test that removing global/local tags does not get confused when trying # to remove a tag of type X which actually only exists as a type Y cd ..
--- a/tests/test-tags.out Wed Jul 15 17:44:47 2009 +0200 +++ b/tests/test-tags.out Thu Jul 16 10:39:41 2009 -0400 @@ -1,78 +1,108 @@ +% setup 000000000000 tip 0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0acdaf898367 tip -tip 0:0acdaf898367 -This is a local tag with a really long name! 0:0acdaf898367 -0acdaf8983679e0aac16e811534eb49d7ee1f2b4 first -tip 1:8a3ca90d111d -first 0:0acdaf898367 -8a3ca90d111d tip +acb14030fe0a tip +% create local tag with long name +tip 0:acb14030fe0a +This is a local tag with a really long name! 0:acb14030fe0a +% create a tag behind hg's back +acb14030fe0a21b60322c440ad2d20cf7685a376 first +tip 1:b9154636be93 +first 0:acb14030fe0a +b9154636be93 tip +% create a branch M a -8a3ca90d111d+ tip +b9154636be93+ tip 0 files updated, 0 files merged, 1 files removed, 0 files unresolved -0acdaf898367+ first -0acdaf898367+ first +acb14030fe0a+ first +acb14030fe0a+ first M a created new head -8216907a933d tip +c8edf04160c7 tip +% merge the two heads 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) -8216907a933d+8a3ca90d111d+ tip +c8edf04160c7+b9154636be93+ tip M .hgtags -tip 6:e2174d339386 -first 0:0acdaf898367 +% create fake head, make sure tag not visible afterwards +tip 6:35ff301afafe +first 0:acb14030fe0a +% add invalid tags +committing .hgtags: +acb14030fe0a21b60322c440ad2d20cf7685a376 first +spam + +foo bar +% report tag parse error on other head 1 files updated, 0 files merged, 0 files removed, 0 files unresolved created new head -.hgtags@c071f74ab5eb, line 2: cannot parse entry -.hgtags@c071f74ab5eb, line 4: node 'foo' is not well formed -.hgtags@4ca6f1b1a68c, line 2: node 'x' is not well formed -tip 8:4ca6f1b1a68c -first 0:0acdaf898367 -changeset: 8:4ca6f1b1a68c -.hgtags@c071f74ab5eb, line 2: cannot parse entry -.hgtags@c071f74ab5eb, line 4: node 'foo' is not well formed -.hgtags@4ca6f1b1a68c, line 2: node 'x' is not well formed +.hgtags@75d9f02dfe28, line 2: cannot parse entry +.hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed +.hgtags@c4be69a18c11, line 2: node 'x' is not well formed +tip 8:c4be69a18c11 +first 0:acb14030fe0a +changeset: 8:c4be69a18c11 +.hgtags@75d9f02dfe28, line 2: cannot parse entry +.hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed +.hgtags@c4be69a18c11, line 2: node 'x' is not well formed tag: tip -parent: 3:b2ef3841386b +parent: 3:ac5e980c4dc0 user: test -date: Mon Jan 12 13:46:40 1970 +0000 +date: Thu Jan 01 00:00:00 1970 +0000 summary: head +% test tag precedence rules 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 1 files updated, 0 files merged, 0 files removed, 0 files unresolved created new head -tip 4:36195b728445 -bar 1:b204a97e6e8d -changeset: 5:1f98c77278de +tip 4:0c192d7d5e6b +bar 1:78391a272241 +% test tag removal +changeset: 5:5f6e8655b1c7 tag: tip user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: Removed tag bar +date: Thu Jan 01 00:00:00 1970 +0000 +files: .hgtags +description: +Removed tag bar + -tip 5:1f98c77278de +diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags +--- a/.hgtags Thu Jan 01 00:00:00 1970 +0000 ++++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 +@@ -1,1 +1,3 @@ + bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar ++78391a272241d70354aa14c874552cad6b51bb42 bar ++0000000000000000000000000000000000000000 bar + +tip 5:5f6e8655b1c7 % remove nonexistent tag abort: tag 'foobar' does not exist -changeset: 5:1f98c77278de +changeset: 5:5f6e8655b1c7 tag: tip user: test -date: Mon Jan 12 13:46:40 1970 +0000 +date: Thu Jan 01 00:00:00 1970 +0000 summary: Removed tag bar -tip 5:e86d7ed95fd3 -bar 0:b409d9da318e +% test tag rank +tip 5:85f05169d91d +bar 0:bbd179dfa0a7 1 files updated, 0 files merged, 0 files removed, 0 files unresolved created new head -tip 6:b744fbe1f6dd -bar 0:b409d9da318e +tip 6:735c3ca72986 +bar 0:bbd179dfa0a7 +% don't allow moving tag without -f abort: tag 'bar' already exists (use -f to force) -tip 6:b744fbe1f6dd -bar 0:b409d9da318e +tip 6:735c3ca72986 +bar 0:bbd179dfa0a7 +% test tag rank with 3 heads adding foo tip 3:197c21bbbf2c bar 2:6fa450212aeb % bar should still point to rev 2 tip 4:3b4b14ed0202 bar 2:6fa450212aeb +% remove local as global and global as local adding foo abort: tag 'localtag' is not a global tag abort: tag 'globaltag' is not a local tag