[PATCH 05 of 11] filectx: remove __new__

Sean Farley sean at farley.io
Wed May 10 13:18:18 EDT 2017


Jun Wu <quark at fb.com> writes:

> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1494382608 25200
> #      Tue May 09 19:16:48 2017 -0700
> # Node ID f736ea580edbf4ec199b55af586b31f2798cbee4
> # Parent  b022d125236c47e07db6209e4de648bb70a8de65
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r f736ea580edb
> filectx: remove __new__
>
> It does not seem to be used anywhere, and breaks a later patch.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -689,7 +689,4 @@ class basefilectx(object):
>                      directory,
>      memfilectx: a filecontext that represents files in-memory."""
> -    def __new__(cls, repo, path, *args, **kwargs):
> -        return super(basefilectx, cls).__new__(cls)
> -

I remember writing __new__ for basectx due to mpm and I talking about
fast-pathing reusing a ctx without duplicating it. As for filectx, I
seem to recall wanting to do something similar for self.data but ran
into issues of cyclic dependencies later down the line.

So, yes, this patch seems fine to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170510/a60cc272/attachment.sig>


More information about the Mercurial-devel mailing list