comparison mercurial/revlog.py @ 46561:7a93b7b3dc2d

revlog: change addgroup callbacks to take revision numbers Differential Revision: https://phab.mercurial-scm.org/D9883
author Joerg Sonnenberger <joerg@bec.de>
date Wed, 27 Jan 2021 02:34:51 +0100
parents f7b61ad3c64a
children e9901d01d135
comparison
equal deleted inserted replaced
46560:f7b61ad3c64a 46561:7a93b7b3dc2d
2417 for data in deltas: 2417 for data in deltas:
2418 node, p1, p2, linknode, deltabase, delta, flags = data 2418 node, p1, p2, linknode, deltabase, delta, flags = data
2419 link = linkmapper(linknode) 2419 link = linkmapper(linknode)
2420 flags = flags or REVIDX_DEFAULT_FLAGS 2420 flags = flags or REVIDX_DEFAULT_FLAGS
2421 2421
2422 if self.index.has_node(node): 2422 rev = self.index.get_rev(node)
2423 if rev is not None:
2423 # this can happen if two branches make the same change 2424 # this can happen if two branches make the same change
2424 self._nodeduplicatecallback(transaction, node) 2425 self._nodeduplicatecallback(transaction, rev)
2425 if duplicaterevisioncb: 2426 if duplicaterevisioncb:
2426 duplicaterevisioncb(self, node) 2427 duplicaterevisioncb(self, rev)
2427 empty = False 2428 empty = False
2428 continue 2429 continue
2429 2430
2430 for p in (p1, p2): 2431 for p in (p1, p2):
2431 if not self.index.has_node(p): 2432 if not self.index.has_node(p):
2459 # revision(). revision() will fast path if there is a cache 2460 # revision(). revision() will fast path if there is a cache
2460 # hit. So, we tell _addrevision() to always cache in this case. 2461 # hit. So, we tell _addrevision() to always cache in this case.
2461 # We're only using addgroup() in the context of changegroup 2462 # We're only using addgroup() in the context of changegroup
2462 # generation so the revision data can always be handled as raw 2463 # generation so the revision data can always be handled as raw
2463 # by the flagprocessor. 2464 # by the flagprocessor.
2464 self._addrevision( 2465 rev = self._addrevision(
2465 node, 2466 node,
2466 None, 2467 None,
2467 transaction, 2468 transaction,
2468 link, 2469 link,
2469 p1, 2470 p1,
2475 alwayscache=alwayscache, 2476 alwayscache=alwayscache,
2476 deltacomputer=deltacomputer, 2477 deltacomputer=deltacomputer,
2477 ) 2478 )
2478 2479
2479 if addrevisioncb: 2480 if addrevisioncb:
2480 addrevisioncb(self, node) 2481 addrevisioncb(self, rev)
2481 empty = False 2482 empty = False
2482 2483
2483 if not dfh and not self._inline: 2484 if not dfh and not self._inline:
2484 # addrevision switched from inline to conventional 2485 # addrevision switched from inline to conventional
2485 # reopen the index 2486 # reopen the index