# HG changeset patch # User Sean Farley # Date 2013-08-12 03:46:54 # Node ID e86a594ab11f82bcca8e987c7dc6fd2653379d7b # Parent 964844d64ef8fdb02cc5330f70a1acab158fdfb7 basefilectx: move __repr__ from filectx We change the hardcoded 'filectx' to instead use type(self).__name__ so that objects that inherit from basefilectx in the future will be able to use the same representation. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -458,6 +458,9 @@ class basefilectx(object): def __str__(self): return "%s@%s" % (self.path(), short(self.node())) + def __repr__(self): + return "<%s %s>" % (type(self).__name__, str(self)) + class filectx(basefilectx): """A filecontext object makes access to data related to a particular filerevision convenient.""" @@ -507,9 +510,6 @@ class filectx(basefilectx): # considered when solving linkrev issue are on the table. return changectx(self._repo.unfiltered(), self._changeid) - def __repr__(self): - return "" % str(self) - def __hash__(self): try: return hash((self._path, self._filenode))