[PATCH 09 of 35 V2] context: move __int__ from changectx

Sean Farley sean.michael.farley at gmail.com
Wed Aug 7 18:51:23 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1375480333 18000
#      Fri Aug 02 16:52:13 2013 -0500
# Node ID 01254518b9859d737b30c24db261dd2134db54e0
# Parent  8e61e1dca824364f6ddc0df2ddbc7586871c4c80
context: move __int__ from changectx

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -36,10 +36,13 @@
         return o
 
     def __str__(self):
         return short(self.node())
 
+    def __int__(self):
+        return self.rev()
+
     def rev(self):
         return self._rev
     def node(self):
         return self._node
     def hex(self):
@@ -148,13 +151,10 @@
         except TypeError:
             pass
         raise error.RepoLookupError(
             _("unknown revision '%s'") % changeid)
 
-    def __int__(self):
-        return self.rev()
-
     def __repr__(self):
         return "<changectx %s>" % str(self)
 
     def __hash__(self):
         try:


More information about the Mercurial-devel mailing list