diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1047,6 +1047,9 @@ def grep(ui, repo, pattern, *pats, **opt self.colstart = colstart self.colend = colend + def __hash__(self): + return hash((self.linenum, self.line)) + def __eq__(self, other): return self.line == other.line diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -34,6 +34,12 @@ class changectx(object): def __repr__(self): return "" % str(self) + def __hash__(self): + try: + return hash(self._rev) + except AttributeError: + return id(self) + def __eq__(self, other): try: return self._rev == other._rev @@ -210,6 +216,12 @@ class filectx(object): def __repr__(self): return "" % str(self) + def __hash__(self): + try: + return hash((self._path, self._fileid)) + except AttributeError: + return id(self) + def __eq__(self, other): try: return (self._path == other._path