Mercurial > kallithea
comparison rhodecode/lib/vcs/backends/base.py @ 3692:5f9f4ece4b52 beta
added __eq__ operation on vcs Repository objects
- eq compare if objects are same class and have the same path
- fixes some issues introduced after @LazyProperty was removed from scm_instance
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 05 Apr 2013 19:42:07 +0200 |
parents | 238486bb71ab |
children | e45f8cefd7d9 |
comparison
equal
deleted
inserted
replaced
3691:9b18950fa229 | 3692:5f9f4ece4b52 |
---|---|
77 def __repr__(self): | 77 def __repr__(self): |
78 return self.__str__() | 78 return self.__str__() |
79 | 79 |
80 def __len__(self): | 80 def __len__(self): |
81 return self.count() | 81 return self.count() |
82 | |
83 def __eq__(self, other): | |
84 same_instance = isinstance(other, self.__class__) | |
85 return same_instance and getattr(other, 'path', None) == self.path | |
82 | 86 |
83 @LazyProperty | 87 @LazyProperty |
84 def alias(self): | 88 def alias(self): |
85 for k, v in settings.BACKENDS.items(): | 89 for k, v in settings.BACKENDS.items(): |
86 if v.split('.')[-1] == str(self.__class__.__name__): | 90 if v.split('.')[-1] == str(self.__class__.__name__): |