--- a/mercurial/context.py Fri Jun 27 18:28:45 2008 -0500
+++ b/mercurial/context.py Fri Jun 27 18:44:43 2008 -0500
@@ -5,7 +5,7 @@
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
-from node import nullid, nullrev, short
+from node import nullid, nullrev, short, hex
from i18n import _
import ancestor, bdiff, revlog, util, os, errno
@@ -23,6 +23,9 @@
def __str__(self):
return short(self.node())
+ def __int__(self):
+ return self.rev()
+
def __repr__(self):
return "<changectx %s>" % str(self)
@@ -79,6 +82,7 @@
def rev(self): return self._rev
def node(self): return self._node
+ def hex(self): return hex(self._node)
def user(self): return self._changeset[1]
def date(self): return self._changeset[2]
def files(self): return self._changeset[3]
@@ -693,6 +697,9 @@
def __str__(self):
return str(self._parents[0]) + "+"
+ def __int__(self):
+ return self._rev
+
def __nonzero__(self):
return True