[PATCH] committablectx: extra is already normalized

Yuya Nishihara yuya at tcha.org
Fri Jun 2 22:35:45 EDT 2017


On Wed, 31 May 2017 17:11:57 -0700, Jun Wu wrote:
> Looks good to me. I'd mention extra is normalized by "changelog.add" in
> commit message.

Perhaps this should say "normalized by committablectx.__init__". changelog.py
normalizes extra in inverse direction.

> Excerpts from Sean Farley's message of 2017-05-31 15:54:24 -0700:
> > # HG changeset patch
> > # User Sean Farley <sean at farley.io>
> > # Date 1494535870 25200
> > #      Thu May 11 13:51:10 2017 -0700
> > # Branch wctxds
> > # Node ID 60b3e8946da728c377a3a6aadb785ae308084614
> > # Parent  5313d98089f569efffaca25de60e73be04156713
> > committablectx: extra is already normalized
> > 
> > Avoid doing the same work again. Based on work done by Mads Kiilerix.
> > 
> > diff --git a/mercurial/context.py b/mercurial/context.py
> > index f1014ab..e2994e7 100644
> > --- a/mercurial/context.py
> > +++ b/mercurial/context.py
> > @@ -2077,18 +2077,10 @@ class memctx(committablectx):
> >              self._filectxfn = getfilectx
> >          else:
> >              # memoizing increases performance for e.g. vcs convert scenarios.
> >              self._filectxfn = makecachingfilectxfn(filectxfn)
> >  
> > -        if extra:
> > -            self._extra = extra.copy()
> > -        else:
> > -            self._extra = {}
> > -
> > -        if self._extra.get('branch', '') == '':
> > -            self._extra['branch'] = 'default'


More information about the Mercurial-devel mailing list