[PATCH 2 of 4] revlog: tweak wording and logic for flags validation

Gregory Szorc gregory.szorc at gmail.com
Sun May 21 21:14:35 EDT 2017


On Sun, May 21, 2017 at 5:24 AM, Yuya Nishihara <yuya at tcha.org> wrote:

> On Fri, 19 May 2017 20:58:58 -0700, Gregory Szorc wrote:
> > # HG changeset patch
> > # User Gregory Szorc <gregory.szorc at gmail.com>
> > # Date 1495249850 25200
> > #      Fri May 19 20:10:50 2017 -0700
> > # Node ID 26a43d84eb714ee6bba04f21c0264ded9215a3bd
> > # Parent  40748da9c7c56836f815582cf9a367097755859d
> > revlog: tweak wording and logic for flags validation
>
> > --- a/mercurial/revlog.py
> > +++ b/mercurial/revlog.py
> > @@ -326,15 +326,19 @@ class revlog(object):
> >          self._generaldelta = v & FLAG_GENERALDELTA
> >          flags = v & ~0xFFFF
> >          fmt = v & 0xFFFF
> > -        if fmt == REVLOGV0 and flags:
> > -            raise RevlogError(_("index %s unknown flags %#04x for
> format v0")
> > -                              % (self.indexfile, flags >> 16))
> > -        elif fmt == REVLOGV1 and flags & ~REVLOGV1_FLAGS:
> > -            raise RevlogError(_("index %s unknown flags %#04x for
> revlogng")
> > -                              % (self.indexfile, flags >> 16))
> > +        if fmt == REVLOGV0:
> > +            if flags:
> > +                raise RevlogError(_('unknown flags (%#04x) in version
> %d '
> > +                                    'revlog %s') %
> > +                                    (flags >> 16, fmt, self.indexfile))
> > +        elif fmt == REVLOGV1:
> > +            if flags & ~REVLOGV1_FLAGS:
> > +                raise RevlogError(_('unknown flags (%#04x) in version
> %d '
> > +                                    'revlog %s') %
> > +                                  (flags >> 16, fmt, self.indexfile))
> >          elif fmt > REVLOGV1:
>
> Nit: maybe this could simply be "else:".
>

I agree.

Since these haven't been pushed to hg-committed, can you change in flight?


>
> > -            raise RevlogError(_("index %s unknown format %d")
> > -                              % (self.indexfile, fmt))
> > +            raise RevlogError(_('unknown version (%d) in revlog %s') %
> > +                              (fmt, self.indexfile))
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170521/36bef3f7/attachment.html>


More information about the Mercurial-devel mailing list