Patchwork [8,of,8] manifest: remove manifest.readshallowdelta

login
register
mail settings
Submitter Durham Goode
Date Sept. 14, 2016, 11:04 p.m.
Message ID <91356761fbb7f751e797.1473894278@dev111.prn1.facebook.com>
Download mbox | patch
Permalink /patch/16632/
State Superseded
Headers show

Comments

Durham Goode - Sept. 14, 2016, 11:04 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1473893509 25200
#      Wed Sep 14 15:51:49 2016 -0700
# Node ID 91356761fbb7f751e79790947e2be8b209bf9637
# Parent  9cccfde2ef2c1e7ac27e222d5be2850ab3da7960
manifest: remove manifest.readshallowdelta

This removes manifest.readshallowdelta and converts its one consumer to use
manifestlog instead.
Durham Goode - Sept. 14, 2016, 11:06 p.m.
FYI: This series depends on the manifest 4 patch series Martin queued 
earlier today.


On 9/14/16 4:04 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1473893509 25200
> #      Wed Sep 14 15:51:49 2016 -0700
> # Node ID 91356761fbb7f751e79790947e2be8b209bf9637
> # Parent  9cccfde2ef2c1e7ac27e222d5be2850ab3da7960
> manifest: remove manifest.readshallowdelta
>
> This removes manifest.readshallowdelta and converts its one consumer to use
> manifestlog instead.
>
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -1241,41 +1241,6 @@ class manifest(manifestrevlog):
>                                                 self._dirlogcache)
>           return self._dirlogcache[dir]
>   
> -    def _slowreaddelta(self, node):
> -        r0 = self.deltaparent(self.rev(node))
> -        m0 = self.read(self.node(r0))
> -        m1 = self.read(node)
> -        md = self._newmanifest()
> -        for f, ((n0, fl0), (n1, fl1)) in m0.diff(m1).iteritems():
> -            if n1:
> -                md[f] = n1
> -                if fl1:
> -                    md.setflag(f, fl1)
> -        return md
> -
> -    def readdelta(self, node):
> -        if self._usemanifestv2 or self._treeondisk:
> -            return self._slowreaddelta(node)
> -        r = self.rev(node)
> -        d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r))
> -        return self._newmanifest(d)
> -
> -    def readshallowdelta(self, node):
> -        '''For flat manifests, this is the same as readdelta(). For
> -        treemanifests, this will read the delta for this revlog's directory,
> -        without recursively reading subdirectory manifests. Instead, any
> -        subdirectory entry will be reported as it appears in the manifests, i.e.
> -        the subdirectory will be reported among files and distinguished only by
> -        its 't' flag.'''
> -        if not self._treeondisk:
> -            return self.readdelta(node)
> -        if self._usemanifestv2:
> -            raise error.Abort(
> -                _("readshallowdelta() not implemented for manifestv2"))
> -        r = self.rev(node)
> -        d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r))
> -        return manifestdict(d)
> -
>       def read(self, node):
>           if node == revlog.nullid:
>               return self._newmanifest() # don't upset local cache
> diff --git a/mercurial/verify.py b/mercurial/verify.py
> --- a/mercurial/verify.py
> +++ b/mercurial/verify.py
> @@ -201,7 +201,8 @@ class verifier(object):
>                           progress=None):
>           repo = self.repo
>           ui = self.ui
> -        mf = self.repo.manifest.dirlog(dir)
> +        mf = self.repo.manifestlog._revlog.dirlog(dir)
> +        mfl = self.repo.manifestlog
>   
>           if not dir:
>               self.ui.status(_("checking manifests\n"))
> @@ -235,7 +236,8 @@ class verifier(object):
>                   self.err(lr, _("%s not in changesets") % short(n), label)
>   
>               try:
> -                for f, fn, fl in mf.readshallowdelta(n).iterentries():
> +                mfdelta = mfl.get(dir, n).readdelta(shallow=True)
> +                for f, fn, fl in mfdelta.iterentries():
>                       if not f:
>                           self.err(lr, _("entry without name in manifest"))
>                       elif f == "/dev/null":  # ignore this in very old repos
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=DQIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=nuarHzhP1wi1T9iURRCj1A&m=bCsFvEbCD5qIHO2SAC23hqcrVPtGRt9ldQhyMLI6948&s=MSJdJM0PjUjnB2MnIXt3Oh_lp_3Z4-rm1eQ-STEqS0U&e=

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1241,41 +1241,6 @@  class manifest(manifestrevlog):
                                               self._dirlogcache)
         return self._dirlogcache[dir]
 
-    def _slowreaddelta(self, node):
-        r0 = self.deltaparent(self.rev(node))
-        m0 = self.read(self.node(r0))
-        m1 = self.read(node)
-        md = self._newmanifest()
-        for f, ((n0, fl0), (n1, fl1)) in m0.diff(m1).iteritems():
-            if n1:
-                md[f] = n1
-                if fl1:
-                    md.setflag(f, fl1)
-        return md
-
-    def readdelta(self, node):
-        if self._usemanifestv2 or self._treeondisk:
-            return self._slowreaddelta(node)
-        r = self.rev(node)
-        d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r))
-        return self._newmanifest(d)
-
-    def readshallowdelta(self, node):
-        '''For flat manifests, this is the same as readdelta(). For
-        treemanifests, this will read the delta for this revlog's directory,
-        without recursively reading subdirectory manifests. Instead, any
-        subdirectory entry will be reported as it appears in the manifests, i.e.
-        the subdirectory will be reported among files and distinguished only by
-        its 't' flag.'''
-        if not self._treeondisk:
-            return self.readdelta(node)
-        if self._usemanifestv2:
-            raise error.Abort(
-                _("readshallowdelta() not implemented for manifestv2"))
-        r = self.rev(node)
-        d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r))
-        return manifestdict(d)
-
     def read(self, node):
         if node == revlog.nullid:
             return self._newmanifest() # don't upset local cache
diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -201,7 +201,8 @@  class verifier(object):
                         progress=None):
         repo = self.repo
         ui = self.ui
-        mf = self.repo.manifest.dirlog(dir)
+        mf = self.repo.manifestlog._revlog.dirlog(dir)
+        mfl = self.repo.manifestlog
 
         if not dir:
             self.ui.status(_("checking manifests\n"))
@@ -235,7 +236,8 @@  class verifier(object):
                 self.err(lr, _("%s not in changesets") % short(n), label)
 
             try:
-                for f, fn, fl in mf.readshallowdelta(n).iterentries():
+                mfdelta = mfl.get(dir, n).readdelta(shallow=True)
+                for f, fn, fl in mfdelta.iterentries():
                     if not f:
                         self.err(lr, _("entry without name in manifest"))
                     elif f == "/dev/null":  # ignore this in very old repos