Rev 4732: Add a direct ShelfCreator test for changing root id. in http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-dirstate-set-root-504390

John Arbash Meinel john at arbash-meinel.com
Tue Jan 12 18:05:52 GMT 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-dirstate-set-root-504390

------------------------------------------------------------
revno: 4732
revision-id: john at arbash-meinel.com-20100112180531-7iiom0p15574fqud
parent: john at arbash-meinel.com-20100112043336-1w006pc2c52zqofb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.4-dirstate-set-root-504390
timestamp: Tue 2010-01-12 12:05:31 -0600
message:
  Add a direct ShelfCreator test for changing root id.
  I found there are some shelf_ui tests that also check for it.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_shelf.py'
--- a/bzrlib/tests/test_shelf.py	2009-09-10 06:32:42 +0000
+++ b/bzrlib/tests/test_shelf.py	2010-01-12 18:05:31 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 Canonical Ltd
+# Copyright (C) 2008, 2009, 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
@@ -108,6 +108,29 @@
         creator.shelve_change(('rename', 'baz-id', 'foo/baz', 'bar/baz'))
         self.check_shelve_move(creator, tree)
 
+    def test_shelve_changed_root_id(self):
+        tree = self.make_branch_and_tree('.')
+        self.build_tree(['foo'])
+        tree.set_root_id('first-root-id')
+        tree.add(['foo'], ['foo-id'])
+        tree.commit('foo')
+        tree.set_root_id('second-root-id')
+        tree.lock_tree_write()
+        self.addCleanup(tree.unlock)
+        creator = shelf.ShelfCreator(tree, tree.basis_tree())
+        self.addCleanup(creator.finalize)
+        self.expectFailure('shelf doesn\'t support shelving root changes yet',
+            self.assertEqual, [
+                ('delete file', 'first-root-id', 'directory', ''),
+                ('add file', 'second-root-id', 'directory', ''),
+                ('rename', 'foo-id', u'foo', u'foo'),
+                ], list(creator.iter_shelvable()))
+
+        self.assertEqual([('delete file', 'first-root-id', 'directory', ''),
+                          ('add file', 'second-root-id', 'directory', ''),
+                          ('rename', 'foo-id', u'foo', u'foo'),
+                         ], list(creator.iter_shelvable()))
+
     def assertShelvedFileEqual(self, expected_content, creator, file_id):
         s_trans_id = creator.shelf_transform.trans_id_file_id(file_id)
         shelf_file = creator.shelf_transform._limbo_name(s_trans_id)



More information about the bazaar-commits mailing list