changeset 32196:a2be2abe9476

strip: move tree strip logic to it's own function This will allow external extensions to modify tree strip behavior more precisely.
author Durham Goode <durham@fb.com>
date Mon, 08 May 2017 11:35:23 -0700
parents 9d3136638784
children 7bcc9a5ab96e
files mercurial/repair.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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.