comparison tests/test-wireproto-exchangev2-shallow.t @ 40923:3ed77780f4a6

wireprotov2: send linknodes to emitfilerevisions() Previously, linknodes were calculated within emitfilerevisions() by using filectx.introrev(), which would always use the linkrev/linknode as recorded by storage. This is wrong for cases where the receiver doesn't have the changeset the linknode refers to. This commit changes the logic for linknode emission so the mapping of filenode to linknode is computed by the caller and passed into emitfilerevisions(). As part of the change, linknodes for "filesdata" in the haveparents=False case are now correct: the existing code performed a manifest walk and it was trivial to plug in the correct linknode. However, behavior for the haveparents=True case is still wrong because it relies on filtering linkrevs against the outgoing set in order to determine what to send. This will be fixed in a subsequent commit. The change test test-wireproto-exchangev2-shallow.t is a bit wonky. The test repo has 6 revisions. The changed test is performing a shallow clone with depth=1. So, only file data for revision 5 is present locally. So, the new behavior of associating the linknode with revision 5 for every file revision seems correct. Of course, when backfilling old revisions, we'll want to update the linknode. But this problem requires wire protocol support and we'll cross that bridge later. Differential Revision: https://phab.mercurial-scm.org/D5405
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 10 Dec 2018 18:04:12 +0000
parents 229d23cdb203
children 775224e26d74
comparison
equal deleted inserted replaced
40922:ca6372b7e566 40923:3ed77780f4a6
194 path = dir0/c 194 path = dir0/c
195 revnum = 0 195 revnum = 0
196 node = I\x1d\xa1\xbb\x89\xeax\xc0\xc0\xa2s[\x16\xce}\x93\x1d\xc8\xe2\r (esc) 196 node = I\x1d\xa1\xbb\x89\xeax\xc0\xc0\xa2s[\x16\xce}\x93\x1d\xc8\xe2\r (esc)
197 p1rev = -1 197 p1rev = -1
198 p2rev = -1 198 p2rev = -1
199 linkrev = 4 199 linkrev = 5
200 flags = 2 200 flags = 2
201 201
202 id = 4 202 id = 4
203 path = dir0/d 203 path = dir0/d
204 revnum = 0 204 revnum = 0
205 node = S\x82\x06\xdc\x97\x1eR\x15@\xd6\x84:\xbf\xe6\xd1`2\xf6\xd4& (esc) 205 node = S\x82\x06\xdc\x97\x1eR\x15@\xd6\x84:\xbf\xe6\xd1`2\xf6\xd4& (esc)
206 p1rev = -1 206 p1rev = -1
207 p2rev = -1 207 p2rev = -1
208 linkrev = 1 208 linkrev = 5
209 flags = 0 209 flags = 0
210 210
211 id = 5 211 id = 5
212 path = dir1/e 212 path = dir1/e
213 revnum = 0 213 revnum = 0
214 node = ]\xf3\xac\xd8\xd0\xc7\xfaP\x98\xd0'\x9a\x044\xc3\x02\x9e+x\xe1 (esc) 214 node = ]\xf3\xac\xd8\xd0\xc7\xfaP\x98\xd0'\x9a\x044\xc3\x02\x9e+x\xe1 (esc)
215 p1rev = -1 215 p1rev = -1
216 p2rev = -1 216 p2rev = -1
217 linkrev = 4 217 linkrev = 5
218 flags = 2 218 flags = 2
219 219
220 id = 6 220 id = 6
221 path = dir1/f 221 path = dir1/f
222 revnum = 0 222 revnum = 0
223 node = (\xc7v\xae\x08\xd0\xd5^\xb4\x06H\xb4\x01\xb9\x0f\xf5DH4\x8e (esc) 223 node = (\xc7v\xae\x08\xd0\xd5^\xb4\x06H\xb4\x01\xb9\x0f\xf5DH4\x8e (esc)
224 p1rev = -1 224 p1rev = -1
225 p2rev = -1 225 p2rev = -1
226 linkrev = 4 226 linkrev = 5
227 flags = 2 227 flags = 2
228 228
229 Test a shallow clone with only some files 229 Test a shallow clone with only some files
230 230
231 $ hg --debug clone --depth 1 --include dir0/ http://localhost:$HGPORT client-shallow-narrow-1 231 $ hg --debug clone --depth 1 --include dir0/ http://localhost:$HGPORT client-shallow-narrow-1
340 path = dir0/c 340 path = dir0/c
341 revnum = 0 341 revnum = 0
342 node = I\x1d\xa1\xbb\x89\xeax\xc0\xc0\xa2s[\x16\xce}\x93\x1d\xc8\xe2\r (esc) 342 node = I\x1d\xa1\xbb\x89\xeax\xc0\xc0\xa2s[\x16\xce}\x93\x1d\xc8\xe2\r (esc)
343 p1rev = -1 343 p1rev = -1
344 p2rev = -1 344 p2rev = -1
345 linkrev = 4 345 linkrev = 5
346 flags = 2 346 flags = 2
347 347
348 id = 2 348 id = 2
349 path = dir0/d 349 path = dir0/d
350 revnum = 0 350 revnum = 0
351 node = S\x82\x06\xdc\x97\x1eR\x15@\xd6\x84:\xbf\xe6\xd1`2\xf6\xd4& (esc) 351 node = S\x82\x06\xdc\x97\x1eR\x15@\xd6\x84:\xbf\xe6\xd1`2\xf6\xd4& (esc)
352 p1rev = -1 352 p1rev = -1
353 p2rev = -1 353 p2rev = -1
354 linkrev = 1 354 linkrev = 5
355 flags = 0 355 flags = 0
356 356
357 Cloning an old revision with depth=1 works 357 Cloning an old revision with depth=1 works
358 358
359 $ hg --debug clone --depth 1 -r 97765fc3cd624fd1fa0176932c21ffd16adf432e http://localhost:$HGPORT client-shallow-2 359 $ hg --debug clone --depth 1 -r 97765fc3cd624fd1fa0176932c21ffd16adf432e http://localhost:$HGPORT client-shallow-2