[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r36822 - in trunk: subversion/bindings/swig/python/svn subversion/tests/cmdline/svntest tools/dev

From: Greg Stein <gstein_at_gmail.com>
Date: Sat, 28 Mar 2009 18:15:39 +0100

-1

this makes the code *very* unreadable. cmp() is clean.

On Sat, Mar 28, 2009 at 16:30, Arfrever Frehtes Taifersar Arahesis
<Arfrever.FTA_at_gmail.com> wrote:
> Author: arfrever
> Date: Sat Mar 28 08:30:10 2009
> New Revision: 36822
>
> Log:
> Python 3 compatibility:
> Don't use cmp().
>
> * subversion/bindings/swig/python/svn/core.py:
> * subversion/tests/cmdline/svntest/tree.py:
> * tools/dev/contribulyze.py:
> * tools/dev/trails.py: Don't use cmp().
>
> Modified:
>   trunk/subversion/bindings/swig/python/svn/core.py
>   trunk/subversion/tests/cmdline/svntest/tree.py
>   trunk/tools/dev/contribulyze.py
>   trunk/tools/dev/trails.py
>
> Modified: trunk/subversion/bindings/swig/python/svn/core.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/python/svn/core.py?pathrev=36822&r1=36821&r2=36822
> ==============================================================================
> --- trunk/subversion/bindings/swig/python/svn/core.py   Sat Mar 28 08:21:55 2009        (r36821)
> +++ trunk/subversion/bindings/swig/python/svn/core.py   Sat Mar 28 08:30:10 2009        (r36822)
> @@ -121,7 +121,7 @@ def svn_path_compare_paths(path1, path2)
>
>   # Common prefix was skipped above, next character is compared to
>   # determine order
> -  return cmp(char1, char2)
> +  return (char1 > char2) - (char1 < char2)
>
>  def svn_mergeinfo_merge(mergeinfo, changes):
>   return _libsvncore.svn_swig_mergeinfo_merge(mergeinfo, changes)
>
> Modified: trunk/subversion/tests/cmdline/svntest/tree.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/svntest/tree.py?pathrev=36822&r1=36821&r2=36822
> ==============================================================================
> --- trunk/subversion/tests/cmdline/svntest/tree.py      Sat Mar 28 08:21:55 2009        (r36821)
> +++ trunk/subversion/tests/cmdline/svntest/tree.py      Sat Mar 28 08:30:10 2009        (r36822)
> @@ -280,7 +280,7 @@ class SVNTreeNode:
>     """Define a simple ordering of two nodes without regard to their full
>     path (i.e. position in the tree). This can be used for sorting the
>     children within a directory."""
> -    return cmp(self.name, other.name)
> +    return (self.name > other.name) - (self.name < other.name)
>
>   def as_state(self, prefix=None):
>     root = self
>
> Modified: trunk/tools/dev/contribulyze.py
> URL: http://svn.collab.net/viewvc/svn/trunk/tools/dev/contribulyze.py?pathrev=36822&r1=36821&r2=36822
> ==============================================================================
> --- trunk/tools/dev/contribulyze.py     Sat Mar 28 08:21:55 2009        (r36821)
> +++ trunk/tools/dev/contribulyze.py     Sat Mar 28 08:30:10 2009        (r36822)
> @@ -235,9 +235,9 @@ class Contributor:
>       return 1
>     if other.is_full_committer and not self.is_full_committer:
>       return -1
> -    result = cmp(self.score(), other.score())
> +    result = (self.score() > other.score()) - (self.score() < other.score())
>     if result == 0:
> -      return cmp(self.big_name(), other.big_name())
> +      return (self.big_name() > other.big_name()) - (self.big_name() < other.big_name())
>     else:
>       return 0 - result
>
>
> Modified: trunk/tools/dev/trails.py
> URL: http://svn.collab.net/viewvc/svn/trunk/tools/dev/trails.py?pathrev=36822&r1=36821&r2=36822
> ==============================================================================
> --- trunk/tools/dev/trails.py   Sat Mar 28 08:21:55 2009        (r36821)
> +++ trunk/tools/dev/trails.py   Sat Mar 28 08:30:10 2009        (r36822)
> @@ -74,9 +74,9 @@ def output_summary(trails, outfile):
>  def _freqtable_cmp(a_b, c_d):
>   (a, b) = a_b
>   (c, d) = c_d
> -  c = cmp(d, b)
> +  c = (d > b) - (d < b)
>   if not c:
> -    c = cmp(a, c)
> +    c = (a > c) - (a < c)
>   return c
>
>  def list_frequencies(list):
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1457409
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1458567
Received on 2009-03-28 18:15:55 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.