Rev 4819: Fix bug #485771. Only change '/' to '/' when expanding globs. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-485771-win32-nostar-noglob

John Arbash Meinel john at arbash-meinel.com
Fri Nov 20 16:42:37 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-485771-win32-nostar-noglob

------------------------------------------------------------
revno: 4819
revision-id: john at arbash-meinel.com-20091120164228-aa9agsdfomwzqshc
parent: pqm at pqm.ubuntu.com-20091120135849-rxmryotfq30r6q79
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-485771-win32-nostar-noglob
timestamp: Fri 2009-11-20 10:42:28 -0600
message:
  Fix bug #485771. Only change '/' to '/' when expanding globs.
  
  The code we had would replace '/' even if it was in a quoted section,
  or if it was part of a simple argument that didn't have a glob.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-11-19 17:45:27 +0000
+++ b/NEWS	2009-11-20 16:42:28 +0000
@@ -40,6 +40,11 @@
 * Lots of bugfixes for the test suite on Windows. We should once again
   have a test suite with no failures on Windows. (John Arbash Meinel)
 
+* The new glob expansion on Windows would replace all ``\`` characters
+  with ``/`` even if it there wasn't a glob to expand, the arg was quoted,
+  etc. Now only change slashes if there is something being glob expanded.
+  (John Arbash Meinel, #485771)
+
 Improvements
 ************
 

=== modified file 'bzrlib/tests/test_win32utils.py'
--- a/bzrlib/tests/test_win32utils.py	2009-11-16 20:52:38 +0000
+++ b/bzrlib/tests/test_win32utils.py	2009-11-20 16:42:28 +0000
@@ -373,10 +373,13 @@
         self.assertCommandLine([u"'a/*.c'"], "'a/*.c'")
 
     def test_slashes_changed(self):
-        self.assertCommandLine([u'a/*.c'], '"a\\*.c"')
-        # Expands the glob, but nothing matches
+        # Quoting doesn't change the supplied args
+        self.assertCommandLine([u'a\\*.c'], '"a\\*.c"')
+        # Expands the glob, but nothing matches, swaps slashes
         self.assertCommandLine([u'a/*.c'], 'a\\*.c')
-        self.assertCommandLine([u'a/foo.c'], 'a\\foo.c')
+        self.assertCommandLine([u'a/?.c'], 'a\\?.c')
+        # No glob, doesn't touch slashes
+        self.assertCommandLine([u'a\\foo.c'], 'a\\foo.c')
 
     def test_no_single_quote_supported(self):
         self.assertCommandLine(["add", "let's-do-it.txt"],

=== modified file 'bzrlib/win32utils.py'
--- a/bzrlib/win32utils.py	2009-11-06 10:00:10 +0000
+++ b/bzrlib/win32utils.py	2009-11-20 16:42:28 +0000
@@ -631,7 +631,7 @@
     args = []
     for is_quoted, arg in s:
         if is_quoted or not glob.has_magic(arg):
-            args.append(arg.replace(u'\\', u'/'))
+            args.append(arg)
         else:
             args.extend(glob_one(arg))
     return args



More information about the bazaar-commits mailing list