Rev 5602: (jameinel) Bug #389674, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jan 12 19:48:05 UTC 2011


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

------------------------------------------------------------
revno: 5602 [merge]
revision-id: pqm at pqm.ubuntu.com-20110112194804-4wkdy5dj69vcmqv8
parent: pqm at pqm.ubuntu.com-20110112191441-mvbtkj06k4rkmifl
parent: john at arbash-meinel.com-20110112182601-t6hnlfke70pfv85t
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-01-12 19:48:04 +0000
message:
  (jameinel) Bug #389674,
   avoid using Tree.inventory during merge (dealing with unversioned parent
   dirs), since PreviewTree doesn't implement it. (John A Meinel)
modified:
  bzrlib/tests/test_shelf.py     test_prepare_shelf.p-20081005181341-n74qe6gu1e65ad4v-2
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/tests/test_shelf.py'
--- a/bzrlib/tests/test_shelf.py	2010-09-17 15:15:34 +0000
+++ b/bzrlib/tests/test_shelf.py	2011-01-12 18:25:01 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, 2009, 2010 Canonical Ltd
+# Copyright (C) 2008-2011 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
@@ -623,6 +623,29 @@
                               shelf_file)
         self.assertEqual('Shelf corrupt.', str(e))
 
+    def test_unshelve_subdir_in_now_removed_dir(self):
+        tree = self.make_branch_and_tree('.')
+        self.addCleanup(tree.lock_write().unlock)
+        self.build_tree(['dir/', 'dir/subdir/', 'dir/subdir/foo'])
+        tree.add(['dir'], ['dir-id'])
+        tree.commit('versioned dir')
+        tree.add(['dir/subdir', 'dir/subdir/foo'], ['subdir-id', 'foo-id'])
+        creator = shelf.ShelfCreator(tree, tree.basis_tree())
+        self.addCleanup(creator.finalize)
+        for change in creator.iter_shelvable():
+            creator.shelve_change(change)
+        shelf_manager = tree.get_shelf_manager()
+        shelf_id = shelf_manager.shelve_changes(creator)
+        self.failIfExists('dir/subdir')
+        tree.remove(['dir'])
+        unshelver = shelf_manager.get_unshelver(shelf_id)
+        self.addCleanup(unshelver.finalize)
+        unshelver.make_merger().do_merge()
+        self.failUnlessExists('dir/subdir/foo')
+        self.assertEqual('dir-id', tree.path2id('dir'))
+        self.assertEqual('subdir-id', tree.path2id('dir/subdir'))
+        self.assertEqual('foo-id', tree.path2id('dir/subdir/foo'))
+
 
 class TestShelfManager(tests.TestCaseWithTransport):
 

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2011-01-12 01:01:53 +0000
+++ b/bzrlib/transform.py	2011-01-12 18:25:01 +0000
@@ -528,6 +528,8 @@
         for trans_id in self._removed_id:
             file_id = self.tree_file_id(trans_id)
             if file_id is not None:
+                # XXX: This seems like something that should go via a different
+                #      indirection.
                 if self._tree.inventory[file_id].kind == 'directory':
                     parents.append(trans_id)
             elif self.tree_kind(trans_id) == 'directory':
@@ -3020,7 +3022,8 @@
             file_id = tt.inactive_file_id(conflict[1])
             # special-case the other tree root (move its children instead)
             if path_tree and file_id in path_tree:
-                if path_tree.inventory[file_id].parent_id is None:
+                if path_tree.path2id('') == file_id:
+                    # This is the root entry, skip it
                     continue
             tt.version_file(file_id, conflict[1])
             new_conflicts.add((c_type, 'Versioned directory', conflict[1]))

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2011-01-12 15:50:12 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2011-01-12 18:26:01 +0000
@@ -77,6 +77,10 @@
 * The BZR_COLUMNS environment variable can be set to 0 to indicate no
   limitation on the width of the terminal.  (Neil Martinsen-Burrell, #675652)
 
+* Unshelving changes that occur in a now-unversioned directory now restore
+  the directory properly rather than crashing.
+  (John Arbash Meinel, #389674)
+
 * You are now able to commit directly to a stacked branch. Any needed
   parent inventories will be filled in as part of the commit process.
   (John Arbash Meinel, #375013)




More information about the bazaar-commits mailing list