Rev 4817: Include the glob updates. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted

John Arbash Meinel john at arbash-meinel.com
Mon Nov 16 20:52:43 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted

------------------------------------------------------------
revno: 4817 [merge]
revision-id: john at arbash-meinel.com-20091116205238-dxub89y5jt5foo6y
parent: john at arbash-meinel.com-20091116205041-a7iex3ck3miwdm32
parent: john at arbash-meinel.com-20091108002718-owomi0efq10hg8r7
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-win32-accepted
timestamp: Mon 2009-11-16 14:52:38 -0600
message:
  Include the glob updates.
  
  Technically this wasn't approved, but the tests pass, it adds tests on Linux,
  and the timeout for review has certainly passed. I'm also not worried as it
  is primarily a test-suite fix.
modified:
  bzrlib/tests/blackbox/test_add.py test_add.py-20060518072250-857e4f86f54a30b2
  bzrlib/tests/test_win32utils.py test_win32utils.py-20070713181630-8xsrjymd3e8mgw23-108
-------------- next part --------------
=== modified file 'bzrlib/tests/blackbox/test_add.py'
--- a/bzrlib/tests/blackbox/test_add.py	2009-08-10 08:25:05 +0000
+++ b/bzrlib/tests/blackbox/test_add.py	2009-11-08 00:05:26 +0000
@@ -27,7 +27,6 @@
     SymlinkFeature
     )
 from bzrlib.tests.blackbox import ExternalBase
-from bzrlib.tests.test_win32utils import NeedsGlobExpansionFeature
 
 
 def load_tests(standard_tests, module, loader):
@@ -211,20 +210,6 @@
         err = self.run_bzr('add .bzr/crescent', retcode=3)[1]
         self.assertContainsRe(err, r'ERROR:.*\.bzr.*control file')
 
-    def test_add_with_wildcards(self):
-        self.requireFeature(NeedsGlobExpansionFeature)
-        self.make_branch_and_tree('.')
-        self.build_tree(['a1', 'a2', 'b', 'c33'])
-        self.run_bzr(['add', 'a?', 'c*'])
-        self.assertEquals(self.run_bzr('unknowns')[0], 'b\n')
-
-    def test_add_with_wildcards_unicode(self):
-        self.requireFeature(NeedsGlobExpansionFeature)
-        self.make_branch_and_tree('.')
-        self.build_tree([u'\u1234A', u'\u1235A', u'\u1235AA', 'cc'])
-        self.run_bzr(['add', u'\u1234?', u'\u1235*'])
-        self.assertEquals(self.run_bzr('unknowns')[0], 'cc\n')
-
     def test_add_via_symlink(self):
         self.requireFeature(SymlinkFeature)
         self.make_branch_and_tree('source')

=== modified file 'bzrlib/tests/test_win32utils.py'
--- a/bzrlib/tests/test_win32utils.py	2009-11-11 04:03:33 +0000
+++ b/bzrlib/tests/test_win32utils.py	2009-11-16 20:52:38 +0000
@@ -32,18 +32,20 @@
 from bzrlib.win32utils import glob_expand, get_app_path
 
 
-# Features
-# --------
-
-class _NeedsGlobExpansionFeature(Feature):
+class _BackslashDirSeparatorFeature(tests.Feature):
 
     def _probe(self):
-        return sys.platform == 'win32'
+        try:
+            os.lstat(os.getcwd() + '\\')
+        except OSError:
+            return False
+        else:
+            return True
 
     def feature_name(self):
-        return 'Internally performed glob expansion'
+        return "Filesystem treats '\\' as a directory separator."
 
-NeedsGlobExpansionFeature = _NeedsGlobExpansionFeature()
+BackslashDirSeparatorFeature = _BackslashDirSeparatorFeature()
 
 
 class _RequiredModuleFeature(Feature):
@@ -70,19 +72,9 @@
 # Tests
 # -----
 
-class TestNeedsGlobExpansionFeature(TestCase):
-
-    def test_available(self):
-        self.assertEqual(sys.platform == 'win32',
-                         NeedsGlobExpansionFeature.available())
-
-    def test_str(self):
-        self.assertTrue("performed" in str(NeedsGlobExpansionFeature))
-
-
 class TestWin32UtilsGlobExpand(TestCaseInTempDir):
 
-    _test_needs_features = [NeedsGlobExpansionFeature]
+    _test_needs_features = []
 
     def test_empty_tree(self):
         self.build_tree([])
@@ -92,22 +84,28 @@
             [['*'], ['*']],
             [['a', 'a'], ['a', 'a']]])
 
-    def test_tree_ascii(self):
-        """Checks the glob expansion and path separation char
-        normalization"""
+    def build_ascii_tree(self):
         self.build_tree(['a', 'a1', 'a2', 'a11', 'a.1',
                          'b', 'b1', 'b2', 'b3',
                          'c/', 'c/c1', 'c/c2',
                          'd/', 'd/d1', 'd/d2', 'd/e/', 'd/e/e1'])
