~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tests/test_prepare_shelf.py

  • Committer: Aaron Bentley
  • Date: 2008-10-06 12:10:29 UTC
  • mto: (0.15.1 unshelve)
  • mto: This revision was merged to the branch mainline in revision 3820.
  • Revision ID: aaron@aaronbentley.com-20081006121029-jkm4tkzd5hzbcc1b
Handle creating symlinks

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#    along with this program; if not, write to the Free Software
15
15
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
import os
 
18
 
17
19
from bzrlib import tests
18
20
from bzrlib.plugins.shelf2 import prepare_shelf
19
21
 
106
108
        s_bar_trans_id = creator.shelf_transform.trans_id_file_id('bar-id')
107
109
        self.assertEqual('directory',
108
110
            creator.shelf_transform.final_kind(s_bar_trans_id))
 
111
 
 
112
    def test_shelve_symlink_creation(self):
 
113
        self.requireFeature(tests.SymlinkFeature)
 
114
        tree = self.make_branch_and_tree('.')
 
115
        tree.lock_write()
 
116
        self.addCleanup(tree.unlock)
 
117
        tree.commit('Empty tree')
 
118
        os.symlink('bar', 'foo')
 
119
        tree.add('foo', 'foo-id')
 
120
        creator = prepare_shelf.ShelfCreator(tree)
 
121
        self.addCleanup(creator.finalize)
 
122
        self.assertEqual([('add file', 'foo-id', 'symlink')], list(creator))
 
123
        creator.shelve_creation('foo-id', 'symlink')
 
124
        creator.transform()
 
125
        s_trans_id = creator.shelf_transform.trans_id_file_id('foo-id')
 
126
        self.failIfExists('foo')
 
127
        limbo_name = creator.shelf_transform._limbo_name(s_trans_id)
 
128
        self.assertEqual('bar', os.readlink(limbo_name))