comparison tests/test-treemanifest.t @ 25091:b5052fc73300

treemanifest: store submanifest revlog per directory With this change, when tree manifests are enabled (in .hg/requires), commits will be written with one manifest revlog per directory. The manifest revlogs are stored in .hg/store/meta/$dir/00manifest.[id]. Flat manifests can still be read and interacted with as usual (they are also read into treemanifest instances). The functionality for writing treemanifest as a flat manifest to disk is still left in the code; tests still pass with '_treeinmem=True' hardcoded. Exchange is not yet implemented.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 13 Apr 2015 23:21:02 -0700
parents
children 49c583ca48c4
comparison
equal deleted inserted replaced
25090:252412e24551 25091:b5052fc73300
1
2 Set up repo
3
4 $ hg --config experimental.treemanifest=True init repo
5 $ cd repo
6
7 Requirements get set on init
8
9 $ grep treemanifest .hg/requires
10 treemanifest
11
12 Without directories, looks like any other repo
13
14 $ echo 0 > a
15 $ echo 0 > b
16 $ hg ci -Aqm initial
17 $ hg debugdata -m 0
18 a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
19 b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
20
21 Submanifest is stored in separate revlog
22
23 $ mkdir dir1
24 $ echo 1 > dir1/a
25 $ echo 1 > dir1/b
26 $ echo 1 > e
27 $ hg ci -Aqm 'add dir1'
28 $ hg debugdata -m 1
29 a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
30 b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
31 dir1\x008b3ffd73f901e83304c83d33132c8e774ceac44ed (esc)
32 e\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
33 $ hg debugdata .hg/store/meta/dir1/00manifest.i 0
34 a\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
35 b\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
36
37 Can add nested directories
38
39 $ mkdir dir1/dir1
40 $ echo 2 > dir1/dir1/a
41 $ echo 2 > dir1/dir1/b
42 $ mkdir dir1/dir2
43 $ echo 2 > dir1/dir2/a
44 $ echo 2 > dir1/dir2/b
45 $ hg ci -Aqm 'add dir1/dir1'
46 $ hg files -r .
47 a
48 b
49 dir1/a
50 dir1/b
51 dir1/dir1/a
52 dir1/dir1/b
53 dir1/dir2/a
54 dir1/dir2/b
55 e
56
57 Revision is not created for unchanged directory
58
59 $ mkdir dir2
60 $ echo 3 > dir2/a
61 $ hg add dir2
62 adding dir2/a
63 $ hg debugindex .hg/store/meta/dir1/00manifest.i > before
64 $ hg ci -qm 'add dir2'
65 $ hg debugindex .hg/store/meta/dir1/00manifest.i > after
66 $ diff before after
67 $ rm before after
68
69 Removing directory does not create an revlog entry
70
71 $ hg rm dir1/dir1
72 removing dir1/dir1/a
73 removing dir1/dir1/b
74 $ hg debugindex .hg/store/meta/dir1/dir1/00manifest.i > before
75 $ hg ci -qm 'remove dir1/dir1'
76 $ hg debugindex .hg/store/meta/dir1/dir1/00manifest.i > after
77 $ diff before after
78 $ rm before after
79
80 Check that hg files (calls treemanifest.walk()) works
81
82 $ hg co 'desc("add dir2")'
83 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 $ hg files -r . dir1
85 dir1/a
86 dir1/b
87 dir1/dir1/a
88 dir1/dir1/b
89 dir1/dir2/a
90 dir1/dir2/b
91
92 Check that status between revisions works (calls treemanifest.matches())
93
94 $ hg status --rev 'desc("add dir1")' --rev . dir1
95 A dir1/dir1/a
96 A dir1/dir1/b
97 A dir1/dir2/a
98 A dir1/dir2/b
99
100 Merge creates 2-parent revision of directory revlog
101
102 $ echo 5 > dir1/a
103 $ hg ci -Aqm 'modify dir1/a'
104 $ hg co '.^'
105 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 $ echo 6 > dir1/b
107 $ hg ci -Aqm 'modify dir1/b'
108 $ hg merge 'desc("modify dir1/a")'
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 (branch merge, don't forget to commit)
111 $ hg ci -m 'conflict-free merge involving dir1/'
112 $ cat dir1/a
113 5
114 $ cat dir1/b
115 6
116 $ hg debugindex .hg/store/meta/dir1/00manifest.i
117 rev offset length base linkrev nodeid p1 p2
118 0 0 54 0 1 8b3ffd73f901 000000000000 000000000000
119 1 54 68 0 2 b66d046c644f 8b3ffd73f901 000000000000
120 2 122 12 0 4 b87265673c8a b66d046c644f 000000000000
121 3 134 95 0 5 aa5d3adcec72 b66d046c644f 000000000000
122 4 229 81 0 6 e29b066b91ad b66d046c644f 000000000000
123 5 310 107 5 7 a120ce2b83f5 e29b066b91ad aa5d3adcec72
124
125 Merge keeping directory from parent 1 does not create revlog entry. (Note that
126 dir1's manifest does change, but only because dir1/a's filelog changes.)
127
128 $ hg co 'desc("add dir2")'
129 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
130 $ echo 8 > dir2/a
131 $ hg ci -m 'modify dir2/a'
132 created new head
133
134 $ hg debugindex .hg/store/meta/dir2/00manifest.i > before
135 $ hg merge 'desc("modify dir1/a")'
136 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 (branch merge, don't forget to commit)
138 $ hg revert -r 'desc("modify dir2/a")' .
139 reverting dir1/a (glob)
140 $ hg ci -m 'merge, keeping parent 1'
141 $ hg debugindex .hg/store/meta/dir2/00manifest.i > after
142 $ diff before after
143 $ rm before after
144
145 Merge keeping directory from parent 2 does not create revlog entry. (Note that
146 dir2's manifest does change, but only because dir2/a's filelog changes.)
147
148 $ hg co 'desc("modify dir2/a")'
149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 $ hg debugindex .hg/store/meta/dir1/00manifest.i > before
151 $ hg merge 'desc("modify dir1/a")'
152 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
153 (branch merge, don't forget to commit)
154 $ hg revert -r 'desc("modify dir1/a")' .
155 reverting dir2/a (glob)
156 $ hg ci -m 'merge, keeping parent 2'
157 created new head
158 $ hg debugindex .hg/store/meta/dir1/00manifest.i > after
159 $ diff before after
160 $ rm before after
161
162 Create flat source repo for tests with mixed flat/tree manifests
163
164 $ cd ..
165 $ hg init repo-flat
166 $ cd repo-flat
167
168 Create a few commits with flat manifest
169
170 $ echo 0 > a
171 $ echo 0 > b
172 $ echo 0 > e
173 $ for d in dir1 dir1/dir1 dir1/dir2 dir2
174 > do
175 > mkdir $d
176 > echo 0 > $d/a
177 > echo 0 > $d/b
178 > done
179 $ hg ci -Aqm initial
180
181 $ echo 1 > a
182 $ echo 1 > dir1/a
183 $ echo 1 > dir1/dir1/a
184 $ hg ci -Aqm 'modify on branch 1'
185
186 $ hg co 0
187 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
188 $ echo 2 > b
189 $ echo 2 > dir1/b
190 $ echo 2 > dir1/dir1/b
191 $ hg ci -Aqm 'modify on branch 2'
192
193 $ hg merge 1
194 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
195 (branch merge, don't forget to commit)
196 $ hg ci -m 'merge of flat manifests to new flat manifest'
197
198 Create clone with tree manifests enabled
199
200 $ cd ..
201 $ hg clone --pull --config experimental.treemanifest=1 repo-flat repo-mixed
202 requesting all changes
203 adding changesets
204 adding manifests
205 adding file changes
206 added 4 changesets with 17 changes to 11 files
207 updating to branch default
208 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
209 $ cd repo-mixed
210 $ test -f .hg/store/meta
211 [1]
212 $ grep treemanifest .hg/requires
213 treemanifest
214
215 Commit should store revlog per directory
216
217 $ hg co 1
218 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
219 $ echo 3 > a
220 $ echo 3 > dir1/a
221 $ echo 3 > dir1/dir1/a
222 $ hg ci -m 'first tree'
223 created new head
224 $ find .hg/store/meta | sort
225 .hg/store/meta
226 .hg/store/meta/dir1
227 .hg/store/meta/dir1/00manifest.i
228 .hg/store/meta/dir1/dir1
229 .hg/store/meta/dir1/dir1/00manifest.i
230 .hg/store/meta/dir1/dir2
231 .hg/store/meta/dir1/dir2/00manifest.i
232 .hg/store/meta/dir2
233 .hg/store/meta/dir2/00manifest.i
234
235 Merge of two trees
236
237 $ hg co 2
238 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 $ hg merge 1
240 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
241 (branch merge, don't forget to commit)
242 $ hg ci -m 'merge of flat manifests to new tree manifest'
243 created new head
244 $ hg diff -r 3
245
246 Parent of tree root manifest should be flat manifest, and two for merge
247
248 $ hg debugindex -m
249 rev offset length base linkrev nodeid p1 p2
250 0 0 80 0 0 40536115ed9e 000000000000 000000000000
251 1 80 83 0 1 f3376063c255 40536115ed9e 000000000000
252 2 163 103 0 2 5d9b9da231a2 40536115ed9e 000000000000
253 3 266 83 0 3 d17d663cbd8a 5d9b9da231a2 f3376063c255
254 4 349 132 4 4 c05a51345f86 f3376063c255 000000000000
255 5 481 110 4 5 82594b1f557d 5d9b9da231a2 f3376063c255
256
257
258 Status across flat/tree boundary should work
259
260 $ hg status --rev '.^' --rev .
261 M a
262 M dir1/a
263 M dir1/dir1/a
264
265
266 Turning off treemanifest config has no effect
267
268 $ hg debugindex .hg/store/meta/dir1/00manifest.i
269 rev offset length base linkrev nodeid p1 p2
270 0 0 125 0 4 63c9c0557d24 000000000000 000000000000
271 1 125 109 0 5 23d12a1f6e0e 000000000000 000000000000
272 $ echo 2 > dir1/a
273 $ hg --config experimental.treemanifest=False ci -qm 'modify dir1/a'
274 $ hg debugindex .hg/store/meta/dir1/00manifest.i
275 rev offset length base linkrev nodeid p1 p2
276 0 0 125 0 4 63c9c0557d24 000000000000 000000000000
277 1 125 109 0 5 23d12a1f6e0e 000000000000 000000000000
278 2 234 55 0 6 3cb2d87b4250 23d12a1f6e0e 000000000000