35
35
"""Test that 'bzr revision-info' reports the correct thing."""
36
36
wt = self.make_branch_and_tree('.')
38
# Make history with a non-mainline rev
38
39
wt.commit('Commit one', rev_id='a@r-0-1')
39
wt.commit('Commit two', rev_id='a@r-0-2')
40
wt.commit('Commit three', rev_id='a@r-0-3')
42
# Make sure revision-info without any arguments throws an exception
43
self.check_error('bzr: ERROR: '
44
'You must supply a revision identifier\n',
40
wt.commit('Commit two', rev_id='a@r-0-1.1.1')
41
wt.set_parent_ids(['a@r-0-1', 'a@r-0-1.1.1'])
42
wt.branch.set_last_revision_info(1, 'a@r-0-1')
43
wt.commit('Commit three', rev_id='a@r-0-2')
45
# This is expected to work even if the working tree is removed
46
wt.bzrdir.destroy_workingtree()
48
# Expected return values
51
'1.1.1': '1.1.1 a@r-0-1.1.1\n',
55
# Make sure with no arg it defaults to the head
56
self.check_output(values['2'], 'revision-info')
53
58
# Check the results of just specifying a numeric revision
54
self.check_output(values[1], 'revision-info', '1')
55
self.check_output(values[2], 'revision-info', '2')
56
self.check_output(values[3], 'revision-info', '3')
57
self.check_output(values[1]+values[2], 'revision-info', '1', '2')
58
self.check_output(values[1]+values[2]+values[3], 'revision-info', '1', '2', '3')
59
self.check_output(values[2]+values[1], 'revision-info', '2', '1')
59
self.check_output(values['1'], 'revision-info', '1')
60
self.check_output(values['1.1.1'], 'revision-info', '1.1.1')
61
self.check_output(values['2'], 'revision-info', '2')
62
self.check_output(values['1']+values['2'], 'revision-info', '1', '2')
63
self.check_output(values['1']+values['1.1.1']+values['2'],
64
'revision-info', '1', '1.1.1', '2')
65
self.check_output(values['2']+values['1'], 'revision-info', '2', '1')
61
67
# Check as above, only using the '--revision' syntax
63
self.check_output(' 1 a@r-0-1\n', 'revision-info', '-r', '1')
64
self.check_output(' 2 a@r-0-2\n', 'revision-info', '--revision', '2')
65
self.check_output(' 3 a@r-0-3\n', 'revision-info', '-r', '3')
66
self.check_output(' 1 a@r-0-1\n 2 a@r-0-2\n', 'revision-info', '-r', '1..2')
67
self.check_output(' 1 a@r-0-1\n 2 a@r-0-2\n 3 a@r-0-3\n'
68
, 'revision-info', '-r', '1..2..3')
69
self.check_output(' 2 a@r-0-2\n 1 a@r-0-1\n', 'revision-info', '-r', '2..1')
69
self.check_output(values['1'], 'revision-info', '-r', '1')
70
self.check_output(values['1.1.1'], 'revision-info', '--revision',
72
self.check_output(values['2'], 'revision-info', '-r', '2')
73
self.check_output(values['1']+values['2'], 'revision-info',
75
self.check_output(values['1']+values['1.1.1']+values['2'],
76
'revision-info', '-r', '1..1.1.1..2')
77
self.check_output(values['2']+values['1'], 'revision-info',
71
80
# Now try some more advanced revision specifications
73
self.check_output(' 1 a@r-0-1\n', 'revision-info', '-r', 'revid:a@r-0-1')
74
self.check_output(' 2 a@r-0-2\n', 'revision-info', '--revision', 'revid:a@r-0-2')
82
self.check_output(values['1'], 'revision-info', '-r',
84
self.check_output(values['1.1.1'], 'revision-info', '--revision',