annotate tests/test-annotate @ 4359: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 2e1d8b238b6c
children 46280c004f22 c7371aa0c153
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2923
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
1 #!/bin/sh
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
2
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
3 echo % init
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
4 hg init
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
5
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
6 echo % commit
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
7 echo 'a' > a
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
8 hg ci -A -m test -u nobody -d '1 0'
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
9
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
10 echo % annotate -c
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
11 hg annotate -c a
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
12
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
13 echo % annotate -d
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
14 hg annotate -d a
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
15
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
16 echo % annotate -n
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
17 hg annotate -n a
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
18
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
19 echo % annotate -u
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
20 hg annotate -u a
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
21
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
22 echo % annotate -cdnu
cd47230a4eb9 tests: new test for "hg annotate"
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
23 hg annotate -cdnu a
3165
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
24
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
25 cat <<EOF >>a
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
26 a
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
27 a
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
28 EOF
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
29 hg ci -ma1 -d '1 0'
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
30 hg cp a b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
31 hg ci -mb -d '1 0'
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
32 cat <<EOF >> b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
33 b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
34 b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
35 b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
36 EOF
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
37 hg ci -mb2 -d '2 0'
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
38
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
39 echo % annotate b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
40 hg annotate b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
41 echo % annotate -nf b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
42 hg annotate -nf b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
43
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
44 hg up -C 2
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
45 cat <<EOF >> b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
46 b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
47 c
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
48 b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
49 EOF
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
50 hg ci -mb2.1 -d '2 0'
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
51 hg merge
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
52 hg ci -mmergeb -d '3 0'
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
53 echo % annotate after merge
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
54 hg annotate -nf b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
55
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
56 hg up -C 1
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
57 hg cp a b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
58 cat <<EOF > b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
59 a
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
60 z
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
61 a
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
62 EOF
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
63 hg ci -mc -d '3 0'
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
64 hg merge
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
65 cat <<EOF >> b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
66 b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
67 c
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
68 b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
69 EOF
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
70 echo d >> b
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
71 hg ci -mmerge2 -d '4 0'
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
72 echo % annotate after rename merge
5c93dd0ae413 Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents: 2925
diff changeset
73 hg annotate -nf b
3404
2e1d8b238b6c Test annotate using named rev instead of linkrev
Brendan Cully <brendan@kublai.com>
parents: 3195
diff changeset
74
2e1d8b238b6c Test annotate using named rev instead of linkrev
Brendan Cully <brendan@kublai.com>
parents: 3195
diff changeset
75 echo % linkrev vs rev
2e1d8b238b6c Test annotate using named rev instead of linkrev
Brendan Cully <brendan@kublai.com>
parents: 3195
diff changeset
76 hg annotate -r tip a