[PATCH 4 of 7 V6] dirstate: attach the nonnormalset to a propertycache

Martin von Zweigbergk martinvonz at google.com
Tue Dec 22 10:23:13 CST 2015


On Mon, Dec 21, 2015 at 4:36 PM Laurent Charignon <lcharignon at fb.com> wrote:

> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1450743882 28800
> #      Mon Dec 21 16:24:42 2015 -0800
> # Node ID d3209dc5c211a7c937b68a4712dd77bc3ec978e1
> # Parent  1be21e4798cd66383e8f63eafe84a3e32ef4b8d9
> dirstate: attach the nonnormalset to a propertycache
>
> This patch attaches the nonnormalset to a property cache so that we build
> it
> only when needed.
>
> diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
> --- a/mercurial/dirstate.py
> +++ b/mercurial/dirstate.py
> @@ -124,6 +124,11 @@ class dirstate(object):
>          return self._copymap
>
>      @propertycache
> +    def _nonnormalset(self):
> +        self._read()
> +        return self._nonnormalset
>

I would have expected "return self.nonnomalentries(self._dmap)".
@propertycache makes the first access to dirstate._nonnormalset call this
function, then it replaces the function by the returned value, so future
calls will just access the value. You can (and should) probably also remove
the assignment of self._nonnormalset in the initializer. I don't know
Python well enough to say for sure, but I'd guess that replaces the
self._nonnormalset object created by @propertycache.



> +
> +    @propertycache
>      def _filefoldmap(self):
>          try:
>              makefilefoldmap = parsers.make_file_foldmap
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20151222/cd302689/attachment.html>


More information about the Mercurial-devel mailing list