[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: Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA_at_GMail.Com>
Date: Sun, 29 Mar 2009 06:41:12 +0100

2009-03-28 18:15:39 Greg Stein napisaƂ(a):
> -1
>
> this makes the code *very* unreadable.

It is/was temporary.

> cmp() is clean.

cmp() is dead :) .

In r36833 I deleted the remnants of cmp() in subversion/tests/cmdline/svntest/tree.py
and tools/dev/contribulyze.py. In tools/dev/trails.py cmp() was used in _freqtable_cmp()
which is used as 'cmp' argument of sort(). In Python 3 sort() doesn't have this argument,
so _freqtable_cmp() will have to be deleted. Not using of 'cmp' argument of sort() in
'tools' directory is one of items on my TODO list. You can use the following command:

grep -Er '\.sort\([^\)]+\)' . | grep -v /\.svn/ | grep -Ev '\.sort\(key[[:space:]]*='
 
> 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):
> >

-- 
Arfrever Frehtes Taifersar Arahesis

Received on 2009-03-29 07:42:08 CEST

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