--- a/mercurial/revlog.py Wed Oct 07 14:26:47 2020 +0530
+++ b/mercurial/revlog.py Sun Oct 18 22:18:02 2020 +0200
@@ -2368,7 +2368,14 @@
self._enforceinlinesize(transaction, ifh)
nodemaputil.setup_persistent_nodemap(transaction, self)
- def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None):
+ def addgroup(
+ self,
+ deltas,
+ linkmapper,
+ transaction,
+ addrevisioncb=None,
+ duplicaterevisioncb=None,
+ ):
"""
add a delta group
@@ -2383,8 +2390,6 @@
if self._writinghandles:
raise error.ProgrammingError(b'cannot nest addgroup() calls')
- nodes = []
-
r = len(self)
end = 0
if r:
@@ -2405,6 +2410,7 @@
ifh.flush()
self._writinghandles = (ifh, dfh)
+ empty = True
try:
deltacomputer = deltautil.deltacomputer(self)
@@ -2414,11 +2420,12 @@
link = linkmapper(linknode)
flags = flags or REVIDX_DEFAULT_FLAGS
- nodes.append(node)
-
if self.index.has_node(node):
+ # this can happen if two branches make the same change
self._nodeduplicatecallback(transaction, node)
- # this can happen if two branches make the same change
+ if duplicaterevisioncb:
+ duplicaterevisioncb(self, node)
+ empty = False
continue
for p in (p1, p2):
@@ -2472,6 +2479,7 @@
if addrevisioncb:
addrevisioncb(self, node)
+ empty = False
if not dfh and not self._inline:
# addrevision switched from inline to conventional
@@ -2486,8 +2494,7 @@
if dfh:
dfh.close()
ifh.close()
-
- return nodes
+ return not empty
def iscensored(self, rev):
"""Check if a file revision is censored."""