From 4ac4bb63b23a9ff807addde697f947e32e93f21f Mon Sep 17 00:00:00 2001 From: Laurento Frittella Date: Sun, 22 May 2011 10:39:32 +0200 Subject: [PATCH] Fixed equality operator for Node class This is not necessarily the best way to do it, but it is better than just comparing the name. See https://groups.google.com/d/topic/bup-list/GvwzsmOU1p4/discussion --- lib/bup/vfs.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/bup/vfs.py b/lib/bup/vfs.py index 454355337..31327c57d 100644 --- a/lib/bup/vfs.py +++ b/lib/bup/vfs.py @@ -175,6 +175,14 @@ def __init__(self, parent, name, mode, hash): def __cmp__(a, b): return cmp(a and a.name or None, b and b.name or None) + def __eq__(self, other): + if hasattr(other, 'hash'): + return self.hash == other.hash + return self.hash == other + + def __ne__(self, other): + return not self.__eq__(other) + def __iter__(self): return iter(self.subs())