Mercurial > hg
changeset 33725:86ea201eaeb9
repair: move manifest strip to a separate function
This moves manifest stripping to a separate function so implementations of the
manifest that don't support stripping can replace this function with a no-op.
I considered adding a strip api to the manifestlog, so other implementations
could make it a no-op there, but it seems like strip might be unique to the
revlog implementation, and therefore shouldn't be present on the generic api.
Differential Revision: https://phab.mercurial-scm.org/D292
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 08 Aug 2017 17:25:38 -0700 |
parents | 6626d12e7a85 |
children | ab0c55c2ad9a |
files | mercurial/repair.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/repair.py Tue Aug 08 17:25:38 2017 -0700 +++ b/mercurial/repair.py Tue Aug 08 17:25:38 2017 -0700 @@ -178,16 +178,13 @@ tmpbundlefile = _bundle(repo, savebases, saveheads, node, 'temp', compress=False, obsolescence=False) - mfst = repo.manifestlog._revlog - try: with repo.transaction("strip") as tr: offset = len(tr.entries) tr.startgroup() cl.strip(striprev, tr) - mfst.strip(striprev, tr) - striptrees(repo, tr, striprev, files) + stripmanifest(repo, striprev, tr, files) for fn in files: repo.file(fn).strip(striprev, tr) @@ -314,6 +311,11 @@ callback.topic = topic callback.addnodes(nodelist) +def stripmanifest(repo, striprev, tr, files): + revlog = repo.manifestlog._revlog + revlog.strip(striprev, tr) + striptrees(repo, tr, striprev, files) + def striptrees(repo, tr, striprev, files): if 'treemanifest' in repo.requirements: # safe but unnecessary # otherwise