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

Re: svn commit: r37008 - trunk/subversion/tests/cmdline/svntest

From: Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA_at_GMail.Com>
Date: Sun, 5 Apr 2009 14:29:56 +0200

2009-04-05 09:58:22 Bert Huijben napisaƂ(a):
> > -----Original Message-----
> > From: Arfrever Frehtes Taifersar Arahesis
> > [mailto:Arfrever.FTA_at_GMail.Com]
> > Sent: Sunday, April 05, 2009 3:18 AM
> > To: svn_at_subversion.tigris.org
> > Subject: svn commit: r37008 - trunk/subversion/tests/cmdline/svntest
> >
> > Author: arfrever
> > Date: Sat Apr 4 18:17:40 2009
> > New Revision: 37008
> >
> > Log:
> > Follow-up to r37006:
> >
> > * subversion/tests/cmdline/svntest/wc.py
> > (State.from_wc): # Normalize line endings on Windows.
> >
> > Modified:
> > trunk/subversion/tests/cmdline/svntest/wc.py
> >
> > Modified: trunk/subversion/tests/cmdline/svntest/wc.py
> > URL:
> > http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/svntest
> > /wc.py?pathrev=37008&r1=37007&r2=37008
> > =======================================================================
> > =======
> > --- trunk/subversion/tests/cmdline/svntest/wc.py Sat Apr 4
> > 17:25:19 2009 (r37007)
> > +++ trunk/subversion/tests/cmdline/svntest/wc.py Sat Apr 4
> > 18:17:40 2009 (r37008)
> > @@ -492,6 +492,8 @@ class State:
> > node = os.path.join(dirpath, name)
> > if os.path.isfile(node):
> > contents = open(node, 'rb').read()
> > + if sys.platform == 'win32':
> > + contents = contents.replace('\r\n', '\n')
> > try:
> > contents = contents.decode()
> > except UnicodeDecodeError:
>
>
> -1 on this approach of hiding newline problems. (Not the first time I
> mention this)
>
> On windows in text a "\r\n" is good, a "\n" is an error. And the test suite
> must error on this condition like it always did.

The following code should be sufficient:

if sys.platform == 'win32':
  for line in contents.splitlines(True):
    if line[-2:] != '\r\n':
      raise ValueError("Invalid line ending: '%s'" % line)
  contents = contents.replace('\r\n', '\n')

> This hides all these possible errors in our test suite. Each line MUST END
> with a "\r\n", or most other tools will fail.
>
> E.g. you would hide errors like the ones you introduced by merging the svn
> patch branch..
> or with properties that contain invalid end of line sequences by just
> ignoring the "\r"..
> or by svn diff that sometimes uses the wrong line endings (Some cases with
> svn:eol-style native).
>
> You are still trying to fix things for a handful of python 3 users, by
> reducing the usefulness of the test suite for millions of Windows users.
>
>
> The approach of moving the tests to Unicode, instead of comparing the actual
> bytes from svn is the wrong approach..

It would be very hard to maintain the branch with all "strings" replaced
with b"strings".

$ grep -Er "('.*'|\".*\")" subversion/tests/cmdline | grep -v /\.svn/ | wc -l
24806
$ 2to3 -f unicode subversion/tests/cmdline
RefactoringTool: No files need to be modified.
$

-- 
Arfrever Frehtes Taifersar Arahesis

Received on 2009-04-05 14:30:15 CEST

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.