Mercurial > hg
diff tests/simplestorerepo.py @ 45788:a5206e71c536
revlog: extend addgroup() with callback for duplicates
The addgroup() interface currently doesn't allow the caller to keep
track of duplicated nodes except by looking at the returned node list.
Add an optional second callback for this purpose and change the return
type to a boolean. This allows follow-up changes to use more efficient
storage for the node list in places that are memory-sensitive.
Differential Revision: https://phab.mercurial-scm.org/D9231
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Sun, 18 Oct 2020 22:18:02 +0200 |
parents | 9d2b2df2c2ba |
children | 7a93b7b3dc2d |
line wrap: on
line diff
--- a/tests/simplestorerepo.py Wed Oct 07 14:26:47 2020 +0530 +++ b/tests/simplestorerepo.py Sun Oct 18 22:18:02 2020 +0200 @@ -532,6 +532,7 @@ linkmapper, transaction, addrevisioncb=None, + duplicaterevisioncb=None, maybemissingparents=False, ): if maybemissingparents: @@ -539,7 +540,7 @@ _('simple store does not support missing parents ' 'write mode') ) - nodes = [] + empty = True transaction.addbackup(self._indexpath) @@ -547,9 +548,10 @@ linkrev = linkmapper(linknode) flags = flags or revlog.REVIDX_DEFAULT_FLAGS - nodes.append(node) - if node in self._indexbynode: + if duplicaterevisioncb: + duplicaterevisioncb(self, node) + empty = False continue # Need to resolve the fulltext from the delta base. @@ -564,7 +566,8 @@ if addrevisioncb: addrevisioncb(self, node) - return nodes + empty = False + return not empty def _headrevs(self): # Assume all revisions are heads by default.