Rev 4676: Merge 2.0 to fix NEWS conflicts. in http://bazaar.launchpad.net/~lifeless/bzr/2.0

Robert Collins robertc at robertcollins.net
Thu Oct 1 01:57:02 BST 2009


At http://bazaar.launchpad.net/~lifeless/bzr/2.0

------------------------------------------------------------
revno: 4676 [merge]
revision-id: robertc at robertcollins.net-20091001005656-c4rd6cl5jxt6opvk
parent: robertc at robertcollins.net-20091001005052-oynl7kyor0m08tif
parent: pqm at pqm.ubuntu.com-20090930234719-e7be1sy74sb42o1y
committer: Robert Collins <robertc at robertcollins.net>
branch nick: 2.0
timestamp: Thu 2009-10-01 10:56:56 +1000
message:
  Merge 2.0 to fix NEWS conflicts.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/_dirstate_helpers_pyx.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
  bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
  bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
  bzrlib/tests/per_intertree/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
=== modified file 'NEWS'
--- a/NEWS	2009-09-30 21:38:49 +0000
+++ b/NEWS	2009-10-01 00:56:56 +0000
@@ -30,6 +30,9 @@
   but such operations are already doing full tree scans, so no radical
   performance change should be observed. (Robert Collins, #403322)
 
+* When a file kind becomes unversionable after being added, a sensible
+  error will be shown instead of a traceback. (Robert Collins, #438569)
+
 Improvements
 ************
 

=== modified file 'bzrlib/_dirstate_helpers_pyx.pyx'
--- a/bzrlib/_dirstate_helpers_pyx.pyx	2009-08-26 03:20:32 +0000
+++ b/bzrlib/_dirstate_helpers_pyx.pyx	2009-09-30 05:58:45 +0000
@@ -1202,7 +1202,9 @@
                         content_change = 0
                     target_exec = False
                 else:
-                    raise Exception, "unknown kind %s" % path_info[2]
+                    if path is None:
+                        path = self.pathjoin(old_dirname, old_basename)
+                    raise errors.BadFileKindError(path, path_info[2])
             if source_minikind == c'd':
                 if path is None:
                     old_path = path = self.pathjoin(old_dirname, old_basename)

=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2009-10-01 00:50:52 +0000
+++ b/bzrlib/dirstate.py	2009-10-01 00:56:56 +0000
@@ -3328,7 +3328,9 @@
                         content_change = False
                     target_exec = False
                 else:
-                    raise Exception, "unknown kind %s" % path_info[2]
+                    if path is None:
+                        path = pathjoin(old_dirname, old_basename)
+                    raise errors.BadFileKindError(path, path_info[2])
             if source_minikind == 'd':
                 if path is None:
                     old_path = path = pathjoin(old_dirname, old_basename)

=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2009-09-24 20:09:36 +0000
+++ b/bzrlib/inventory.py	2009-09-30 05:58:45 +0000
@@ -2305,7 +2305,7 @@
     try:
         factory = entry_factory[kind]
     except KeyError:
-        raise BzrError("unknown kind %r" % kind)
+        raise errors.BadFileKindError(name, kind)
     return factory(file_id, name, parent_id)
 
 

=== modified file 'bzrlib/tests/per_intertree/test_compare.py'
--- a/bzrlib/tests/per_intertree/test_compare.py	2009-08-26 03:20:32 +0000
+++ b/bzrlib/tests/per_intertree/test_compare.py	2009-09-30 22:22:54 +0000
@@ -948,6 +948,39 @@
                            (False, True))],
                          self.do_iter_changes(tree1, tree2))
 
+    def test_file_becomes_unversionable_bug_438569(self):
+        # This isn't strictly a intertree problem, but its the intertree code
+        # path that triggers all stat cache updates on both xml and dirstate
+        # trees.
+        # In bug 438569, a file becoming a fifo causes an assert. Fifo's are
+        # not versionable or diffable. For now, we simply stop cold when they
+        # are detected (because we don't know how far through the code the 
+        # assumption 'fifo's do not exist' goes). In future we could report 
+        # the kind change and have commit refuse to go futher, or something
+        # similar. One particular reason for choosing this approach is that
+        # there is no minikind for 'fifo' in dirstate today, so we can't 
+        # actually update records that way.
+        # To add confusion, the totally generic code path works - but it
+        # doesn't update persistent metadata. So this test permits InterTrees
+        # to either work, or fail with BadFileKindError.
+        self.requireFeature(tests.OsFifoFeature)
+        tree1 = self.make_branch_and_tree('1')
+        self.build_tree(['1/a'])
+        tree1.set_root_id('root-id')
+        tree1.add(['a'], ['a-id'])
+        tree2 = self.make_branch_and_tree('2')
+        os.mkfifo('2/a')
+        tree2.add(['a'], ['a-id'], ['file'])
+        try:
+            tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
+        except (KeyError,):
+            raise tests.TestNotApplicable(
+                "Cannot represent a FIFO in this case %s" % self.id())
+        try:
+            self.do_iter_changes(tree1, tree2)
+        except errors.BadFileKindError:
+            pass
+
     def test_missing_in_target(self):
         """Test with the target files versioned but absent from disk."""
         tree1 = self.make_branch_and_tree('1')




More information about the bazaar-commits mailing list