[PATCH 2 of 2 v4] manifest: disallow setting the node id of an entry to None

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Dec 16 21:09:29 CST 2014



On 12/16/2014 05:42 PM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1418409644 18000
> #      Fri Dec 12 13:40:44 2014 -0500
> # Node ID 0b7066a0df91e1d6f1e376be114c3e62f21f9ccf
> # Parent  e94a559756f2c4e17e778f9be68e33b380140b7e
> manifest: disallow setting the node id of an entry to None
>
> manifest.diff() uses None as a special value to denote the absence of
> a file, so setting a file node to None means you then can't trust
> manifest.diff().
>
> This should also make future manifest work slightly easier.

This is pushed to the clowncopter after replacing "nullid" with magic 
value in first patch description.



>
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -17,6 +17,9 @@ class manifestdict(dict):
>               flags = {}
>           dict.__init__(self, mapping)
>           self._flags = flags
> +    def __setitem__(self, k, v):
> +        assert v is not None
> +        dict.__setitem__(self, k, v)
>       def flags(self, f):
>           return self._flags.get(f, "")
>       def withflags(self):
> _______________________________________________
> 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