~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-13 03:16:26 UTC
  • mfrom: (4137.1.2 jamesw-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090313031626-cy59iwvd5csfcmez
(jamesw) Shelve now supports shelving changes to symlink targets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
143
164
    def test_shelve_creation_no_contents(self):
144
165
        tree = self.make_branch_and_tree('.')
145
166
        tree.lock_write()