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
=== modified file 'NEWS'
--- NEWS 2009-11-19 17:45:27 +0000
+++ NEWS 2009-11-20 16:50:24 +0000
@@ -40,6 +40,11 @@
40* Lots of bugfixes for the test suite on Windows. We should once again40* Lots of bugfixes for the test suite on Windows. We should once again
41 have a test suite with no failures on Windows. (John Arbash Meinel)41 have a test suite with no failures on Windows. (John Arbash Meinel)
4242
43* The new glob expansion on Windows would replace all ``\`` characters
44 with ``/`` even if it there wasn't a glob to expand, the arg was quoted,
45 etc. Now only change slashes if there is something being glob expanded.
46 (John Arbash Meinel, #485771)
47
43Improvements48Improvements
44************49************
4550
4651
=== modified file 'bzrlib/tests/test_win32utils.py'
--- bzrlib/tests/test_win32utils.py 2009-11-16 20:52:38 +0000
+++ bzrlib/tests/test_win32utils.py 2009-11-20 16:50:24 +0000
@@ -373,10 +373,13 @@
373 self.assertCommandLine([u"'a/*.c'"], "'a/*.c'")373 self.assertCommandLine([u"'a/*.c'"], "'a/*.c'")
374374
375 def test_slashes_changed(self):375 def test_slashes_changed(self):
376 self.assertCommandLine([u'a/*.c'], '"a\\*.c"')376 # Quoting doesn't change the supplied args
377 # Expands the glob, but nothing matches377 self.assertCommandLine([u'a\\*.c'], '"a\\*.c"')
378 # Expands the glob, but nothing matches, swaps slashes
378 self.assertCommandLine([u'a/*.c'], 'a\\*.c')379 self.assertCommandLine([u'a/*.c'], 'a\\*.c')
379 self.assertCommandLine([u'a/foo.c'], 'a\\foo.c')380 self.assertCommandLine([u'a/?.c'], 'a\\?.c')
381 # No glob, doesn't touch slashes
382 self.assertCommandLine([u'a\\foo.c'], 'a\\foo.c')
380383
381 def test_no_single_quote_supported(self):384 def test_no_single_quote_supported(self):
382 self.assertCommandLine(["add", "let's-do-it.txt"],385 self.assertCommandLine(["add", "let's-do-it.txt"],
383386
=== modified file 'bzrlib/win32utils.py'
--- bzrlib/win32utils.py 2009-11-06 10:00:10 +0000
+++ bzrlib/win32utils.py 2009-11-20 16:50:24 +0000
@@ -631,7 +631,7 @@
631 args = []631 args = []
632 for is_quoted, arg in s:632 for is_quoted, arg in s:
633 if is_quoted or not glob.has_magic(arg):633 if is_quoted or not glob.has_magic(arg):
634 args.append(arg.replace(u'\\', u'/'))634 args.append(arg)
635 else:635 else:
636 args.extend(glob_one(arg))636 args.extend(glob_one(arg))
637 return args637 return args