--- a/mercurial/obsolete.py Wed Feb 03 17:44:11 2016 -0800
+++ b/mercurial/obsolete.py Thu Feb 04 15:38:04 2016 -0800
@@ -1225,6 +1225,7 @@
metadata['user'] = repo.ui.username()
tr = repo.transaction('add-obsolescence-marker')
try:
+ markerargs = []
for rel in relations:
prec = rel[0]
sucs = rel[1]
@@ -1243,6 +1244,15 @@
npare = tuple(p.node() for p in prec.parents())
if nprec in nsucs:
raise error.Abort("changeset %s cannot obsolete itself" % prec)
+
+ # Creating the marker causes the hidden cache to become invalid,
+ # which causes recomputation when we ask for prec.parents() above.
+ # Resulting in n^2 behavior. So let's prepare all of the args
+ # first, then create the markers.
+ markerargs.append((nprec, nsucs, npare, localmetadata))
+
+ for args in markerargs:
+ nprec, nsucs, npare, localmetadata = args
repo.obsstore.create(tr, nprec, nsucs, flag, parents=npare,
date=date, metadata=localmetadata)
repo.filteredrevcache.clear()