Patchwork dirstate: add docstring for invalidate

login
register
mail settings
Submitter Siddharth Agarwal
Date June 4, 2017, 11:09 p.m.
Message ID <45841cedb603b93803ee.1496617742@devvm31800.prn1.facebook.com>
Download mbox | patch
Permalink /patch/21179/
State Accepted
Headers show

Comments

Siddharth Agarwal - June 4, 2017, 11:09 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1496617730 25200
#      Sun Jun 04 16:08:50 2017 -0700
# Node ID 45841cedb603b93803eec37bd7d01456a6b8e812
# Parent  5277d6faabb4f9593a5d33cdab6c4a6191ad856d
dirstate: add docstring for invalidate

This always confuses me, and we already have a docstring on
localrepo.invalidatedirstate.
Pierre-Yves David - June 4, 2017, 11:24 p.m.
On 06/05/2017 12:09 AM, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1496617730 25200
> #      Sun Jun 04 16:08:50 2017 -0700
> # Node ID 45841cedb603b93803eec37bd7d01456a6b8e812
> # Parent  5277d6faabb4f9593a5d33cdab6c4a6191ad856d
> dirstate: add docstring for invalidate
>
> This always confuses me, and we already have a docstring on
> localrepo.invalidatedirstate.

That look good to me.

>
> diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
> --- a/mercurial/dirstate.py
> +++ b/mercurial/dirstate.py
> @@ -470,6 +470,12 @@ class dirstate(object):
>              self._pl = p
>
>      def invalidate(self):
> +        '''Causes the next access to reread the dirstate.
> +
> +        This is different from localrepo.invalidatedirstate() because it always
> +        rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
> +        check whether the dirstate has changed before rereading it.'''
> +
>          for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch",
>                    "_pl", "_dirs", "_ignore", "_nonnormalset",
>                    "_otherparentset"):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Augie Fackler - June 5, 2017, 2:11 p.m.
On Sun, Jun 04, 2017 at 04:09:02PM -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1496617730 25200
> #      Sun Jun 04 16:08:50 2017 -0700
> # Node ID 45841cedb603b93803eec37bd7d01456a6b8e812
> # Parent  5277d6faabb4f9593a5d33cdab6c4a6191ad856d
> dirstate: add docstring for invalidate

queued, thanks

>
> This always confuses me, and we already have a docstring on
> localrepo.invalidatedirstate.
>
> diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
> --- a/mercurial/dirstate.py
> +++ b/mercurial/dirstate.py
> @@ -470,6 +470,12 @@ class dirstate(object):
>              self._pl = p
>
>      def invalidate(self):
> +        '''Causes the next access to reread the dirstate.
> +
> +        This is different from localrepo.invalidatedirstate() because it always
> +        rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
> +        check whether the dirstate has changed before rereading it.'''
> +
>          for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch",
>                    "_pl", "_dirs", "_ignore", "_nonnormalset",
>                    "_otherparentset"):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -470,6 +470,12 @@  class dirstate(object):
             self._pl = p
 
     def invalidate(self):
+        '''Causes the next access to reread the dirstate.
+
+        This is different from localrepo.invalidatedirstate() because it always
+        rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
+        check whether the dirstate has changed before rereading it.'''
+
         for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch",
                   "_pl", "_dirs", "_ignore", "_nonnormalset",
                   "_otherparentset"):