Rev 5034: (jam) Bug #303275, don't fail 'status --short' for unknown file kinds. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Feb 12 15:15:28 GMT 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5034 [merge]
revision-id: pqm at pqm.ubuntu.com-20100212151524-27ef3474ivsi2eci
parent: pqm at pqm.ubuntu.com-20100212125536-75ekp8giqbsnunmu
parent: john at arbash-meinel.com-20100211163232-a60kroolh76xdmu3
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-02-12 15:15:24 +0000
message:
  (jam) Bug #303275, don't fail 'status --short' for unknown file kinds.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
=== modified file 'NEWS'
--- a/NEWS	2010-02-12 12:55:36 +0000
+++ b/NEWS	2010-02-12 15:15:24 +0000
@@ -66,6 +66,10 @@
   to the Ubuntu Units Policy <https://wiki.ubuntu.com/UnitsPolicy>.
   (Gordon Tyler, #514399)
 
+* Support kind markers for socket and fifo filesystem objects. This
+  prevents ``bzr status --short`` from crashing when those files are
+  present.  (John Arbash Meinel, #303275)
+
 API Changes
 ***********
 

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2010-01-13 15:30:22 +0000
+++ b/bzrlib/osutils.py	2010-02-11 16:32:32 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007, 2009 Canonical Ltd
+# Copyright (C) 2005-2010 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -179,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-01-25 17:48:22 +0000
+++ b/bzrlib/tests/test_osutils.py	2010-02-11 16:32:32 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
+# Copyright (C) 2005-2010 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -309,7 +309,9 @@
         self.assertEqual("/", osutils.kind_marker(osutils._directory_kind))
         self.assertEqual("@", osutils.kind_marker("symlink"))
         self.assertEqual("+", osutils.kind_marker("tree-reference"))
-        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