From patchwork Thu Aug 1 17:55:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2, of, 3, STABLE] strip: access bookmark before getting a reference to changelog From: Pierre-Yves David X-Patchwork-Id: 41108 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Thu, 01 Aug 2019 19:55:39 +0200 # HG changeset patch # User Pierre-Yves David # Date 1564669367 -7200 # Thu Aug 01 16:22:47 2019 +0200 # Branch stable # Node ID df77a77a8b1744d93de9823fb8ac2d5c5d8c07d8 # Parent 309dee8dfbce8fb1b3e96535e167da107727c178 # EXP-Topic debug-book # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r df77a77a8b17 strip: access bookmark before getting a reference to changelog Bookmark access might invalidate the current changelog (to make sure both are in a reasonable synchronisation state). So we should grab the reference to changelog after we access bookmark. Otherwise we risk using a dead object for the whole strip process. (note: this dead object business probably requires a new layers of checking) diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -109,6 +109,9 @@ def strip(ui, repo, nodelist, backup=Tru repo = repo.unfiltered() repo.destroying() vfs = repo.vfs + # load bookmark before changelog to avoid side effect from outdated + # changelog (see repo._refreshchangelog) + repo._bookmarks cl = repo.changelog # TODO handle undo of merge sets