[Pkg-bazaar-commits] ./bzr/unstable r686: - glob expand add arguments on win32

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:13:47 UTC 2009


------------------------------------------------------------
revno: 686
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Wed 2005-06-15 14:14:26 +1000
message:
  - glob expand add arguments on win32
    patch from Roncaglia Julien
modified:
  bzrlib/add.py
-------------- next part --------------
=== modified file 'bzrlib/add.py'
--- a/bzrlib/add.py	2005-05-30 05:10:41 +0000
+++ b/bzrlib/add.py	2005-06-15 04:14:26 +0000
@@ -19,6 +19,21 @@
 
 from trace import mutter, note
 
+def glob_expand_for_win32(file_list):
+    import glob
+    
+    expanded_file_list = []
+    for possible_glob in file_list:
+        glob_files = glob.glob(possible_glob)
+       
+        if glob_files == []:
+            # special case to let the normal code path handle
+            # files that do not exists
+            expanded_file_list.append(possible_glob)
+        else:
+            expanded_file_list += glob_files
+    return expanded_file_list
+
 def smart_add(file_list, verbose=True, recurse=True):
     """Add files to version, optionally recursing into directories.
 
@@ -29,6 +44,10 @@
     from bzrlib.errors import BadFileKindError, ForbiddenFileError
 
     assert file_list
+    
+    if sys.platform == 'win32':
+        file_list = glob_expand_for_win32(file_list)
+    
     user_list = file_list[:]
     assert not isinstance(file_list, basestring)
     b = bzrlib.branch.Branch(file_list[0], find_root=True)



More information about the Pkg-bazaar-commits mailing list