joerg.sonnenberger created this revision. Herald added a reviewer: indygreg. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9883 AFFECTED FILES hgext/sqlitestore.py mercurial/changegroup.py mercurial/changelog.py mercurial/exchangev2.py mercurial/interfaces/repository.py mercurial/revlog.py mercurial/testing/storage.py tests/simplestorerepo.py CHANGE DETAILS diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -550,7 +550,7 @@ if node in self._indexbynode: if duplicaterevisioncb: - duplicaterevisioncb(self, node) + duplicaterevisioncb(self, self.rev(node)) empty = False continue @@ -560,12 +560,12 @@ else: text = mdiff.patch(self.revision(deltabase), delta) - self._addrawrevision( + rev = self._addrawrevision( node, text, transaction, linkrev, p1, p2, flags ) if addrevisioncb: - addrevisioncb(self, node) + addrevisioncb(self, rev) empty = False return not empty diff --git a/mercurial/testing/storage.py b/mercurial/testing/storage.py --- a/mercurial/testing/storage.py +++ b/mercurial/testing/storage.py @@ -1129,12 +1129,13 @@ with self._maketransactionfn() as tr: nodes = [] - def onchangeset(cl, node): + def onchangeset(cl, rev): + node = cl.node(rev) nodes.append(node) cb(cl, node) - def ondupchangeset(cl, node): - nodes.append(node) + def ondupchangeset(cl, rev): + nodes.append(cl.node(rev)) f.addgroup( [], @@ -1163,12 +1164,13 @@ with self._maketransactionfn() as tr: nodes = [] - def onchangeset(cl, node): + def onchangeset(cl, rev): + node = cl.node(rev) nodes.append(node) cb(cl, node) - def ondupchangeset(cl, node): - nodes.append(node) + def ondupchangeset(cl, rev): + nodes.append(cl.node(rev)) f.addgroup( deltas, @@ -1217,8 +1219,8 @@ with self._maketransactionfn() as tr: newnodes = [] - def onchangeset(cl, node): - newnodes.append(node) + def onchangeset(cl, rev): + newnodes.append(cl.node(rev)) f.addgroup( deltas, diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2424,11 +2424,12 @@ link = linkmapper(linknode) flags = flags or REVIDX_DEFAULT_FLAGS - if self.index.has_node(node): + rev = self.index.get_rev(node) + if rev is not None: # this can happen if two branches make the same change - self._nodeduplicatecallback(transaction, node) + self._nodeduplicatecallback(transaction, rev) if duplicaterevisioncb: - duplicaterevisioncb(self, node) + duplicaterevisioncb(self, rev) empty = False continue @@ -2466,7 +2467,7 @@ # We're only using addgroup() in the context of changegroup # generation so the revision data can always be handled as raw # by the flagprocessor. - self._addrevision( + rev = self._addrevision( node, None, transaction, @@ -2482,7 +2483,7 @@ ) if addrevisioncb: - addrevisioncb(self, node) + addrevisioncb(self, rev) empty = False if not dfh and not self._inline: diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py --- a/mercurial/interfaces/repository.py +++ b/mercurial/interfaces/repository.py @@ -774,8 +774,9 @@ This used to be the default when ``addrevisioncb`` was provided up to Mercurial 5.8. - ``addrevisioncb`` should be called for each node as it is committed. - ``duplicaterevisioncb`` should be called for each pre-existing node. + ``addrevisioncb`` should be called for each new rev as it is committed. + ``duplicaterevisioncb`` should be called for all revs with a + pre-existing node. ``maybemissingparents`` is a bool indicating whether the incoming data may reference parents/ancestor revisions that aren't present. diff --git a/mercurial/exchangev2.py b/mercurial/exchangev2.py --- a/mercurial/exchangev2.py +++ b/mercurial/exchangev2.py @@ -358,15 +358,14 @@ # Linkrev for changelog is always self. return len(cl) - def ondupchangeset(cl, node): - added.append(node) + def ondupchangeset(cl, rev): + added.append(cl.node(rev)) - def onchangeset(cl, node): + def onchangeset(cl, rev): progress.increment() - rev = cl.rev(node) revision = cl.changelogrevision(rev) - added.append(node) + added.append(cl.node(rev)) # We need to preserve the mapping of changelog revision to node # so we can set the linkrev accordingly when manifests are added. @@ -537,8 +536,8 @@ # Chomp off header object. next(objs) - def onchangeset(cl, node): - added.append(node) + def onchangeset(cl, rev): + added.append(cl.node(rev)) rootmanifest.addgroup( iterrevisions(objs, progress), diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -610,9 +610,9 @@ just to access this is costly.""" return self.changelogrevision(rev).branchinfo - def _nodeduplicatecallback(self, transaction, node): + def _nodeduplicatecallback(self, transaction, rev): # keep track of revisions that got "re-added", eg: unbunde of know rev. # # We track them in a list to preserve their order from the source bundle duplicates = transaction.changes.setdefault(b'revduplicates', []) - duplicates.append(self.rev(node)) + duplicates.append(rev) diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -318,12 +318,11 @@ efilesset = set() cgnodes = [] - def ondupchangelog(cl, node): - if cl.rev(node) < clstart: - cgnodes.append(node) + def ondupchangelog(cl, rev): + if rev < clstart: + cgnodes.append(cl.node(rev)) - def onchangelog(cl, node): - rev = cl.rev(node) + def onchangelog(cl, rev): ctx = cl.changelogrevision(rev) efilesset.update(ctx.files) repo.register_changeset(rev, ctx) diff --git a/hgext/sqlitestore.py b/hgext/sqlitestore.py --- a/hgext/sqlitestore.py +++ b/hgext/sqlitestore.py @@ -636,7 +636,8 @@ if meta or filedata.startswith(b'\x01\n'): filedata = storageutil.packmeta(meta, filedata) - return self.addrevision(filedata, transaction, linkrev, p1, p2) + rev = self.addrevision(filedata, transaction, linkrev, p1, p2) + return self.node(rev) def addrevision( self, @@ -658,15 +659,16 @@ if validatehash: self._checkhash(revisiondata, node, p1, p2) - if node in self._nodetorev: - return node + rev = self._nodetorev.get(node) + if rev is not None: + return rev - node = self._addrawrevision( + rev = self._addrawrevision( node, revisiondata, transaction, linkrev, p1, p2 ) self._revisioncache[node] = revisiondata - return node + return rev def addgroup( self, @@ -741,7 +743,7 @@ ) if duplicaterevisioncb: - duplicaterevisioncb(self, node) + duplicaterevisioncb(self, self.rev(node)) empty = False continue @@ -752,7 +754,7 @@ text = None storedelta = (deltabase, delta) - self._addrawrevision( + rev = self._addrawrevision( node, text, transaction, @@ -764,7 +766,7 @@ ) if addrevisioncb: - addrevisioncb(self, node) + addrevisioncb(self, rev) empty = False return not empty @@ -1079,7 +1081,7 @@ self._revtonode[rev] = node self._revisions[node] = entry - return node + return rev class sqliterepository(localrepo.localrepository): To: joerg.sonnenberger, indygreg, #hg-reviewers Cc: mercurial-patches, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel