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

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2013, 11:51 p.m.
Message ID <01254518b9859d737b30.1375919483@laptop.local>
Download mbox | patch
Permalink /patch/2062/
State Accepted
Headers show

Comments

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

Patch

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: