##// END OF EJS Templates
tests: add tests for server-side linknode adjustment with wireprotov2...
Gregory Szorc -
r40958:ca6372b7 default
parent child Browse files
Show More
@@ -27,9 +27,26 b''
27 $ hg commit -m 'commit 3'
27 $ hg commit -m 'commit 3'
28 created new head
28 created new head
29
29
30 Create multiple heads introducing the same changeset
31
32 $ hg -q up -r 0
33 $ echo foo > dupe-file
34 $ hg commit -Am 'dupe 1'
35 adding dupe-file
36 created new head
37 $ hg -q up -r 0
38 $ echo foo > dupe-file
39 $ hg commit -Am 'dupe 2'
40 adding dupe-file
41 created new head
42
30 $ hg log -G -T '{rev}:{node} {desc}\n'
43 $ hg log -G -T '{rev}:{node} {desc}\n'
31 @ 3:5ce944d7fece1252dae06c34422b573c191b9489 commit 3
44 @ 5:732c3dd7bee94242de656000e5f458e7ccfe2828 dupe 2
32 |
45 |
46 | o 4:4334f10897d13c3e8beb4b636f7272b4ec2d0322 dupe 1
47 |/
48 | o 3:5ce944d7fece1252dae06c34422b573c191b9489 commit 3
49 |/
33 | o 2:b3c27db01410dae01e5485d425b1440078df540c commit 2
50 | o 2:b3c27db01410dae01e5485d425b1440078df540c commit 2
34 | |
51 | |
35 | o 1:3ef5e551f219ba505481d34d6b0316b017fa3f00 commit 1
52 | o 1:3ef5e551f219ba505481d34d6b0316b017fa3f00 commit 1
@@ -47,6 +64,10 b''
47 rev linkrev nodeid p1 p2
64 rev linkrev nodeid p1 p2
48 0 0 bbba6c06b30f443d34ff841bc985c4d0827c6be4 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
65 0 0 bbba6c06b30f443d34ff841bc985c4d0827c6be4 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
49
66
67 $ hg --debug debugindex dupe-file
68 rev linkrev nodeid p1 p2
69 0 4 2ed2a3912a0b24502043eae84ee4b279c18b90dd 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
70
50 $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log
71 $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log
51 $ cat hg.pid > $DAEMON_PIDS
72 $ cat hg.pid > $DAEMON_PIDS
52
73
@@ -309,4 +330,35 b' Requesting parents and revision data wor'
309 b'a0\n00000000000000000000000000000000000000\n11111111111111111111111111111111111111\na2\n'
330 b'a0\n00000000000000000000000000000000000000\n11111111111111111111111111111111111111\na2\n'
310 ]
331 ]
311
332
333 Linknode for duplicate revision is the initial revision
334
335 $ sendhttpv2peer << EOF
336 > command filedata
337 > nodes eval:[b'\x2e\xd2\xa3\x91\x2a\x0b\x24\x50\x20\x43\xea\xe8\x4e\xe4\xb2\x79\xc1\x8b\x90\xdd']
338 > path eval:b'dupe-file'
339 > fields eval:[b'linknode', b'parents', b'revision']
340 > EOF
341 creating http peer for wire protocol version 2
342 sending filedata command
343 response: gen[
344 {
345 b'totalitems': 1
346 },
347 {
348 b'fieldsfollowing': [
349 [
350 b'revision',
351 4
352 ]
353 ],
354 b'linknode': b'C4\xf1\x08\x97\xd1<>\x8b\xebKcorr\xb4\xec-\x03"',
355 b'node': b'.\xd2\xa3\x91*\x0b$P C\xea\xe8N\xe4\xb2y\xc1\x8b\x90\xdd',
356 b'parents': [
357 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
358 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
359 ]
360 },
361 b'foo\n'
362 ]
363
312 $ cat error.log
364 $ cat error.log
@@ -34,9 +34,26 b''
34 $ hg commit -m 'commit 3'
34 $ hg commit -m 'commit 3'
35 created new head
35 created new head
36
36
37 Create multiple heads introducing the same file nodefile node
38
39 $ hg -q up -r 0
40 $ echo foo > dupe-file
41 $ hg commit -Am 'dupe 1'
42 adding dupe-file
43 created new head
44 $ hg -q up -r 0
45 $ echo foo > dupe-file
46 $ hg commit -Am 'dupe 2'
47 adding dupe-file
48 created new head
49
37 $ hg log -G -T '{rev}:{node} {desc}\n'
50 $ hg log -G -T '{rev}:{node} {desc}\n'
38 @ 3:476fbf122cd82f6726f0191ff146f67140946abc commit 3
51 @ 5:47fc30580911232cb264675b402819deddf6c6f0 dupe 2
39 |
52 |
53 | o 4:b16cce2967c1749ef4f4e3086a806cfbad8a3af7 dupe 1
54 |/
55 | o 3:476fbf122cd82f6726f0191ff146f67140946abc commit 3
56 |/
40 | o 2:b91c03cbba3519ab149b6cd0a0afbdb5cf1b5c8a commit 2
57 | o 2:b91c03cbba3519ab149b6cd0a0afbdb5cf1b5c8a commit 2
41 | |
58 | |
42 | o 1:5b0b1a23577e205ea240e39c9704e28d7697cbd8 commit 1
59 | o 1:5b0b1a23577e205ea240e39c9704e28d7697cbd8 commit 1
@@ -1161,4 +1178,116 b' Requesting linknode field works'
1161 }
1178 }
1162 ]
1179 ]
1163
1180
1181 Test behavior where a file node is introduced in 2 DAG heads
1182
1183 Request for changeset introducing filenode returns linknode as self
1184
1185 $ sendhttpv2peer << EOF
1186 > command filesdata
1187 > revisions eval:[{
1188 > b'type': b'changesetexplicit',
1189 > b'nodes': [
1190 > b'\xb1\x6c\xce\x29\x67\xc1\x74\x9e\xf4\xf4\xe3\x08\x6a\x80\x6c\xfb\xad\x8a\x3a\xf7',
1191 > ]}]
1192 > fields eval:[b'linknode']
1193 > pathfilter eval:{b'include': [b'path:dupe-file']}
1194 > EOF
1195 creating http peer for wire protocol version 2
1196 sending filesdata command
1197 response: gen[
1198 {
1199 b'totalitems': 1,
1200 b'totalpaths': 1
1201 },
1202 {
1203 b'path': b'dupe-file',
1204 b'totalitems': 1
1205 },
1206 {
1207 b'linknode': b'\xb1l\xce)g\xc1t\x9e\xf4\xf4\xe3\x08j\x80l\xfb\xad\x8a:\xf7',
1208 b'node': b'.\xd2\xa3\x91*\x0b$P C\xea\xe8N\xe4\xb2y\xc1\x8b\x90\xdd'
1209 }
1210 ]
1211
1212 $ sendhttpv2peer << EOF
1213 > command filesdata
1214 > revisions eval:[{
1215 > b'type': b'changesetexplicit',
1216 > b'nodes': [
1217 > b'\xb1\x6c\xce\x29\x67\xc1\x74\x9e\xf4\xf4\xe3\x08\x6a\x80\x6c\xfb\xad\x8a\x3a\xf7',
1218 > ]}]
1219 > fields eval:[b'linknode']
1220 > haveparents eval:True
1221 > pathfilter eval:{b'include': [b'path:dupe-file']}
1222 > EOF
1223 creating http peer for wire protocol version 2
1224 sending filesdata command
1225 response: gen[
1226 {
1227 b'totalitems': 1,
1228 b'totalpaths': 1
1229 },
1230 {
1231 b'path': b'dupe-file',
1232 b'totalitems': 1
1233 },
1234 {
1235 b'linknode': b'\xb1l\xce)g\xc1t\x9e\xf4\xf4\xe3\x08j\x80l\xfb\xad\x8a:\xf7',
1236 b'node': b'.\xd2\xa3\x91*\x0b$P C\xea\xe8N\xe4\xb2y\xc1\x8b\x90\xdd'
1237 }
1238 ]
1239
1240 Request for changeset where recorded linknode isn't in DAG ancestry will get
1241 rewritten accordingly
1242 TODO this is buggy
1243
1244 $ sendhttpv2peer << EOF
1245 > command filesdata
1246 > revisions eval:[{
1247 > b'type': b'changesetexplicit',
1248 > b'nodes': [
1249 > b'\x47\xfc\x30\x58\x09\x11\x23\x2c\xb2\x64\x67\x5b\x40\x28\x19\xde\xdd\xf6\xc6\xf0',
1250 > ]}]
1251 > fields eval:[b'linknode']
1252 > pathfilter eval:{b'include': [b'path:dupe-file']}
1253 > EOF
1254 creating http peer for wire protocol version 2
1255 sending filesdata command
1256 response: gen[
1257 {
1258 b'totalitems': 1,
1259 b'totalpaths': 1
1260 },
1261 {
1262 b'path': b'dupe-file',
1263 b'totalitems': 1
1264 },
1265 {
1266 b'linknode': b'\xb1l\xce)g\xc1t\x9e\xf4\xf4\xe3\x08j\x80l\xfb\xad\x8a:\xf7',
1267 b'node': b'.\xd2\xa3\x91*\x0b$P C\xea\xe8N\xe4\xb2y\xc1\x8b\x90\xdd'
1268 }
1269 ]
1270
1271 TODO this is buggy
1272
1273 $ sendhttpv2peer << EOF
1274 > command filesdata
1275 > revisions eval:[{
1276 > b'type': b'changesetexplicit',
1277 > b'nodes': [
1278 > b'\x47\xfc\x30\x58\x09\x11\x23\x2c\xb2\x64\x67\x5b\x40\x28\x19\xde\xdd\xf6\xc6\xf0',
1279 > ]}]
1280 > fields eval:[b'linknode']
1281 > haveparents eval:True
1282 > pathfilter eval:{b'include': [b'path:dupe-file']}
1283 > EOF
1284 creating http peer for wire protocol version 2
1285 sending filesdata command
1286 response: gen[
1287 {
1288 b'totalitems': 0,
1289 b'totalpaths': 0
1290 }
1291 ]
1292
1164 $ cat error.log
1293 $ cat error.log
@@ -1236,3 +1236,85 b" Shallow clone doesn't work with revlogs"
1236 (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob)
1236 (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob)
1237 abort: revlog storage does not support missing parents write mode
1237 abort: revlog storage does not support missing parents write mode
1238 [255]
1238 [255]
1239
1240 $ killdaemons.py
1241
1242 Repo with 2 DAG branches introducing same filenode, to test linknode adjustment
1243
1244 $ hg init server-linknode
1245 $ enablehttpv2 server-linknode
1246 $ cd server-linknode
1247 $ touch foo
1248 $ hg -q commit -Am initial
1249 $ echo foo > dupe-file
1250 $ hg commit -Am 'dupe 1'
1251 adding dupe-file
1252 $ hg -q up -r 0
1253 $ echo foo > dupe-file
1254 $ hg commit -Am 'dupe 2'
1255 adding dupe-file
1256 created new head
1257 $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log
1258 $ cat hg.pid > $DAEMON_PIDS
1259 $ cd ..
1260
1261 Perform an incremental pull of both heads and ensure linkrev is written out properly
1262
1263 $ hg clone -r 96ee1d7354c4 http://localhost:$HGPORT client-linknode-1
1264 new changesets 96ee1d7354c4
1265 updating to branch default
1266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1267 $ cd client-linknode-1
1268 $ touch extra
1269 $ hg commit -Am extra
1270 adding extra
1271 $ cd ..
1272
1273 $ hg clone -r 96ee1d7354c4 http://localhost:$HGPORT client-linknode-2
1274 new changesets 96ee1d7354c4
1275 updating to branch default
1276 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1277 $ cd client-linknode-2
1278 $ touch extra
1279 $ hg commit -Am extra
1280 adding extra
1281 $ cd ..
1282
1283 $ hg -R client-linknode-1 pull -r 1681c33f9f80
1284 pulling from http://localhost:$HGPORT/
1285 searching for changes
1286 new changesets 1681c33f9f80
1287 (run 'hg update' to get a working copy)
1288
1289 #if reporevlogstore
1290 $ hg -R client-linknode-1 debugrevlogindex dupe-file
1291 rev linkrev nodeid p1 p2
1292 0 2 2ed2a3912a0b 000000000000 000000000000
1293 #endif
1294
1295 $ hg -R client-linknode-2 pull -r 639c8990d6a5
1296 pulling from http://localhost:$HGPORT/
1297 searching for changes
1298 new changesets 639c8990d6a5
1299 (run 'hg update' to get a working copy)
1300
1301 #if reporevlogstore
1302 $ hg -R client-linknode-2 debugrevlogindex dupe-file
1303 abort: revlog 'dupe-file' not found
1304 [255]
1305 #endif
1306
1307 $ hg -R client-linknode-2 verify
1308 checking changesets
1309 checking manifests
1310 crosschecking files in changesets and manifests
1311 checking files
1312 warning: revlog 'data/dupe-file.i' not in fncache!
1313 2: empty or missing dupe-file
1314 dupe-file@2: manifest refers to unknown revision 2ed2a3912a0b
1315 checked 3 changesets with 2 changes to 3 files
1316 1 warnings encountered!
1317 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
1318 2 integrity errors encountered!
1319 (first damaged changeset appears to be 2)
1320 [1]
General Comments 0
You need to be logged in to leave comments. Login now