Patchwork [09,of,36] context: move __repr__ from changectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2013, 6:13 p.m.
Message ID <8d5fbb6e08357ca42b14.1375899189@laptop.local>
Download mbox | patch
Permalink /patch/2026/
State Superseded
Commit 89b4b6565025067d077e9ad367a926315576cbfd
Delegated to: Augie Fackler
Headers show

Comments

Sean Farley - Aug. 7, 2013, 6:13 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1375480357 18000
#      Fri Aug 02 16:52:37 2013 -0500
# Node ID 8d5fbb6e08357ca42b140eaea1d3aaa72d10aec5
# Parent  24cb20d7bce4cee55bb91af047a901841fdfdd6d
context: move __repr__ from changectx
Augie Fackler - Aug. 7, 2013, 6:26 p.m.
On Wed, Aug 07, 2013 at 01:13:09PM -0500, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1375480357 18000
> #      Fri Aug 02 16:52:37 2013 -0500
> # Node ID 8d5fbb6e08357ca42b140eaea1d3aaa72d10aec5
> # Parent  24cb20d7bce4cee55bb91af047a901841fdfdd6d
> context: move __repr__ from changectx
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -39,10 +39,13 @@
>          return short(self.node())
>
>      def __int__(self):
>          return self.rev()
>
> +    def __repr__(self):
> +        return "<changectx %s>" % str(self)

probably should be: '%s %s' % (self.__class__.__name__, str(self))

> +
>      def rev(self):
>          return self._rev
>      def node(self):
>          return self._node
>      def hex(self):
> @@ -145,13 +148,10 @@
>          except TypeError:
>              pass
>          raise error.RepoLookupError(
>              _("unknown revision '%s'") % changeid)
>
> -    def __repr__(self):
> -        return "<changectx %s>" % str(self)
> -
>      def __hash__(self):
>          try:
>              return hash(self._rev)
>          except AttributeError:
>              return id(self)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

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