+
+    def build_unicode_tree(self):
+        self.requireFeature(UnicodeFilenameFeature)
+        self.build_tree([u'\u1234', u'\u1234\u1234', u'\u1235/',
+                         u'\u1235/\u1235'])
+
+    def test_tree_ascii(self):
+        """Checks the glob expansion and path separation char
+        normalization"""
+        self.build_ascii_tree()
         self._run_testset([
             # no wildcards
             [[u'a'], [u'a']],
             [[u'a', u'a' ], [u'a', u'a']],
-            [[u'A'], [u'A']],
 
             [[u'd'], [u'd']],
             [[u'd/'], [u'd/']],
-            [[u'd\\'], [u'd/']],
 
             # wildcards
             [[u'a*'], [u'a', u'a1', u'a2', u'a11', u'a.1']],
@@ -115,18 +113,35 @@
             [[u'a?'], [u'a1', u'a2']],
             [[u'a??'], [u'a11', u'a.1']],
             [[u'b[1-2]'], [u'b1', u'b2']],
-            [[u'A?'], [u'a1', u'a2']],
 
             [[u'd/*'], [u'd/d1', u'd/d2', u'd/e']],
+            [[u'?/*'], [u'c/c1', u'c/c2', u'd/d1', u'd/d2', u'd/e']],
+            [[u'*/*'], [u'c/c1', u'c/c2', u'd/d1', u'd/d2', u'd/e']],
+            [[u'*/'], [u'c/', u'd/']],
+            ])
+
+    def test_backslash_globbing(self):
+        self.requireFeature(BackslashDirSeparatorFeature)
+        self.build_ascii_tree()
+        self._run_testset([
+            [[u'd\\'], [u'd/']],
             [[u'd\\*'], [u'd/d1', u'd/d2', u'd/e']],
             [[u'?\\*'], [u'c/c1', u'c/c2', u'd/d1', u'd/d2', u'd/e']],
             [[u'*\\*'], [u'c/c1', u'c/c2', u'd/d1', u'd/d2', u'd/e']],
-            [[u'*/'], [u'c/', u'd/']],
-            [[u'*\\'], [u'c/', u'd/']]])
+            [[u'*\\'], [u'c/', u'd/']],
+            ])
+
+    def test_case_insensitive_globbing(self):
+        self.requireFeature(tests.CaseInsCasePresFilenameFeature)
+        self.build_ascii_tree()
+        self._run_testset([
+            [[u'A'], [u'A']],
+            [[u'A?'], [u'a1', u'a2']],
+            ])
 
     def test_tree_unicode(self):
         """Checks behaviour with non-ascii filenames"""
-        self.build_tree([u'\u1234', u'\u1234\u1234', u'\u1235/', u'\u1235/\u1235'])
+        self.build_unicode_tree()
         self._run_testset([
             # no wildcards
             [[u'\u1234'], [u'\u1234']],
@@ -142,16 +157,26 @@
 
             [[u'\u1235/?'], [u'\u1235/\u1235']],
             [[u'\u1235/*'], [u'\u1235/\u1235']],
+            [[u'?/'], [u'\u1235/']],
+            [[u'*/'], [u'\u1235/']],
+            [[u'?/?'], [u'\u1235/\u1235']],
+            [[u'*/*'], [u'\u1235/\u1235']],
+            ])
+
+    def test_unicode_backslashes(self):
+        self.requireFeature(BackslashDirSeparatorFeature)
+        self.build_unicode_tree()
+        self._run_testset([
+            # no wildcards
+            [[u'\u1235\\'], [u'\u1235/']],
+            [[u'\u1235\\\u1235'], [u'\u1235/\u1235']],
             [[u'\u1235\\?'], [u'\u1235/\u1235']],
             [[u'\u1235\\*'], [u'\u1235/\u1235']],
-            [[u'?/'], [u'\u1235/']],
-            [[u'*/'], [u'\u1235/']],
             [[u'?\\'], [u'\u1235/']],
             [[u'*\\'], [u'\u1235/']],
-            [[u'?/?'], [u'\u1235/\u1235']],
-            [[u'*/*'], [u'\u1235/\u1235']],
             [[u'?\\?'], [u'\u1235/\u1235']],
-            [[u'*\\*'], [u'\u1235/\u1235']]])
+            [[u'*\\*'], [u'\u1235/\u1235']],
+            ])
 
     def _run_testset(self, testset):
         for pattern, expected in testset:
@@ -356,3 +381,13 @@
     def test_no_single_quote_supported(self):
         self.assertCommandLine(["add", "let's-do-it.txt"],
             "add let's-do-it.txt")
+
+    def test_case_insensitive_globs(self):
+        self.requireFeature(tests.CaseInsCasePresFilenameFeature)
+        self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
+        self.assertCommandLine([u'A/b.c'], 'A/B*')
+
+    def test_backslashes(self):
+        self.requireFeature(BackslashDirSeparatorFeature)
+        self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
+        self.assertCommandLine([u'a/b.c'], 'a\\b*')



More information about the bazaar-commits mailing list