1
# Copyright (C) 2004, 2005 Canonical Ltd
1
# Copyright (C) 2004, 2005, 2009 Canonical Ltd
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
60
60
self.check_output(values['1.1.1'], 'revision-info 1.1.1')
61
61
self.check_output(values['2'], 'revision-info 2')
62
62
self.check_output(values['1']+values['2'], 'revision-info 1 2')
63
self.check_output(values['1']+values['1.1.1']+values['2'],
63
self.check_output(' '+values['1']+
64
66
'revision-info 1 1.1.1 2')
65
67
self.check_output(values['2']+values['1'], 'revision-info 2 1')
70
72
self.check_output(values['1.1.1'], 'revision-info --revision 1.1.1')
71
73
self.check_output(values['2'], 'revision-info -r 2')
72
74
self.check_output(values['1']+values['2'], 'revision-info -r 1..2')
73
self.check_output(values['1']+values['1.1.1']+values['2'],
75
self.check_output(' '+values['1']+
74
78
'revision-info -r 1..1.1.1..2')
75
79
self.check_output(values['2']+values['1'], 'revision-info -r 2..1')
85
89
wt = self.make_branch_and_tree('branch')
87
91
wt.commit('Commit one', rev_id='a@r-0-1')
88
self.check_output(' 1 a@r-0-1\n', 'revision-info -d branch')
92
self.check_output('1 a@r-0-1\n', 'revision-info -d branch')
94
def test_revision_info_tree(self):
95
# Make branch and checkout
96
wt = self.make_branch_and_tree('branch')
97
wt.commit('Commit one', rev_id='a@r-0-1')
99
# Make checkout and move the branch forward
100
wt.branch.create_checkout('checkout', lightweight=True)
101
wt.commit('Commit two', rev_id='a@r-0-2')
103
# Make sure the checkout gives the right answer for branch and
105
self.check_output('2 a@r-0-2\n', 'revision-info -d checkout')
106
self.check_output('1 a@r-0-1\n', 'revision-info --tree -d checkout')
108
def test_revision_info_tree_no_working_tree(self):
109
# Make branch with no tree
110
b = self.make_branch('branch')
112
# Try getting the --tree revision-info
113
out,err = self.run_bzr('revision-info --tree -d branch', retcode=3)
114
self.assertEqual('', out)
115
self.assertEqual('bzr: ERROR: No WorkingTree exists for "branch".\n',
118
def test_revision_info_not_in_history(self):
119
builder = self.make_branch_builder('branch')
120
builder.start_series()
121
builder.build_snapshot('A-id', None, [
122
('add', ('', 'root-id', 'directory', None))])
123
builder.build_snapshot('B-id', ['A-id'], [])
124
builder.build_snapshot('C-id', ['A-id'], [])
125
builder.finish_series()
126
self.check_output(' 1 A-id\n??? B-id\n 2 C-id\n',
127
'revision-info -d branch'
128
' revid:A-id revid:B-id revid:C-id')