Rev 5026: Switch so that all unknown files get an empty marker, rather than failing. in http://bazaar.launchpad.net/~jameinel/bzr/2.2.0b1-status-short-fifo

John Arbash Meinel john at arbash-meinel.com
Thu Feb 11 16:32:59 GMT 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.2.0b1-status-short-fifo

------------------------------------------------------------
revno: 5026
revision-id: john at arbash-meinel.com-20100211163232-a60kroolh76xdmu3
parent: john at arbash-meinel.com-20100210225204-gkpyib953g2svoke
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.2.0b1-status-short-fifo
timestamp: Thu 2010-02-11 10:32:32 -0600
message:
  Switch so that all unknown files get an empty marker, rather than failing.
-------------- next part --------------
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2010-02-10 22:52:04 +0000
+++ b/bzrlib/osutils.py	2010-02-11 16:32:32 +0000
@@ -172,8 +172,6 @@
     _directory_kind: "/",
     "symlink": "@",
     'tree-reference': '+',
-    "socket": "=",
-    "fifo": "|",
 }
 
 
@@ -181,7 +179,9 @@
     try:
         return _kind_marker_map[kind]
     except KeyError:
-        raise errors.BzrError('invalid file kind %r' % kind)
+        # Slightly faster than using .get(, '') when the common case is that
+        # kind will be found
+        return ''
 
 
 lexists = getattr(os.path, 'lexists', None)

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2010-02-10 22:52:04 +0000
+++ b/bzrlib/tests/test_osutils.py	2010-02-11 16:32:32 +0000
@@ -309,9 +309,9 @@
         self.assertEqual("/", osutils.kind_marker(osutils._directory_kind))
         self.assertEqual("@", osutils.kind_marker("symlink"))
         self.assertEqual("+", osutils.kind_marker("tree-reference"))
-        self.assertEqual("|", osutils.kind_marker("fifo"))
-        self.assertEqual("=", osutils.kind_marker("socket"))
-        self.assertRaises(errors.BzrError, osutils.kind_marker, "unknown")
+        self.assertEqual("", osutils.kind_marker("fifo"))
+        self.assertEqual("", osutils.kind_marker("socket"))
+        self.assertEqual("", osutils.kind_marker("unknown"))
 
 
 class TestUmask(tests.TestCaseInTempDir):



More information about the bazaar-commits mailing list