1
# Copyright (C) 2008 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
from bzrlib import shelf
18
from bzrlib.tests import TestCaseWithTransport
20
class TestLSShelf(TestCaseWithTransport):
22
def test_no_shelved_changes(self):
23
tree = self.make_branch_and_tree('.')
24
err = self.run_bzr('ls-shelf')[1]
25
self.assertEqual('No shelved changes.\n', err)
27
def test_shelve_one(self):
28
tree = self.make_branch_and_tree('.')
29
creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
30
shelf_id = tree.get_shelf_manager().shelve_changes(creator, 'Foo')
31
out, err = self.run_bzr('ls-shelf', retcode=1)
32
self.assertEqual('', err)
33
self.assertEqual(' 1: Foo\n', out)
35
def test_shelve_no_message(self):
36
tree = self.make_branch_and_tree('.')
37
creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
38
shelf_id = tree.get_shelf_manager().shelve_changes(creator)
39
out, err = self.run_bzr('ls-shelf', retcode=1)
40
self.assertEqual('', err)
41
self.assertEqual(' 1: <no message>\n', out)
43
def test_shelf_order(self):
44
tree = self.make_branch_and_tree('.')
45
creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
46
tree.get_shelf_manager().shelve_changes(creator, 'Foo')
47
creator = shelf.ShelfCreator(tree, tree.basis_tree(), [])
48
tree.get_shelf_manager().shelve_changes(creator, 'Bar')
49
out, err = self.run_bzr('ls-shelf', retcode=1)
50
self.assertEqual('', err)
51
self.assertEqual(' 2: Bar\n 1: Foo\n', out)