[PATCH 1 of 2 v2] context: stop setting None for modified or added nodes

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Dec 15 12:45:43 CST 2014



On 12/15/2014 09:59 AM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1418416194 18000
> #      Fri Dec 12 15:29:54 2014 -0500
> # Node ID 85f3187042f6fe3db123b17b87f4f0b290a47c02
> # Parent  65c854f92d6ba8861414ff3191182fba28777a82
> context: stop setting None for modified or added nodes

IS this related to the recent change from IOError to None for deleted 
file that mads did or is this a distinct logic?


>
> Instead use a modified nullid, so that we can identify modified or
> added nodes correctly when using manifest.diff().
>
> Thanks to Martin von Zweigbergk for catching that we have to update
> _buildstatus as well. That part eluded my debugging for some time.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -17,6 +17,8 @@ import revlog
>
>   propertycache = util.propertycache
>
> +_newnode = nullid + '!'
> +
>   class basectx(object):
>       """A basectx object represents the common logic for its children:
>       changectx: read-only context that is already present in the repo,
> @@ -104,7 +106,7 @@ class basectx(object):
>                   if (fn not in deletedset and
>                       ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
>                        (mf1[fn] != mf2node and
> -                      (mf2node or self[fn].cmp(other[fn]))))):
> +                      (mf2node is not _newnode or self[fn].cmp(other[fn]))))):
>                       modified.append(fn)
>                   elif listclean:
>                       clean.append(fn)
> @@ -1387,7 +1389,7 @@ class workingctx(committablectx):
>           """
>           mf = self._repo['.']._manifestmatches(match, s)
>           for f in s.modified + s.added:
> -            mf[f] = None
> +            mf[f] = _newnode
>               mf.setflag(f, self.flags(f))
>           for f in s.removed:
>               if f in mf:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list