Show More
@@ -316,6 +316,7 b' class cg1packer(object):' | |||||
316 | # for progress output |
|
316 | # for progress output | |
317 | msgbundling = _('bundling') |
|
317 | msgbundling = _('bundling') | |
318 |
|
318 | |||
|
319 | clrevorder = {} | |||
319 | mfs = {} # needed manifests |
|
320 | mfs = {} # needed manifests | |
320 | fnodes = {} # needed file nodes |
|
321 | fnodes = {} # needed file nodes | |
321 | changedfiles = set() |
|
322 | changedfiles = set() | |
@@ -325,6 +326,7 b' class cg1packer(object):' | |||||
325 | # Returns the linkrev node (identity in the changelog case). |
|
326 | # Returns the linkrev node (identity in the changelog case). | |
326 | def lookupcl(x): |
|
327 | def lookupcl(x): | |
327 | c = cl.read(x) |
|
328 | c = cl.read(x) | |
|
329 | clrevorder[x] = len(clrevorder) | |||
328 | changedfiles.update(c[3]) |
|
330 | changedfiles.update(c[3]) | |
329 | # record the first changeset introducing this manifest version |
|
331 | # record the first changeset introducing this manifest version | |
330 | mfs.setdefault(c[0], x) |
|
332 | mfs.setdefault(c[0], x) | |
@@ -340,13 +342,16 b' class cg1packer(object):' | |||||
340 | # Returns the linkrev node (collected in lookupcl). |
|
342 | # Returns the linkrev node (collected in lookupcl). | |
341 | def lookupmf(x): |
|
343 | def lookupmf(x): | |
342 | clnode = mfs[x] |
|
344 | clnode = mfs[x] | |
343 | if not fastpathlinkrev: |
|
345 | if not fastpathlinkrev or reorder: | |
344 | mdata = mf.readfast(x) |
|
346 | mdata = mf.readfast(x) | |
345 | for f, n in mdata.iteritems(): |
|
347 | for f, n in mdata.iteritems(): | |
346 | if f in changedfiles: |
|
348 | if f in changedfiles: | |
347 | # record the first changeset introducing this filelog |
|
349 | # record the first changeset introducing this filelog | |
348 | # version |
|
350 | # version | |
349 |
fnodes.setdefault(f, {}) |
|
351 | fclnodes = fnodes.setdefault(f, {}) | |
|
352 | fclnode = fclnodes.setdefault(n, clnode) | |||
|
353 | if clrevorder[clnode] < clrevorder[fclnode]: | |||
|
354 | fclnodes[n] = clnode | |||
350 | return clnode |
|
355 | return clnode | |
351 |
|
356 | |||
352 | mfnodes = self.prune(mf, mfs, commonrevs, source) |
|
357 | mfnodes = self.prune(mf, mfs, commonrevs, source) | |
@@ -359,7 +364,7 b' class cg1packer(object):' | |||||
359 | needed = set(cl.rev(x) for x in clnodes) |
|
364 | needed = set(cl.rev(x) for x in clnodes) | |
360 |
|
365 | |||
361 | def linknodes(filerevlog, fname): |
|
366 | def linknodes(filerevlog, fname): | |
362 | if fastpathlinkrev: |
|
367 | if fastpathlinkrev and not reorder: | |
363 | llr = filerevlog.linkrev |
|
368 | llr = filerevlog.linkrev | |
364 | def genfilenodes(): |
|
369 | def genfilenodes(): | |
365 | for r in filerevlog: |
|
370 | for r in filerevlog: |
@@ -22,3 +22,50 b' inserted due to big distance from its pa' | |||||
22 | >>> gdsize = os.stat("gdrepo/.hg/store/00manifest.i").st_size |
|
22 | >>> gdsize = os.stat("gdrepo/.hg/store/00manifest.i").st_size | |
23 | >>> if regsize < gdsize: |
|
23 | >>> if regsize < gdsize: | |
24 | ... print 'generaldata increased size of manifest' |
|
24 | ... print 'generaldata increased size of manifest' | |
|
25 | ||||
|
26 | Verify rev reordering doesnt create invalid bundles (issue4462) | |||
|
27 | This requires a commit tree that when pulled will reorder manifest revs such | |||
|
28 | that the second manifest to create a file rev will be ordered before the first | |||
|
29 | manifest to create that file rev. We also need to do a partial pull to ensure | |||
|
30 | reordering happens. At the end we verify the linkrev points at the earliest | |||
|
31 | commit. | |||
|
32 | ||||
|
33 | $ hg init server --config format.generaldelta=True | |||
|
34 | $ cd server | |||
|
35 | $ touch a | |||
|
36 | $ hg commit -Aqm a | |||
|
37 | $ echo x > x | |||
|
38 | $ echo y > y | |||
|
39 | $ hg commit -Aqm xy | |||
|
40 | $ hg up -q '.^' | |||
|
41 | $ echo x > x | |||
|
42 | $ echo z > z | |||
|
43 | $ hg commit -Aqm xz | |||
|
44 | $ hg up -q 1 | |||
|
45 | $ echo b > b | |||
|
46 | $ hg commit -Aqm b | |||
|
47 | $ hg merge -q 2 | |||
|
48 | $ hg commit -Aqm merge | |||
|
49 | $ echo c > c | |||
|
50 | $ hg commit -Aqm c | |||
|
51 | $ hg log -G -T '{rev} {shortest(node)} {desc}' | |||
|
52 | @ 5 ebb8 c | |||
|
53 | | | |||
|
54 | o 4 baf7 merge | |||
|
55 | |\ | |||
|
56 | | o 3 a129 b | |||
|
57 | | | | |||
|
58 | o | 2 958c xz | |||
|
59 | | | | |||
|
60 | | o 1 f00c xy | |||
|
61 | |/ | |||
|
62 | o 0 3903 a | |||
|
63 | ||||
|
64 | $ cd .. | |||
|
65 | $ hg init client | |||
|
66 | $ cd client | |||
|
67 | $ hg pull -q ../server -r 4 | |||
|
68 | $ hg debugindex x | |||
|
69 | rev offset length base linkrev nodeid p1 p2 | |||
|
70 | 0 0 3 0 1 1406e7411862 000000000000 000000000000 | |||
|
71 |
General Comments 0
You need to be logged in to leave comments.
Login now