[PATCH 1 of 2 narrowhg-ext] manifest: fixup manifest usages to be manifestlog
Durham Goode
durham at fb.com
Mon Nov 14 23:30:22 UTC 2016
# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1479159796 28800
# Mon Nov 14 13:43:16 2016 -0800
# Node ID 33646477f95dcfd2b7d4eede4d190569ca142be6
# Parent e7e7015c1935a1c825eb47968ec4be8bd48bd44f
manifest: fixup manifest usages to be manifestlog
Upstream has gotten rid of the manifest class, so we need to fix all our
repo.manifest usages to use repo.manifestlog instead. This patch fixes the naive
cases. The next patch will fix the more complex logic in narrowrevlog.py.
diff --git a/src/narrowbundle2.py b/src/narrowbundle2.py
--- a/src/narrowbundle2.py
+++ b/src/narrowbundle2.py
@@ -65,7 +65,7 @@ def _computeellipsis(repo, common, heads
correct parents.
"""
cl = repo.changelog
- mf = repo.manifest
+ mfl = repo.manifestlog
cldag = dagutil.revlogdag(cl)
# dagutil does not like nullid/nullrev
@@ -123,19 +123,19 @@ def _computeellipsis(repo, common, heads
needed = False
shallow_enough = depth is None or revdepth[rev] <= depth
if shallow_enough:
- curmf = mf.read(clrev.manifest)
+ curmf = mfl[clrev.manifest].read()
if ps:
# We choose to not trust the changed files list in
# changesets because it's not always correct. TODO: could
# we trust it for the non-merge case?
- p1mf = mf.read(cl.changelogrevision(ps[0]).manifest)
+ p1mf = mfl[cl.changelogrevision(ps[0]).manifest].read()
needed = any(match(f) for f in curmf.diff(p1mf).iterkeys())
if not needed and len(ps) > 1:
# For merge changes, the list of changed files is not
# helpful, since we need to emit the merge if a file
# in the narrow spec has changed on either side of the
# merge. As a result, we do a manifest diff to check.
- p2mf = mf.read(cl.changelogrevision(ps[1]).manifest)
+ p2mf = mfl[cl.changelogrevision(ps[1]).manifest].read()
needed = any(match(f) for f in curmf.diff(p2mf).iterkeys())
else:
# For a root node, we need to include the node if any
@@ -361,7 +361,7 @@ def _makeafter(repo, p1, p2, safep1, saf
def _changespec_strip_edited_nodes(repo, ui, tr, clkills):
cl = repo.changelog
- mf = repo.manifest
+ mfl = repo.manifestlog
# We'll soon strip all edited nodes and their descendants, so build a
# changegroup containing those nodes. This approach is based on
@@ -443,14 +443,14 @@ def _changespec_strip_edited_nodes(repo,
try:
tr.startgroup()
cl.strip(striprev, tr)
- mf.strip(striprev, tr)
+ mfl._revlog.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.manifest.dirlog(dir).strip(striprev, tr)
+ repo.manifestlog._revlog.dirlog(dir).strip(striprev, tr)
for fn in files:
repo.file(fn).strip(striprev, tr)
tr.endgroup()
diff --git a/src/narrowchangegroup.py b/src/narrowchangegroup.py
--- a/src/narrowchangegroup.py
+++ b/src/narrowchangegroup.py
@@ -34,7 +34,7 @@ def setup():
supportedoutgoingversions)
def prune(orig, self, revlog, missing, commonrevs):
- if isinstance(revlog, manifest.manifest):
+ if isinstance(revlog, manifest.manifestrevlog):
matcher = getattr(self._repo, 'narrowmatch',
getattr(self, '_narrow_matcher', None))
if (matcher is not None and
@@ -148,7 +148,8 @@ def setup():
repo = self._repo
cl = repo.changelog
- mf = repo.manifest
+ mfl = repo.manifestlog
+ mfrevlog = mfl._revlog
clrevorder = {}
mfs = {} # needed manifests
@@ -174,11 +175,12 @@ def setup():
# Set this narrow-specific dict so we have the lowest manifest
# revnum to look up for this cl revnum. (Part of mapping
# changelog ellipsis parents to manifest ellipsis parents)
- self.next_clrev_to_localrev.setdefault(cl.rev(x), mf.rev(n))
+ self.next_clrev_to_localrev.setdefault(cl.rev(x),
+ mfrevlog.rev(n))
# We can't trust the changed files list in the changeset if the
# client requested a shallow clone.
if self.is_shallow:
- changedfiles.update(mf.read(c[0]).keys())
+ changedfiles.update(mfl[c[0]].read().keys())
else:
changedfiles.update(c[3])
# END NARROW HACK
@@ -225,7 +227,7 @@ def setup():
# BEGIN NARROW HACK
mfdicts = None
if self.is_shallow:
- mfdicts = [(self._repo.manifest.read(n), lr)
+ mfdicts = [(self._repo.manifestlog[n].read(), lr)
for (n, lr) in mfs.iteritems()]
# END NARROW HACK
mfs.clear()
More information about the Mercurial-devel
mailing list