Merge lp:~jameinel/bzr/2.1.0b4-485771-win32-nostar-noglob into lp:bzr

Proposed by John A Meinel
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jameinel/bzr/2.1.0b4-485771-win32-nostar-noglob
Merge into: lp:bzr
Diff against target: 49 lines (+12/-4)
3 files modified
NEWS (+5/-0)
bzrlib/tests/test_win32utils.py (+6/-3)
bzrlib/win32utils.py (+1/-1)
To merge this branch: bzr merge lp:~jameinel/bzr/2.1.0b4-485771-win32-nostar-noglob
Reviewer Review Type Date Requested Status
Alexander Belchenko Approve
bzr-core Pending
Review via email: mp+15094@code.launchpad.net
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

This fixes a bug that Alexander noticed.

Basically, we were replacing "\" with "/" for all arguments. Whether they were quoted, or globbed or whatever.

This changes it, so that only arguments with an actual glob get swapped.

I tested it with "bzr add foo\bar" and everything still seems to work fine. (foo\bar gets translated to foo/bar at an appropriate time later during the add process.)

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

Thanks for fixing it!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-11-19 17:45:27 +0000
3+++ NEWS 2009-11-20 16:50:24 +0000
4@@ -40,6 +40,11 @@
5 * Lots of bugfixes for the test suite on Windows. We should once again
6 have a test suite with no failures on Windows. (John Arbash Meinel)
7
8+* The new glob expansion on Windows would replace all ``\`` characters
9+ with ``/`` even if it there wasn't a glob to expand, the arg was quoted,
10+ etc. Now only change slashes if there is something being glob expanded.
11+ (John Arbash Meinel, #485771)
12+
13 Improvements
14 ************
15
16
17=== modified file 'bzrlib/tests/test_win32utils.py'
18--- bzrlib/tests/test_win32utils.py 2009-11-16 20:52:38 +0000
19+++ bzrlib/tests/test_win32utils.py 2009-11-20 16:50:24 +0000
20@@ -373,10 +373,13 @@
21 self.assertCommandLine([u"'a/*.c'"], "'a/*.c'")
22
23 def test_slashes_changed(self):
24- self.assertCommandLine([u'a/*.c'], '"a\\*.c"')
25- # Expands the glob, but nothing matches
26+ # Quoting doesn't change the supplied args
27+ self.assertCommandLine([u'a\\*.c'], '"a\\*.c"')
28+ # Expands the glob, but nothing matches, swaps slashes
29 self.assertCommandLine([u'a/*.c'], 'a\\*.c')
30- self.assertCommandLine([u'a/foo.c'], 'a\\foo.c')
31+ self.assertCommandLine([u'a/?.c'], 'a\\?.c')
32+ # No glob, doesn't touch slashes
33+ self.assertCommandLine([u'a\\foo.c'], 'a\\foo.c')
34
35 def test_no_single_quote_supported(self):
36 self.assertCommandLine(["add", "let's-do-it.txt"],
37
38=== modified file 'bzrlib/win32utils.py'
39--- bzrlib/win32utils.py 2009-11-06 10:00:10 +0000
40+++ bzrlib/win32utils.py 2009-11-20 16:50:24 +0000
41@@ -631,7 +631,7 @@
42 args = []
43 for is_quoted, arg in s:
44 if is_quoted or not glob.has_magic(arg):
45- args.append(arg.replace(u'\\', u'/'))
46+ args.append(arg)
47 else:
48 args.extend(glob_one(arg))
49 return args