[PATCH] bzr-0.0.7 selftest failure on Cygwin
John Whitley
whitley at acm.org
Fri Sep 16 07:31:27 BST 2005
Hi all,
bzr selftest fails on Cygwin in bzrlib/selftest/blackbox.py, in
test_ignore_patterns(). The issue is that the .bzrignore file is
written with the 'wt' text-mode flag. For Cygwin, this forces
behavior that causes line-ending translation ('\n' ==> '\r\n'). The
assert comparison then opens the file with binary-mode flags ('rb'),
which implies that the system's line-ending must be '\n'. The patch
below changes these two assert tests to use universal line-ending
support ('rU'), which then allows this (and all other) selftests to
pass.
This issue raises some hairy questions regarding cross-platform
source control semantics for line-endings. My team has had a few
battles with CVS regarding line-ending changes confusing updates and
merges.
Cygwin is an annoying point in this space, since writing with 'wt'
forces Windows text-mode write semantics... which produces a file
whose line endings don't match os.linesep (Cygwin's os.linesep =
'\n', at least for a Unix-mode installation...)
-- John
*** modified file 'bzrlib/selftest/blackbox.py'
--- bzrlib/selftest/blackbox.py
+++ bzrlib/selftest/blackbox.py
@@ -112,7 +112,7 @@
self.assertEquals(list(b.unknowns()), ['foo.blah'])
self.runbzr('ignore *.blah')
self.assertEquals(list(b.unknowns()), [])
- assert file('.bzrignore', 'rb').read() == '*.blah\n'
+ assert file('.bzrignore', 'rU').read() == '*.blah\n'
# 'ignore' works when then .bzrignore file already exists
file('garh', 'wt').write('garh')
@@ -120,7 +120,7 @@
assert self.backtick('bzr unknowns') == 'garh\n'
self.runbzr('ignore garh')
self.assertEquals(list(b.unknowns()), [])
- assert file('.bzrignore', 'rb').read() == '*.blah\ngarh\n'
+ assert file('.bzrignore', 'rU').read() == '*.blah\ngarh\n'
def test_revert(self):
self.runbzr('init')
More information about the bazaar
mailing list