##// END OF EJS Templates
revlog: change addgroup callbacks to take revision numbers...
Joerg Sonnenberger -
r47259:7a93b7b3 default
parent child Browse files
Show More
@@ -743,7 +743,7 b' class sqlitefilestore(object):'
743 )
743 )
744
744
745 if duplicaterevisioncb:
745 if duplicaterevisioncb:
746 duplicaterevisioncb(self, node)
746 duplicaterevisioncb(self, self.rev(node))
747 empty = False
747 empty = False
748 continue
748 continue
749
749
@@ -754,7 +754,7 b' class sqlitefilestore(object):'
754 text = None
754 text = None
755 storedelta = (deltabase, delta)
755 storedelta = (deltabase, delta)
756
756
757 self._addrawrevision(
757 rev = self._addrawrevision(
758 node,
758 node,
759 text,
759 text,
760 transaction,
760 transaction,
@@ -766,7 +766,7 b' class sqlitefilestore(object):'
766 )
766 )
767
767
768 if addrevisioncb:
768 if addrevisioncb:
769 addrevisioncb(self, node)
769 addrevisioncb(self, rev)
770 empty = False
770 empty = False
771
771
772 return not empty
772 return not empty
@@ -318,12 +318,11 b' class cg1unpacker(object):'
318 efilesset = set()
318 efilesset = set()
319 cgnodes = []
319 cgnodes = []
320
320
321 def ondupchangelog(cl, node):
321 def ondupchangelog(cl, rev):
322 if cl.rev(node) < clstart:
322 if rev < clstart:
323 cgnodes.append(node)
323 cgnodes.append(cl.node(rev))
324
324
325 def onchangelog(cl, node):
325 def onchangelog(cl, rev):
326 rev = cl.rev(node)
327 ctx = cl.changelogrevision(rev)
326 ctx = cl.changelogrevision(rev)
328 efilesset.update(ctx.files)
327 efilesset.update(ctx.files)
329 repo.register_changeset(rev, ctx)
328 repo.register_changeset(rev, ctx)
@@ -610,9 +610,9 b' class changelog(revlog.revlog):'
610 just to access this is costly."""
610 just to access this is costly."""
611 return self.changelogrevision(rev).branchinfo
611 return self.changelogrevision(rev).branchinfo
612
612
613 def _nodeduplicatecallback(self, transaction, node):
613 def _nodeduplicatecallback(self, transaction, rev):
614 # keep track of revisions that got "re-added", eg: unbunde of know rev.
614 # keep track of revisions that got "re-added", eg: unbunde of know rev.
615 #
615 #
616 # We track them in a list to preserve their order from the source bundle
616 # We track them in a list to preserve their order from the source bundle
617 duplicates = transaction.changes.setdefault(b'revduplicates', [])
617 duplicates = transaction.changes.setdefault(b'revduplicates', [])
618 duplicates.append(self.rev(node))
618 duplicates.append(rev)
@@ -358,15 +358,14 b' def _processchangesetdata(repo, tr, objs'
358 # Linkrev for changelog is always self.
358 # Linkrev for changelog is always self.
359 return len(cl)
359 return len(cl)
360
360
361 def ondupchangeset(cl, node):
361 def ondupchangeset(cl, rev):
362 added.append(node)
362 added.append(cl.node(rev))
363
363
364 def onchangeset(cl, node):
364 def onchangeset(cl, rev):
365 progress.increment()
365 progress.increment()
366
366
367 rev = cl.rev(node)
368 revision = cl.changelogrevision(rev)
367 revision = cl.changelogrevision(rev)
369 added.append(node)
368 added.append(cl.node(rev))
370
369
371 # We need to preserve the mapping of changelog revision to node
370 # We need to preserve the mapping of changelog revision to node
372 # so we can set the linkrev accordingly when manifests are added.
371 # so we can set the linkrev accordingly when manifests are added.
@@ -537,8 +536,8 b' def _fetchmanifests(repo, tr, remote, ma'
537 # Chomp off header object.
536 # Chomp off header object.
538 next(objs)
537 next(objs)
539
538
540 def onchangeset(cl, node):
539 def onchangeset(cl, rev):
541 added.append(node)
540 added.append(cl.node(rev))
542
541
543 rootmanifest.addgroup(
542 rootmanifest.addgroup(
544 iterrevisions(objs, progress),
543 iterrevisions(objs, progress),
@@ -774,8 +774,9 b' class ifilemutation(interfaceutil.Interf'
774 This used to be the default when ``addrevisioncb`` was provided up to
774 This used to be the default when ``addrevisioncb`` was provided up to
775 Mercurial 5.8.
775 Mercurial 5.8.
776
776
777 ``addrevisioncb`` should be called for each node as it is committed.
777 ``addrevisioncb`` should be called for each new rev as it is committed.
778 ``duplicaterevisioncb`` should be called for each pre-existing node.
778 ``duplicaterevisioncb`` should be called for all revs with a
779 pre-existing node.
779
780
780 ``maybemissingparents`` is a bool indicating whether the incoming
781 ``maybemissingparents`` is a bool indicating whether the incoming
781 data may reference parents/ancestor revisions that aren't present.
782 data may reference parents/ancestor revisions that aren't present.
@@ -2419,11 +2419,12 b' class revlog(object):'
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
@@ -2461,7 +2462,7 b' class revlog(object):'
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,
@@ -2477,7 +2478,7 b' class revlog(object):'
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:
@@ -1129,12 +1129,13 b' class ifilemutationtests(basetestcase):'
1129 with self._maketransactionfn() as tr:
1129 with self._maketransactionfn() as tr:
1130 nodes = []
1130 nodes = []
1131
1131
1132 def onchangeset(cl, node):
1132 def onchangeset(cl, rev):
1133 node = cl.node(rev)
1133 nodes.append(node)
1134 nodes.append(node)
1134 cb(cl, node)
1135 cb(cl, node)
1135
1136
1136 def ondupchangeset(cl, node):
1137 def ondupchangeset(cl, rev):
1137 nodes.append(node)
1138 nodes.append(cl.node(rev))
1138
1139
1139 f.addgroup(
1140 f.addgroup(
1140 [],
1141 [],
@@ -1163,12 +1164,13 b' class ifilemutationtests(basetestcase):'
1163 with self._maketransactionfn() as tr:
1164 with self._maketransactionfn() as tr:
1164 nodes = []
1165 nodes = []
1165
1166
1166 def onchangeset(cl, node):
1167 def onchangeset(cl, rev):
1168 node = cl.node(rev)
1167 nodes.append(node)
1169 nodes.append(node)
1168 cb(cl, node)
1170 cb(cl, node)
1169
1171
1170 def ondupchangeset(cl, node):
1172 def ondupchangeset(cl, rev):
1171 nodes.append(node)
1173 nodes.append(cl.node(rev))
1172
1174
1173 f.addgroup(
1175 f.addgroup(
1174 deltas,
1176 deltas,
@@ -1217,8 +1219,8 b' class ifilemutationtests(basetestcase):'
1217 with self._maketransactionfn() as tr:
1219 with self._maketransactionfn() as tr:
1218 newnodes = []
1220 newnodes = []
1219
1221
1220 def onchangeset(cl, node):
1222 def onchangeset(cl, rev):
1221 newnodes.append(node)
1223 newnodes.append(cl.node(rev))
1222
1224
1223 f.addgroup(
1225 f.addgroup(
1224 deltas,
1226 deltas,
@@ -550,7 +550,7 b' class filestorage(object):'
550
550
551 if node in self._indexbynode:
551 if node in self._indexbynode:
552 if duplicaterevisioncb:
552 if duplicaterevisioncb:
553 duplicaterevisioncb(self, node)
553 duplicaterevisioncb(self, self.rev(node))
554 empty = False
554 empty = False
555 continue
555 continue
556
556
@@ -560,12 +560,12 b' class filestorage(object):'
560 else:
560 else:
561 text = mdiff.patch(self.revision(deltabase), delta)
561 text = mdiff.patch(self.revision(deltabase), delta)
562
562
563 self._addrawrevision(
563 rev = self._addrawrevision(
564 node, text, transaction, linkrev, p1, p2, flags
564 node, text, transaction, linkrev, p1, p2, flags
565 )
565 )
566
566
567 if addrevisioncb:
567 if addrevisioncb:
568 addrevisioncb(self, node)
568 addrevisioncb(self, rev)
569 empty = False
569 empty = False
570 return not empty
570 return not empty
571
571
General Comments 0
You need to be logged in to leave comments. Login now