Patchwork hg: backout optimizing for treemanifests

login
register
mail settings
Submitter Durham Goode
Date May 16, 2017, 1:56 a.m.
Message ID <26ecf5c249c1ade001d7.1494899782@dev111.prn1.facebook.com>
Download mbox | patch
Permalink /patch/20636/
State Accepted
Headers show

Comments

Durham Goode - May 16, 2017, 1:56 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1494899758 25200
#      Mon May 15 18:55:58 2017 -0700
# Node ID 26ecf5c249c1ade001d7aeb403da1f1897edc18e
# Parent  df3cf9422e1bb0287f281fd169fb0a8673bd547b
hg: backout optimizing for treemanifests

It turns out that the files list is not sufficient to identify with revlogs have
changed. In a merge commit, no files could've changed but directories would
have. For now let's just backout this optimization.
Augie Fackler - May 16, 2017, 3:01 a.m.
> On May 15, 2017, at 21:56, Durham Goode <durham@fb.com> wrote:
> 
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1494899758 25200
> #      Mon May 15 18:55:58 2017 -0700
> # Node ID 26ecf5c249c1ade001d7aeb403da1f1897edc18e
> # Parent  df3cf9422e1bb0287f281fd169fb0a8673bd547b
> hg: backout optimizing for treemanifests
> 
> It turns out that the files list is not sufficient to identify with revlogs have
> changed. In a merge commit, no files could've changed but directories would
> have. For now let's just backout this optimization.

Shucks, I should have caught this earlier. Queued.

Patch

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -238,12 +238,11 @@  def strip(ui, repo, nodelist, backup=Tru
 def striptrees(repo, tr, striprev, files):
     if 'treemanifest' in repo.requirements: # safe but unnecessary
                                             # otherwise
-        treerevlog = repo.manifestlog._revlog
-        for dir in util.dirs(files):
-            # If the revlog doesn't exist, this returns an empty revlog and is a
-            # no-op.
-            rl = treerevlog.dirlog(dir)
-            rl.strip(striprev, tr)
+        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.