strip: move tree strip logic to it's own function
This will allow external extensions to modify tree strip behavior more
precisely.
--- a/mercurial/repair.py Mon May 08 09:39:21 2017 -0700
+++ b/mercurial/repair.py Mon May 08 11:35:23 2017 -0700
@@ -165,13 +165,8 @@
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 @@
# 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.