Mercurial > hg
view tests/test-tags @ 4363:2e3c54fb79a3
actually port simplemerge to hg
- use bdiff instead of patiencediff; this is a larger change, since
bdiff works on 2 multi-line strings, while patiencediff works on 2
lists;
- rename the main class from Merge3 to Merge3Text and add a Merge3
class that derives from Merge3Text. This new Merge3 class has
the same interface from the original class, so that the tests
still work;
- Merge3 uses util.binary to detect binary data and raises
util.Abort instead of a specific exception;
- don't use the @decorator syntax, to keep python2.3 compatibility;
- the test uses unittest, which likes to print how long it took to
run. This obviously doesn't play too well with hg's test suite,
so we override time.time to fool unittest;
- one test has a different (but still valid) output because of the
different diff algorithm used;
- the TestCase class used by bzr has some extras to help debugging.
test-merge3.py used 2 of them:
- log method to log some data
- assertEqualDiff method to ease viewing diffs of diffs
We add a dummy log method and use regular assertEquals instead of
assertEqualDiff.
- make simplemerge executable and add "#!/usr/bin/env python" header
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 16 Apr 2007 20:17:39 -0300 |
parents | 8185a1ca8628 |
children | 99f411ba0380 |
line wrap: on
line source
#!/bin/sh mkdir t cd t hg init hg id echo a > a hg add a hg commit -m "test" -d "1000000 0" hg co hg identify T=`hg tip --debug | head -n 1 | cut -d : -f 3` hg tag -l "This is a local tag with a really long name!" hg tags rm .hg/localtags echo "$T first" > .hgtags cat .hgtags hg add .hgtags hg commit -m "add tags" -d "1000000 0" hg tags hg identify echo bb > a hg status hg identify hg co first hg id hg -v id hg status echo 1 > b hg add b hg commit -m "branch" -d "1000000 0" hg id hg merge 1 hg id hg status hg commit -m "merge" -d "1000000 0" # create fake head, make sure tag not visible afterwards cp .hgtags tags hg tag -d "1000000 0" last hg rm .hgtags hg commit -m "remove" -d "1000000 0" mv tags .hgtags hg add .hgtags hg commit -m "readd" -d "1000000 0" hg tags # 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" # report tag parse error on other head hg up 3 echo 'x y' >> .hgtags hg commit -m "head" -d "1000000 0" hg tags hg tip # 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 echo >> foo hg ci -m 'change foo 1' -d '1000000 0' # rev 2 hg up -C 1 hg tag -r 1 -d '1000000 0' -f bar # rev 3 hg up -C 1 echo >> foo hg ci -m 'change foo 2' -d '1000000 0' # rev 4 hg tags # test tag removal hg tag --remove -d '1000000 0' bar hg tip hg tags # 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 tags hg co 3 echo barbar > foo hg ci -m 'change foo' -d '1000000 0' # rev 0 hg tags hg tag -d '1000000 0' -r 3 bar # should complain hg tags