mirror of
https://github.com/facebook/sapling.git
synced 2025-01-08 14:46:47 +03:00
basefilectx: move __eq__ from filectx
We also add type checking for extra protection.
This commit is contained in:
parent
cb1cda0d9a
commit
56f8d7a94b
@ -467,6 +467,13 @@ class basefilectx(object):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
return id(self)
|
return id(self)
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
try:
|
||||||
|
return (type(self) == type(other) and self._path == other._path
|
||||||
|
and self._filenode == other._filenode)
|
||||||
|
except AttributeError:
|
||||||
|
return False
|
||||||
|
|
||||||
class filectx(basefilectx):
|
class filectx(basefilectx):
|
||||||
"""A filecontext object makes access to data related to a particular
|
"""A filecontext object makes access to data related to a particular
|
||||||
filerevision convenient."""
|
filerevision convenient."""
|
||||||
@ -516,13 +523,6 @@ class filectx(basefilectx):
|
|||||||
# considered when solving linkrev issue are on the table.
|
# considered when solving linkrev issue are on the table.
|
||||||
return changectx(self._repo.unfiltered(), self._changeid)
|
return changectx(self._repo.unfiltered(), self._changeid)
|
||||||
|
|
||||||
def __eq__(self, other):
|
|
||||||
try:
|
|
||||||
return (self._path == other._path
|
|
||||||
and self._filenode == other._filenode)
|
|
||||||
except AttributeError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not (self == other)
|
return not (self == other)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user