~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_shelve.py

  • Committer: Mark Hammond
  • Date: 2009-01-12 01:55:34 UTC
  • mto: (3995.8.2 prepare-1.12)
  • mto: This revision was merged to the branch mainline in revision 4007.
  • Revision ID: mhammond@skippinet.com.au-20090112015534-yfxg50p7mpds9j4v
Include all .html files from the tortoise doc directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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
19
from bzrlib import shelf
20
20
from bzrlib.tests import TestCaseWithTransport
21
 
from bzrlib.tests.script import ScriptRunner
22
 
 
23
21
 
24
22
class TestShelveList(TestCaseWithTransport):
25
23
 
28
26
        err = self.run_bzr('shelve --list')[1]
29
27
        self.assertEqual('No shelved changes.\n', err)
30
28
 
31
 
    def make_creator(self, tree):
32
 
        creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
33
 
        self.addCleanup(creator.finalize)
34
 
        return creator
35
 
 
36
29
    def test_shelve_one(self):
37
30
        tree = self.make_branch_and_tree('.')
38
 
        creator = self.make_creator(tree)
 
31
        creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
39
32
        shelf_id = tree.get_shelf_manager().shelve_changes(creator, 'Foo')
40
33
        out, err = self.run_bzr('shelve --list', retcode=1)
41
34
        self.assertEqual('', err)
43
36
 
44
37
    def test_shelve_no_message(self):
45
38
        tree = self.make_branch_and_tree('.')
46
 
        creator = self.make_creator(tree)
 
39
        creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
47
40
        shelf_id = tree.get_shelf_manager().shelve_changes(creator)
48
41
        out, err = self.run_bzr('shelve --list', retcode=1)
49
42
        self.assertEqual('', err)
51
44
 
52
45
    def test_shelf_order(self):
53
46
        tree = self.make_branch_and_tree('.')
54
 
        creator = self.make_creator(tree)
 
47
        creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
55
48
        tree.get_shelf_manager().shelve_changes(creator, 'Foo')
56
 
        creator = self.make_creator(tree)
 
49
        creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
57
50
        tree.get_shelf_manager().shelve_changes(creator, 'Bar')
58
51
        out, err = self.run_bzr('shelve --list', retcode=1)
59
52
        self.assertEqual('', err)
60
53
        self.assertEqual('  2: Bar\n  1: Foo\n', out)
61
54
 
62
 
    def test_shelve_destroy(self):
63
 
        tree = self.make_branch_and_tree('.')
64
 
        self.build_tree(['file'])
65
 
        tree.add('file')
66
 
        self.run_bzr('shelve --all --destroy')
67
 
        self.failIfExists('file')
68
 
        self.assertIs(None, tree.get_shelf_manager().last_shelf())
69
 
 
70
 
    def test_unshelve_keep(self):
71
 
        # https://bugs.edge.launchpad.net/bzr/+bug/492091
72
 
        tree = self.make_branch_and_tree('.')
73
 
        # shelve apparently unhappy working with a tree with no root yet
74
 
        tree.commit('make root')
75
 
        self.build_tree(['file'])
76
 
 
77
 
        sr = ScriptRunner()
78
 
        sr.run_script(self, '''
79
 
$ bzr add file
80
 
$ bzr shelve --all -m Foo
81
 
$ bzr shelve --list
82
 
  1: Foo
83
 
$ bzr unshelve --keep
84
 
$ bzr shelve --list
85
 
  1: Foo
86
 
$ cat file
87
 
contents of file
88
 
''')
89
 
 
90
 
 
91
55
 
92
56
class TestShelveRelpath(TestCaseWithTransport):
93
57