Mercurial > hg-stable
comparison mercurial/context.py @ 3166:ebdb3f616bc0
Add str methods to contexts
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 29 Sep 2006 16:29:44 -0500 |
parents | e78185746554 |
children | 05c588e1803d |
comparison
equal
deleted
inserted
replaced
3165:e78185746554 | 3166:ebdb3f616bc0 |
---|---|
25 self._node = p1 | 25 self._node = p1 |
26 return | 26 return |
27 | 27 |
28 self._node = self._repo.lookup(changeid) | 28 self._node = self._repo.lookup(changeid) |
29 self._rev = self._repo.changelog.rev(self._node) | 29 self._rev = self._repo.changelog.rev(self._node) |
30 | |
31 def __str__(self): | |
32 return short(self.node()) | |
30 | 33 |
31 def __repr__(self): | 34 def __repr__(self): |
32 return "<changectx %s>" % short(self.node()) | 35 return "<changectx %s>" % short(self.node()) |
33 | 36 |
34 def __eq__(self, other): | 37 def __eq__(self, other): |
123 elif name == '_filerev': | 126 elif name == '_filerev': |
124 self._filerev = self._filelog.rev(self._filenode) | 127 self._filerev = self._filelog.rev(self._filenode) |
125 return self._filerev | 128 return self._filerev |
126 else: | 129 else: |
127 raise AttributeError, name | 130 raise AttributeError, name |
131 | |
132 def __str__(self): | |
133 return "%s@%s" % (self.path(), short(self.node())) | |
128 | 134 |
129 def __repr__(self): | 135 def __repr__(self): |
130 return "<filectx %s@%s>" % (self.path(), short(self.node())) | 136 return "<filectx %s@%s>" % (self.path(), short(self.node())) |
131 | 137 |
132 def __eq__(self, other): | 138 def __eq__(self, other): |