Merge lp:~bialix/bzr/backslashes-more-tests into lp:bzr

Proposed by Alexander Belchenko
Status: Rejected
Rejected by: Robert Collins
Proposed branch: lp:~bialix/bzr/backslashes-more-tests
Merge into: lp:bzr
Diff against target: 72 lines (+42/-0)
2 files modified
NEWS (+4/-0)
bzrlib/tests/test_cmdline.py (+38/-0)
To merge this branch: bzr merge lp:~bialix/bzr/backslashes-more-tests
Reviewer Review Type Date Requested Status
Gordon Tyler Approve
Review via email: mp+25612@code.launchpad.net

Description of the change

This branches provides merge of latest changes in 2.1 to bzr.dev with resolved conflicts.

To post a comment you must log in.
Revision history for this message
Gordon Tyler (doxxx) wrote :

Looks good to me other than the duplication of BackslashDirSeparatorFeature, which also appears in test_win32utils, and the spurious(?) NEWS entry.

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

We copy forward NEWS entries from old releases to trunk when merging
old releases to trunk, that way the trunk NEWS is accurate. So it
looks ok to me.

Revision history for this message
Robert Collins (lifeless) wrote :

I was merging 2.0 -> 2.1 -> trunk to get the pyrex fix, and ended up including the same change this had. I've moved rather than duplicating the feature though.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Why you marked it as Rejected?

Revision history for this message
Robert Collins (lifeless) wrote :

because I'm landing the same change from a different branch where I
started from a newer 2.1 - I had conflicts trying to incorporate your
branch.

-Rob

Revision history for this message
Alexander Belchenko (bialix) wrote :

So, in the end my work by resolving merge conflicts was useless. Heh.

Revision history for this message
Robert Collins (lifeless) wrote :

Not useless at all - I looked at your diff as I did it to understand
how it should be resolved; it was just easier overall to do it
separately - because I had more in 2.1 than you'd resolved, bzr wasn't
picking a great ancestor.

-Rob

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-05-19 02:20:50 +0000
3+++ NEWS 2010-05-19 14:37:32 +0000
4@@ -639,6 +639,10 @@
5 Bug Fixes
6 *********
7
8+* ``bzr clean-tree`` should not delete nested bzrdirs. Required for proper
9+ support of bzr-externals and scmproj plugins.
10+ (Alexander Belchenko, bug #572098)
11+
12 * ``bzr switch`` does not die if a ConfigurableFileMerger is used.
13 (Aaron Bentley, #559436)
14
15
16=== modified file 'bzrlib/tests/test_cmdline.py'
17--- bzrlib/tests/test_cmdline.py 2010-03-01 09:02:18 +0000
18+++ bzrlib/tests/test_cmdline.py 2010-05-19 14:37:32 +0000
19@@ -14,11 +14,29 @@
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
23+import os
24
25 from bzrlib import (
26 cmdline,
27 tests)
28
29+
30+class _BackslashDirSeparatorFeature(tests.Feature):
31+
32+ def _probe(self):
33+ try:
34+ os.lstat(os.getcwd() + '\\')
35+ except OSError:
36+ return False
37+ else:
38+ return True
39+
40+ def feature_name(self):
41+ return "Filesystem treats '\\' as a directory separator."
42+
43+BackslashDirSeparatorFeature = _BackslashDirSeparatorFeature()
44+
45+
46 class TestSplitter(tests.TestCase):
47
48 def assertAsTokens(self, expected, line, single_quotes_allowed=False):
49@@ -91,3 +109,23 @@
50 u'"x x" "y y"')
51 self.assertAsTokens([(True, u'x x'), (True, u'y y')],
52 u'"x x" \'y y\'', single_quotes_allowed=True)
53+
54+ def test_n_backslashes_handling(self):
55+ # https://bugs.launchpad.net/bzr/+bug/528944
56+ # actually we care about the doubled backslashes when they're
57+ # represents UNC paths.
58+ # But in fact there is too much weird corner cases
59+ # (see https://bugs.launchpad.net/tortoisebzr/+bug/569050)
60+ # so to reproduce every bit of windows command-line handling
61+ # could be not worth of efforts?
62+ self.requireFeature(BackslashDirSeparatorFeature)
63+ self.assertAsTokens([(True, r'\\host\path')], r'"\\host\path"')
64+ self.assertAsTokens([(False, r'\\host\path')], r'\\host\path')
65+ # handling of " after the 2n and 2n+1 backslashes
66+ # inside and outside the quoted string
67+ self.assertAsTokens([(True, r'\\'), (False, r'*.py')], r'"\\\\" *.py')
68+ self.assertAsTokens([(True, r'\\" *.py')], r'"\\\\\" *.py"')
69+ self.assertAsTokens([(True, r'\\ *.py')], r'\\\\" *.py"')
70+ self.assertAsTokens([(False, r'\\"'), (False, r'*.py')],
71+ r'\\\\\" *.py')
72+ self.assertAsTokens([(True, u'\\\\')], u'"\\\\')