##// END OF EJS Templates
branchmap: update rev-branch-cache incrementally...
Joerg Sonnenberger -
r47084:3e91d997 default
parent child Browse files
Show More
@@ -706,8 +706,10 b' class revbranchcache(object):'
706 self._setcachedata(rev, reponode, branchidx)
706 self._setcachedata(rev, reponode, branchidx)
707 return b, close
707 return b, close
708
708
709 def setdata(self, branch, rev, node, close):
709 def setdata(self, rev, changelogrevision):
710 """add new data information to the cache"""
710 """add new data information to the cache"""
711 branch, close = changelogrevision.branchinfo
712
711 if branch in self._namesreverse:
713 if branch in self._namesreverse:
712 branchidx = self._namesreverse[branch]
714 branchidx = self._namesreverse[branch]
713 else:
715 else:
@@ -716,7 +718,7 b' class revbranchcache(object):'
716 self._namesreverse[branch] = branchidx
718 self._namesreverse[branch] = branchidx
717 if close:
719 if close:
718 branchidx |= _rbccloseflag
720 branchidx |= _rbccloseflag
719 self._setcachedata(rev, node, branchidx)
721 self._setcachedata(rev, self._repo.changelog.node(rev), branchidx)
720 # If no cache data were readable (non exists, bad permission, etc)
722 # If no cache data were readable (non exists, bad permission, etc)
721 # the cache was bypassing itself by setting:
723 # the cache was bypassing itself by setting:
722 #
724 #
@@ -2478,35 +2478,10 b" rbcstruct = struct.Struct(b'>III')"
2478
2478
2479 @parthandler(b'cache:rev-branch-cache')
2479 @parthandler(b'cache:rev-branch-cache')
2480 def handlerbc(op, inpart):
2480 def handlerbc(op, inpart):
2481 """receive a rev-branch-cache payload and update the local cache
2481 """Legacy part, ignored for compatibility with bundles from or
2482
2482 for Mercurial before 5.7. Newer Mercurial computes the cache
2483 The payload is a series of data related to each branch
2483 efficiently enough during unbundling that the additional transfer
2484
2484 is unnecessary."""
2485 1) branch name length
2486 2) number of open heads
2487 3) number of closed heads
2488 4) open heads nodes
2489 5) closed heads nodes
2490 """
2491 total = 0
2492 rawheader = inpart.read(rbcstruct.size)
2493 cache = op.repo.revbranchcache()
2494 cl = op.repo.unfiltered().changelog
2495 while rawheader:
2496 header = rbcstruct.unpack(rawheader)
2497 total += header[1] + header[2]
2498 utf8branch = inpart.read(header[0])
2499 branch = encoding.tolocal(utf8branch)
2500 for x in pycompat.xrange(header[1]):
2501 node = inpart.read(20)
2502 rev = cl.rev(node)
2503 cache.setdata(branch, rev, node, False)
2504 for x in pycompat.xrange(header[2]):
2505 node = inpart.read(20)
2506 rev = cl.rev(node)
2507 cache.setdata(branch, rev, node, True)
2508 rawheader = inpart.read(rbcstruct.size)
2509 cache.write()
2510
2485
2511
2486
2512 @parthandler(b'pushvars')
2487 @parthandler(b'pushvars')
@@ -2063,7 +2063,7 b' class localrepository(object):'
2063 return self._revbranchcache
2063 return self._revbranchcache
2064
2064
2065 def register_changeset(self, rev, changelogrevision):
2065 def register_changeset(self, rev, changelogrevision):
2066 pass
2066 self.revbranchcache().setdata(rev, changelogrevision)
2067
2067
2068 def branchtip(self, branch, ignoremissing=False):
2068 def branchtip(self, branch, ignoremissing=False):
2069 """return the tip node for a given branch
2069 """return the tip node for a given branch
@@ -44,6 +44,9 b''
44 * The `branchmap` cache is updated more intelligently and can be
44 * The `branchmap` cache is updated more intelligently and can be
45 significantly faster for repositories with many branches and changesets.
45 significantly faster for repositories with many branches and changesets.
46
46
47 * The `rev-branch-cache` is now updated incrementally whenever changesets
48 are added.
49
47
50
48 == New Experimental Features ==
51 == New Experimental Features ==
49
52
@@ -204,6 +204,7 b' Extension disabled for lack of acl.sourc'
204 bundle2-input-part: "phase-heads" supported
204 bundle2-input-part: "phase-heads" supported
205 bundle2-input-part: total payload size 24
205 bundle2-input-part: total payload size 24
206 bundle2-input-bundle: 5 parts total
206 bundle2-input-bundle: 5 parts total
207 truncating cache/rbc-revs-v1 to 8
207 updating the branch cache
208 updating the branch cache
208 added 3 changesets with 3 changes to 3 files
209 added 3 changesets with 3 changes to 3 files
209 bundle2-output-bundle: "HG20", 1 parts total
210 bundle2-output-bundle: "HG20", 1 parts total
@@ -283,6 +284,7 b' No [acl.allow]/[acl.deny]'
283 bundle2-input-part: "phase-heads" supported
284 bundle2-input-part: "phase-heads" supported
284 bundle2-input-part: total payload size 24
285 bundle2-input-part: total payload size 24
285 bundle2-input-bundle: 5 parts total
286 bundle2-input-bundle: 5 parts total
287 truncating cache/rbc-revs-v1 to 8
286 updating the branch cache
288 updating the branch cache
287 added 3 changesets with 3 changes to 3 files
289 added 3 changesets with 3 changes to 3 files
288 bundle2-output-bundle: "HG20", 1 parts total
290 bundle2-output-bundle: "HG20", 1 parts total
@@ -806,6 +808,7 b' fred is not blocked from moving bookmark'
806 acl: acl.deny.bookmarks not enabled
808 acl: acl.deny.bookmarks not enabled
807 acl: bookmark access granted: "ef1ea85a6374b77d6da9dcda9541f498f2d17df7" on bookmark "moving-bookmark"
809 acl: bookmark access granted: "ef1ea85a6374b77d6da9dcda9541f498f2d17df7" on bookmark "moving-bookmark"
808 bundle2-input-bundle: 7 parts total
810 bundle2-input-bundle: 7 parts total
811 truncating cache/rbc-revs-v1 to 8
809 updating the branch cache
812 updating the branch cache
810 invalid branch cache (served.hidden): tip differs
813 invalid branch cache (served.hidden): tip differs
811 added 1 changesets with 1 changes to 1 files
814 added 1 changesets with 1 changes to 1 files
@@ -982,6 +985,7 b' barney is allowed everywhere'
982 bundle2-input-part: "phase-heads" supported
985 bundle2-input-part: "phase-heads" supported
983 bundle2-input-part: total payload size 24
986 bundle2-input-part: total payload size 24
984 bundle2-input-bundle: 5 parts total
987 bundle2-input-bundle: 5 parts total
988 truncating cache/rbc-revs-v1 to 8
985 updating the branch cache
989 updating the branch cache
986 added 3 changesets with 3 changes to 3 files
990 added 3 changesets with 3 changes to 3 files
987 bundle2-output-bundle: "HG20", 1 parts total
991 bundle2-output-bundle: "HG20", 1 parts total
@@ -1318,6 +1322,7 b' acl.config can set only [acl.allow]/[acl'
1318 bundle2-input-part: "phase-heads" supported
1322 bundle2-input-part: "phase-heads" supported
1319 bundle2-input-part: total payload size 24
1323 bundle2-input-part: total payload size 24
1320 bundle2-input-bundle: 5 parts total
1324 bundle2-input-bundle: 5 parts total
1325 truncating cache/rbc-revs-v1 to 8
1321 updating the branch cache
1326 updating the branch cache
1322 added 3 changesets with 3 changes to 3 files
1327 added 3 changesets with 3 changes to 3 files
1323 bundle2-output-bundle: "HG20", 1 parts total
1328 bundle2-output-bundle: "HG20", 1 parts total
@@ -1408,6 +1413,7 b' fred is always allowed'
1408 bundle2-input-part: "phase-heads" supported
1413 bundle2-input-part: "phase-heads" supported
1409 bundle2-input-part: total payload size 24
1414 bundle2-input-part: total payload size 24
1410 bundle2-input-bundle: 5 parts total
1415 bundle2-input-bundle: 5 parts total
1416 truncating cache/rbc-revs-v1 to 8
1411 updating the branch cache
1417 updating the branch cache
1412 added 3 changesets with 3 changes to 3 files
1418 added 3 changesets with 3 changes to 3 files
1413 bundle2-output-bundle: "HG20", 1 parts total
1419 bundle2-output-bundle: "HG20", 1 parts total
@@ -1577,6 +1583,7 b' OS-level groups'
1577 bundle2-input-part: "phase-heads" supported
1583 bundle2-input-part: "phase-heads" supported
1578 bundle2-input-part: total payload size 24
1584 bundle2-input-part: total payload size 24
1579 bundle2-input-bundle: 5 parts total
1585 bundle2-input-bundle: 5 parts total
1586 truncating cache/rbc-revs-v1 to 8
1580 updating the branch cache
1587 updating the branch cache
1581 added 3 changesets with 3 changes to 3 files
1588 added 3 changesets with 3 changes to 3 files
1582 bundle2-output-bundle: "HG20", 1 parts total
1589 bundle2-output-bundle: "HG20", 1 parts total
@@ -134,6 +134,8 b' group can still write everything'
134 00660 ../push/.hg/00changelog.i
134 00660 ../push/.hg/00changelog.i
135 00770 ../push/.hg/cache/
135 00770 ../push/.hg/cache/
136 00660 ../push/.hg/cache/branch2-base
136 00660 ../push/.hg/cache/branch2-base
137 00660 ../push/.hg/cache/rbc-names-v1
138 00660 ../push/.hg/cache/rbc-revs-v1
137 00660 ../push/.hg/dirstate
139 00660 ../push/.hg/dirstate
138 00660 ../push/.hg/requires
140 00660 ../push/.hg/requires
139 00770 ../push/.hg/store/
141 00770 ../push/.hg/store/
@@ -318,10 +318,10 b' Check that the right ancestors is used w'
318 bundle2-input-part: total payload size 1686
318 bundle2-input-part: total payload size 1686
319 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
319 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
320 bundle2-input-part: total payload size 74
320 bundle2-input-part: total payload size 74
321 truncating cache/rbc-revs-v1 to 56
322 bundle2-input-part: "phase-heads" supported
321 bundle2-input-part: "phase-heads" supported
323 bundle2-input-part: total payload size 24
322 bundle2-input-part: total payload size 24
324 bundle2-input-bundle: 3 parts total
323 bundle2-input-bundle: 3 parts total
324 truncating cache/rbc-revs-v1 to 72
325 added 2 changesets with 2 changes to 1 files
325 added 2 changesets with 2 changes to 1 files
326 updating the branch cache
326 updating the branch cache
327 invalid branch cache (served): tip differs
327 invalid branch cache (served): tip differs
General Comments 0
You need to be logged in to leave comments. Login now