comparison mercurial/repair.py @ 29464:87c184c9bfef

treemanifests: actually strip directory manifests Stripping has only partly worked since 7cbb3a01fa38 (repair: use cg3 for treemanifests, 2016-01-19): the bundle seems to have been created correctly, but revlog entries in subdirectory revlogs were not stripped. This meant that e.g. "hg verify" would fail after stripping in a tree manifest repo. To find the revisions to strip, we simply iterate over all directories in the repo (included in store.datafiles()). This is inefficient for stripping few commits, but efficient for stripping many commits. To optimize for stripping few commits, we could instead walk the tree from the root and find modified subdirectories, just like we do in the changegroup code. I'm leaving that for another day.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 30 Jun 2016 13:06:19 -0700
parents 0d83ad967bf8
children d1c3721d184c
comparison
equal deleted inserted replaced
29463:4cf0542dcbe7 29464:87c184c9bfef
165 offset = len(tr.entries) 165 offset = len(tr.entries)
166 166
167 tr.startgroup() 167 tr.startgroup()
168 cl.strip(striprev, tr) 168 cl.strip(striprev, tr)
169 mfst.strip(striprev, tr) 169 mfst.strip(striprev, tr)
170 if 'treemanifest' in repo.requirements: # safe but unnecessary
171 # otherwise
172 for unencoded, encoded, size in repo.store.datafiles():
173 if (unencoded.startswith('meta/') and
174 unencoded.endswith('00manifest.i')):
175 dir = unencoded[5:-12]
176 repo.dirlog(dir).strip(striprev, tr)
170 for fn in files: 177 for fn in files:
171 repo.file(fn).strip(striprev, tr) 178 repo.file(fn).strip(striprev, tr)
172 tr.endgroup() 179 tr.endgroup()
173 180
174 for i in xrange(offset, len(tr.entries)): 181 for i in xrange(offset, len(tr.entries)):