[PATCH 1 of 3 manifest-cleanup] manifest: move manifestdict-to-text encoding to manifest class

Augie Fackler raf at durin42.com
Thu Oct 9 08:11:18 CDT 2014


I *think* this series is close to being able to start the actual work
on a new manifest format as (loosely) discussed in
https://titanpad.com/mercurial32-manifest-sharding, for anyone curious
where this is going (I wanted feedback on this interface relatively
early, since I'm hoping it needs only minor tweaks and I'd like to
avoid extra churn.)

On Thu, Oct 9, 2014 at 9:08 AM, Augie Fackler <raf at durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <raf at durin42.com>
> # Date 1412794050 14400
> #      Wed Oct 08 14:47:30 2014 -0400
> # Node ID 0255f395b1cfd4889711a727b0ce6fa214eef6b2
> # Parent  379c09b0052abc93ebe549d8d97d422f1e1076cf
> manifest: move manifestdict-to-text encoding to manifest class
>
> A future patch will introduce a new format, with a new class.
>
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -40,6 +40,14 @@
>      def flagsdiff(self, d2):
>          return dicthelpers.diff(self._flags, d2._flags, "")
>
> +    def text(self):
> +        fl = sorted(self)
> +        _checkforbidden(fl)
> +
> +        hex, flags = revlog.hex, self.flags
> +        # if this is changed to support newlines in filenames,
> +        # be sure to check the templates/ dir again (especially *-raw.tmpl)
> +        return ''.join("%s\0%s%s\n" % (f, hex(self[f]), flags(f)) for f in fl)
>
>  def _checkforbidden(l):
>      """Check filenames for illegal characters."""
> @@ -220,14 +228,7 @@
>              # just encode a fulltext of the manifest and pass that
>              # through to the revlog layer, and let it handle the delta
>              # process.
> -            files = sorted(map)
> -            _checkforbidden(files)
> -
> -            # if this is changed to support newlines in filenames,
> -            # be sure to check the templates/ dir again (especially *-raw.tmpl)
> -            hex, flags = revlog.hex, map.flags
> -            text = ''.join("%s\0%s%s\n" % (f, hex(map[f]), flags(f))
> -                           for f in files)
> +            text = map.text()
>              arraytext = array.array('c', text)
>              cachedelta = None
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list