##// END OF EJS Templates
context: add __int__ and hex methods
Matt Mackall -
r6763:403682f1 default
parent child Browse files
Show More
@@ -5,7 +5,7 b''
5 # This software may be used and distributed according to the terms
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
6 # of the GNU General Public License, incorporated herein by reference.
7
7
8 from node import nullid, nullrev, short
8 from node import nullid, nullrev, short, hex
9 from i18n import _
9 from i18n import _
10 import ancestor, bdiff, revlog, util, os, errno
10 import ancestor, bdiff, revlog, util, os, errno
11
11
@@ -23,6 +23,9 b' class changectx(object):'
23 def __str__(self):
23 def __str__(self):
24 return short(self.node())
24 return short(self.node())
25
25
26 def __int__(self):
27 return self.rev()
28
26 def __repr__(self):
29 def __repr__(self):
27 return "<changectx %s>" % str(self)
30 return "<changectx %s>" % str(self)
28
31
@@ -79,6 +82,7 b' class changectx(object):'
79
82
80 def rev(self): return self._rev
83 def rev(self): return self._rev
81 def node(self): return self._node
84 def node(self): return self._node
85 def hex(self): return hex(self._node)
82 def user(self): return self._changeset[1]
86 def user(self): return self._changeset[1]
83 def date(self): return self._changeset[2]
87 def date(self): return self._changeset[2]
84 def files(self): return self._changeset[3]
88 def files(self): return self._changeset[3]
@@ -693,6 +697,9 b' class memctx(object):'
693 def __str__(self):
697 def __str__(self):
694 return str(self._parents[0]) + "+"
698 return str(self._parents[0]) + "+"
695
699
700 def __int__(self):
701 return self._rev
702
696 def __nonzero__(self):
703 def __nonzero__(self):
697 return True
704 return True
698
705
General Comments 0
You need to be logged in to leave comments. Login now