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

Matt Mackall mpm at selenic.com
Wed Dec 23 15:34:01 CST 2015


On Wed, 2015-12-23 at 21:05 +0000, Laurent Charignon wrote:
> Sounds good, I will do that, I understand the motivation behind it.
> 
> Thanks,
> 
> Laurent
> 
> On Dec 22, 2015, at 2:01 PM, Martin von Zweigbergk <martinvonz at google.com<mail
> to:martinvonz at google.com>> wrote:
> 
> Here's a diff that shows what I meant. Sorry if gmail/inbox messes up the
> whitespace.
> 
> --- a/mercurial/dirstate.py     Mon Dec 21 16:27:34 2015 -0800
> +++ b/mercurial/dirstate.py     Tue Dec 22 14:00:12 2015 -0800
> @@ -128,8 +128,7 @@ class dirstate(object):
> 
>      @propertycache
>      def _nonnormalset(self):
> -        self._read()
> -        return self._nonnormalset
> +        return nonnomalentries(self._map)
> 
>      @propertycache
>      def _filefoldmap(self):
> @@ -386,7 +385,6 @@ class dirstate(object):
>      def _read(self):
>          self._map = {}
>          self._copymap = {}
> -        self._nonnormalset = set()
>          try:
>              fp = self._opendirstatefile()
>              try:
> @@ -427,7 +425,6 @@ class dirstate(object):
>          # (we cannot decorate the function directly since it is in a C
> module)
>          parse_dirstate = util.nogc(parsers.parse_dirstate)
>          p = parse_dirstate(self._map, self._copymap, st)
> -        self._nonnormalset = nonnomalentries(self._map)
>          if not self._dirtypl:
>              self._pl = p

I should have been more explicit about this in my earlier reply, but we should
be breaking up reading and parsing. Currently we have _read() which does it all,
but this makes it hard to be lazy. That's why my earlier reply doesn't have
_read(), but instead has _load() and _data.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list