~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_shelf.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-06 06:48:25 UTC
  • mfrom: (4070.8.6 debug-config)
  • Revision ID: pqm@pqm.ubuntu.com-20090306064825-kbpwggw21dygeix6
(mbp) debug_flags configuration option

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import os
18
18
 
19
 
from bzrlib import errors, pack, shelf, tests, transform, workingtree
 
19
from bzrlib import errors, pack, shelf, tests, transform
20
20
 
21
21
 
22
22
EMPTY_SHELF = ("Bazaar pack format 1 (introduced in 0.18)\n"
140
140
        limbo_name = creator.shelf_transform._limbo_name(s_trans_id)
141
141
        self.assertEqual('bar', os.readlink(limbo_name))
142
142
 
143
 
    def test_shelve_symlink_target_change(self):
144
 
        self.requireFeature(tests.SymlinkFeature)
145
 
        tree = self.make_branch_and_tree('.')
146
 
        tree.lock_write()
147
 
        self.addCleanup(tree.unlock)
148
 
        os.symlink('bar', 'foo')
149
 
        tree.add('foo', 'foo-id')
150
 
        tree.commit("commit symlink")
151
 
        os.unlink("foo")
152
 
        os.symlink('baz', 'foo')
153
 
        creator = shelf.ShelfCreator(tree, tree.basis_tree())
154
 
        self.addCleanup(creator.finalize)
155
 
        self.assertEqual([('modify target', 'foo-id', 'foo', 'bar', 'baz')],
156
 
                         list(creator.iter_shelvable()))
157
 
        creator.shelve_modify_target('foo-id')
158
 
        creator.transform()
159
 
        self.assertEqual('bar', os.readlink('foo'))
160
 
        s_trans_id = creator.shelf_transform.trans_id_file_id('foo-id')
161
 
        limbo_name = creator.shelf_transform._limbo_name(s_trans_id)
162
 
        self.assertEqual('baz', os.readlink(limbo_name))
163
 
 
164
143
    def test_shelve_creation_no_contents(self):
165
144
        tree = self.make_branch_and_tree('.')
166
145
        tree.lock_write()
289
268
        records.next()
290
269
        tt.deserialize(records)
291
270
 
292
 
    def test_shelve_unversioned(self):
293
 
        tree = self.make_branch_and_tree('tree')
294
 
        self.assertRaises(errors.PathsNotVersionedError,
295
 
                          shelf.ShelfCreator, tree, tree.basis_tree(), ['foo'])
296
 
        # We should be able to lock/unlock the tree if ShelfCreator cleaned
297
 
        # after itself.
298
 
        wt = workingtree.WorkingTree.open('tree')
299
 
        wt.lock_tree_write()
300
 
        wt.unlock()
301
 
        # And a second tentative should raise the same error (no
302
 
        # limbo/pending_deletion leftovers).
303
 
        self.assertRaises(errors.PathsNotVersionedError,
304
 
                          shelf.ShelfCreator, tree, tree.basis_tree(), ['foo'])
305
 
 
306
271
 
307
272
class TestUnshelver(tests.TestCaseWithTransport):
308
273