# HG changeset patch # User Durham Goode # Date 2017-05-08 18:35:23 # Node ID a2be2abe947621a655f9b89f43de4f183d04a04b # Parent 9d3136638784d70a94c5df6c05f20c2fed49b326 strip: move tree strip logic to it's own function This will allow external extensions to modify tree strip behavior more precisely. diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -165,13 +165,8 @@ def strip(ui, repo, nodelist, backup=Tru tr.startgroup() cl.strip(striprev, tr) mfst.strip(striprev, tr) - if 'treemanifest' in repo.requirements: # safe but unnecessary - # otherwise - for unencoded, encoded, size in repo.store.datafiles(): - if (unencoded.startswith('meta/') and - unencoded.endswith('00manifest.i')): - dir = unencoded[5:-12] - repo.manifestlog._revlog.dirlog(dir).strip(striprev, tr) + striptrees(repo, tr, striprev, files) + for fn in files: repo.file(fn).strip(striprev, tr) tr.endgroup() @@ -240,6 +235,15 @@ def strip(ui, repo, nodelist, backup=Tru # extensions can use it return backupfile +def striptrees(repo, tr, striprev, files): + if 'treemanifest' in repo.requirements: # safe but unnecessary + # otherwise + for unencoded, encoded, size in repo.store.datafiles(): + if (unencoded.startswith('meta/') and + unencoded.endswith('00manifest.i')): + dir = unencoded[5:-12] + repo.manifestlog._revlog.dirlog(dir).strip(striprev, tr) + def rebuildfncache(ui, repo): """Rebuilds the fncache file from repo history.