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.
>
>
> This hides all these possible errors in our test suite. Each line MUST END
> with a "\r\n", or most other tools will fail.
I have found a computer with Windows system, I installed Python on that system
and I tested opening some test files with different line endings.
When opening a file [1] with either "\r\n" or "\n" or mixed line endings in text mode,
and reading it, all line endings were automatically transformed into "\n". There
were no errors. When opening in binary mode [2], actual line endings were used.
Replacing of line endings [3] was working correctly.
[1] open(file, "r").read()
[2] open(file, "rb").read()
[3] open(file, "rb").read().replace("\r\n", "\n")
--
Arfrever Frehtes Taifersar Arahesis
Received on 2009-04-05 22:55:17 CEST