##// END OF EJS Templates
tests: unify test-filebranch
Adrian Buehlmann -
r12192:968e9057 default
parent child Browse files
Show More
@@ -1,79 +1,147 b''
1 #!/bin/sh
1 This test makes sure that we don't mark a file as merged with its ancestor
2 when we do a merge.
2
3
3 # This test makes sure that we don't mark a file as merged with its ancestor
4 $ cat <<EOF > merge
4 # when we do a merge.
5 > import sys, os
6 > print "merging for", os.path.basename(sys.argv[1])
7 > EOF
8 $ HGMERGE="python ../merge"; export HGMERGE
9
10 Creating base:
5
11
6 cat <<EOF > merge
12 $ hg init a
7 import sys, os
13 $ cd a
8 print "merging for", os.path.basename(sys.argv[1])
14 $ echo 1 > foo
9 EOF
15 $ echo 1 > bar
10 HGMERGE="python ../merge"; export HGMERGE
16 $ echo 1 > baz
17 $ echo 1 > quux
18 $ hg add foo bar baz quux
19 $ hg commit -m "base"
20
21 $ cd ..
22 $ hg clone a b
23 updating to branch default
24 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
25
26 Creating branch a:
27
28 $ cd a
29 $ echo 2a > foo
30 $ echo 2a > bar
31 $ hg commit -m "branch a"
32
33 Creating branch b:
11
34
12 echo creating base
35 $ cd ..
13 hg init a
36 $ cd b
14 cd a
37 $ echo 2b > foo
15 echo 1 > foo
38 $ echo 2b > baz
16 echo 1 > bar
39 $ hg commit -m "branch b"
17 echo 1 > baz
18 echo 1 > quux
19 hg add foo bar baz quux
20 hg commit -m "base"
21
40
22 cd ..
41 We shouldn't have anything but n state here:
23 hg clone a b
42
43 $ hg debugstate --nodates | grep -v "^n"
44
45 Merging:
24
46
25 echo creating branch a
47 $ hg pull ../a
26 cd a
48 pulling from ../a
27 echo 2a > foo
49 searching for changes
28 echo 2a > bar
50 adding changesets
29 hg commit -m "branch a"
51 adding manifests
52 adding file changes
53 added 1 changesets with 2 changes to 2 files (+1 heads)
54 (run 'hg heads' to see heads, 'hg merge' to merge)
30
55
31 echo creating branch b
56 $ hg merge -v
57 merging for foo
58 resolving manifests
59 getting bar
60 merging foo
61 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
62 (branch merge, don't forget to commit)
32
63
33 cd ..
64 $ echo 2m > foo
34 cd b
65 $ echo 2b > baz
35 echo 2b > foo
66 $ echo new > quux
36 echo 2b > baz
67
37 hg commit -m "branch b"
68 We shouldn't have anything but foo in merge state here:
69
70 $ hg debugstate --nodates | grep "^m"
71 m 644 3 foo
72
73 $ hg ci -m "merge"
38
74
39 echo "we shouldn't have anything but n state here"
75 main: we should have a merge here:
40 hg debugstate --nodates | grep -v "^n"
41
76
42 echo merging
77 $ hg debugindex .hg/store/00changelog.i
43 hg pull ../a
78 rev offset length base linkrev nodeid p1 p2
44 hg merge -v
79 0 0 73 0 0 cdca01651b96 000000000000 000000000000
80 1 73 68 1 1 f6718a9cb7f3 cdca01651b96 000000000000
81 2 141 68 2 2 bdd988058d16 cdca01651b96 000000000000
82 3 209 66 3 3 d8a521142a3c f6718a9cb7f3 bdd988058d16
83
84 log should show foo and quux changed:
45
85
46 echo 2m > foo
86 $ hg log -v -r tip
47 echo 2b > baz
87 changeset: 3:d8a521142a3c
48 echo new > quux
88 tag: tip
89 parent: 1:f6718a9cb7f3
90 parent: 2:bdd988058d16
91 user: test
92 date: Thu Jan 01 00:00:00 1970 +0000
93 files: foo quux
94 description:
95 merge
96
97
49
98
50 echo "we shouldn't have anything but foo in merge state here"
99 foo: we should have a merge here:
51 hg debugstate --nodates | grep "^m"
52
100
53 hg ci -m "merge"
101 $ hg debugindex .hg/store/data/foo.i
102 rev offset length base linkrev nodeid p1 p2
103 0 0 3 0 0 b8e02f643373 000000000000 000000000000
104 1 3 4 1 1 2ffeddde1b65 b8e02f643373 000000000000
105 2 7 4 2 2 33d1fb69067a b8e02f643373 000000000000
106 3 11 4 3 3 aa27919ee430 2ffeddde1b65 33d1fb69067a
54
107
55 echo "main: we should have a merge here"
108 bar: we should not have a merge here:
56 hg debugindex .hg/store/00changelog.i
57
109
58 echo "log should show foo and quux changed"
110 $ hg debugindex .hg/store/data/bar.i
59 hg log -v -r tip
111 rev offset length base linkrev nodeid p1 p2
112 0 0 3 0 0 b8e02f643373 000000000000 000000000000
113 1 3 4 1 2 33d1fb69067a b8e02f643373 000000000000
114
115 baz: we should not have a merge here:
60
116
61 echo "foo: we should have a merge here"
117 $ hg debugindex .hg/store/data/baz.i
62 hg debugindex .hg/store/data/foo.i
118 rev offset length base linkrev nodeid p1 p2
119 0 0 3 0 0 b8e02f643373 000000000000 000000000000
120 1 3 4 1 1 2ffeddde1b65 b8e02f643373 000000000000
63
121
64 echo "bar: we shouldn't have a merge here"
122 quux: we should not have a merge here:
65 hg debugindex .hg/store/data/bar.i
123
124 $ hg debugindex .hg/store/data/quux.i
125 rev offset length base linkrev nodeid p1 p2
126 0 0 3 0 0 b8e02f643373 000000000000 000000000000
127 1 3 5 1 3 6128c0f33108 b8e02f643373 000000000000
66
128
67 echo "baz: we shouldn't have a merge here"
129 Manifest entries should match tips of all files:
68 hg debugindex .hg/store/data/baz.i
69
130
70 echo "quux: we shouldn't have a merge here"
131 $ hg manifest --debug
71 hg debugindex .hg/store/data/quux.i
132 33d1fb69067a0139622a3fa3b7ba1cdb1367972e 644 bar
133 2ffeddde1b65b4827f6746174a145474129fa2ce 644 baz
134 aa27919ee4303cfd575e1fb932dd64d75aa08be4 644 foo
135 6128c0f33108e8cfbb4e0824d13ae48b466d7280 644 quux
136
137 Everything should be clean now:
72
138
73 echo "manifest entries should match tips of all files"
139 $ hg status
74 hg manifest --debug
75
140
76 echo "everything should be clean now"
141 $ hg verify
77 hg status
142 checking changesets
143 checking manifests
144 crosschecking files in changesets and manifests
145 checking files
146 4 files, 4 changesets, 10 total revisions
78
147
79 hg verify
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now