Rev 4789: Remove '_maybe_glob' in favor of globbing at the commandline level. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b3-win32-shell-completion

John Arbash Meinel john at arbash-meinel.com
Wed Nov 4 22:27:06 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b3-win32-shell-completion

------------------------------------------------------------
revno: 4789
revision-id: john at arbash-meinel.com-20091104222625-7j542nrr0ycx474w
parent: john at arbash-meinel.com-20091104221246-xkbux8f428u9hn5i
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b3-win32-shell-completion
timestamp: Wed 2009-11-04 16:26:25 -0600
message:
  Remove '_maybe_glob' in favor of globbing at the commandline level.
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2009-10-14 20:02:28 +0000
+++ b/bzrlib/commands.py	2009-11-04 22:26:25 +0000
@@ -392,8 +392,8 @@
         """
         if not file_list:
             file_list = []
-        if sys.platform == 'win32':
-            file_list = win32utils.glob_expand(file_list)
+        # if sys.platform == 'win32':
+        #     file_list = win32utils.glob_expand(file_list)
         return list(file_list)
 
     def _usage(self):

=== modified file 'bzrlib/win32utils.py'
--- a/bzrlib/win32utils.py	2009-11-04 22:12:46 +0000
+++ b/bzrlib/win32utils.py	2009-11-04 22:26:25 +0000
@@ -647,21 +647,19 @@
         GetCommandLine = prototype(("GetCommandLineW",
                                     ctypes.windll.kernel32))
         prototype = ctypes.WINFUNCTYPE(POINTER(LPCWSTR), LPCWSTR, POINTER(INT))
-        CommandLineToArgv = prototype(("CommandLineToArgvW",
-                                       ctypes.windll.shell32))
-        c = INT(0)
-        pargv = CommandLineToArgv(GetCommandLine(), ctypes.byref(c))
+        command_line = GetCommandLine()
         # Skip the first argument, since we only care about parameters
-        argv = [pargv[i] for i in range(1, c.value)]
+        argv = _command_line_to_argv(GetCommandLine())[1:]
         if getattr(sys, 'frozen', None) is None:
             # Invoked via 'python.exe' which takes the form:
             #   python.exe [PYTHON_OPTIONS] C:\Path\bzr [BZR_OPTIONS]
             # we need to get only BZR_OPTIONS part,
-            # so let's using sys.argv[1:] as reference to get the tail
-            # of unicode argv
-            tail_len = len(sys.argv[1:])
-            ix = len(argv) - tail_len
-            argv = argv[ix:]
+            # We already removed 'python.exe' so we remove everything up to and
+            # including the first non-option ('-') argument.
+            for idx in xrange(len(argv)):
+                if argv[idx][:1] != '-':
+                    break
+            argv = argv[idx+1:]
         return argv
 else:
     get_unicode_argv = None



More information about the bazaar-commits mailing list