Skip to content
Snippets Groups Projects
Commit b19291e5d506 authored by Durham Goode's avatar Durham Goode
Browse files

manifest: add __nonzero__ method

This adds a __nonzero__ method to manifestdict. This isn't strictly necessary in
the vanilla Mercurial implementation, since Python will handle nonzero checks by
using __len__, but having it implemented here makes it easier for alternative
implementations to implement __nonzero__ and have them be plug-n-play with the
normal implementation.
parent a2f2f694dce9
No related branches found
No related tags found
No related merge requests found
...@@ -422,6 +422,11 @@ ...@@ -422,6 +422,11 @@
def __len__(self): def __len__(self):
return len(self._lm) return len(self._lm)
def __nonzero__(self):
# nonzero is covered by the __len__ function, but implementing it here
# makes it easier for extensions to override.
return len(self._lm) != 0
def __setitem__(self, key, node): def __setitem__(self, key, node):
self._lm[key] = node, self.flags(key, '') self._lm[key] = node, self.flags(key, '')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment