[PATCH] committablectx: extra is already normalized

Augie Fackler raf at durin42.com
Thu Jun 1 14:24:40 UTC 2017


On Wed, May 31, 2017 at 03:54:24PM -0700, Sean Farley wrote:
> # 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

queued with a wording tweak per junw, thanks

>
> 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'
> -
>          if editor:
>              self._text = editor(self._repo, self, [])
>              self._repo.savecommitmessage(self._text)
>
>      def filectx(self, path, filelog=None):
> @@ -2297,18 +2289,10 @@ class metadataonlyctx(committablectx):
>                                 'its p2 doesn\'t match the new ctx p2')
>
>          self._files = originalctx.files()
>          self.substate = {}
>
> -        if extra:
> -            self._extra = extra.copy()
> -        else:
> -            self._extra = {}
> -
> -        if self._extra.get('branch', '') == '':
> -            self._extra['branch'] = 'default'
> -
>          if editor:
>              self._text = editor(self._repo, self, [])
>              self._repo.savecommitmessage(self._text)
>
>      def manifestnode(self):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list