Mercurial > hg-stable
changeset 19580:e86a594ab11f
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.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sun, 11 Aug 2013 22:46:54 -0500 |
parents | 964844d64ef8 |
children | fe50d21be01a |
files | mercurial/context.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Sun Aug 11 22:45:30 2013 -0500 +++ b/mercurial/context.py Sun Aug 11 22:46:54 2013 -0500 @@ -458,6 +458,9 @@ 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 @@ # considered when solving linkrev issue are on the table. return changectx(self._repo.unfiltered(), self._changeid) - def __repr__(self): - return "<filectx %s>" % str(self) - def __hash__(self): try: return hash((self._path, self._filenode))