2052.3.2
by John Arbash Meinel
Change Copyright .. by Canonical to Copyright ... Canonical |
1 |
# Copyright (C) 2004, 2005 Canonical Ltd
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
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.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
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.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
12 |
#
|
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
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
|
|
16 |
||
17 |
import os |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
18 |
|
19 |
from bzrlib.errors import BzrCommandError, NoSuchRevision |
|
1551.13.17
by Aaron Bentley
Move cat-revision tests out of test_revision_info |
20 |
from bzrlib.tests.blackbox import ExternalBase |
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
21 |
from bzrlib.workingtree import WorkingTree |
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
22 |
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
23 |
|
1551.13.17
by Aaron Bentley
Move cat-revision tests out of test_revision_info |
24 |
class TestRevisionInfo(ExternalBase): |
1185.1.29
by Robert Collins
merge merge tweaks from aaron, which includes latest .dev |
25 |
|
26 |
def check_error(self, output, *args): |
|
27 |
"""Verify that the expected error matches what bzr says.
|
|
28 |
|
|
29 |
The output is supplied first, so that you can supply a variable
|
|
30 |
number of arguments to bzr.
|
|
31 |
"""
|
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
32 |
self.assertContainsRe(self.run_bzr_captured(args, retcode=3)[1], output) |
1185.1.29
by Robert Collins
merge merge tweaks from aaron, which includes latest .dev |
33 |
|
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
34 |
def test_revision_info(self): |
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
35 |
"""Test that 'bzr revision-info' reports the correct thing."""
|
36 |
wt = self.make_branch_and_tree('.') |
|
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
37 |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
38 |
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') |
|
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
41 |
|
42 |
# Make sure revision-info without any arguments throws an exception
|
|
1185.33.63
by Martin Pool
Better display of BzrError classes that are not BzrNewErrors. |
43 |
self.check_error('bzr: ERROR: ' |
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
44 |
'You must supply a revision identifier\n', |
1185.1.29
by Robert Collins
merge merge tweaks from aaron, which includes latest .dev |
45 |
'revision-info') |
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
46 |
|
47 |
values = { |
|
48 |
1:' 1 a@r-0-1\n', |
|
49 |
2:' 2 a@r-0-2\n', |
|
50 |
3:' 3 a@r-0-3\n' |
|
51 |
}
|
|
52 |
||
53 |
# Check the results of just specifying a numeric revision
|
|
1185.1.29
by Robert Collins
merge merge tweaks from aaron, which includes latest .dev |
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') |
|
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
60 |
|
61 |
# Check as above, only using the '--revision' syntax
|
|
62 |
||
1185.1.29
by Robert Collins
merge merge tweaks from aaron, which includes latest .dev |
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' |
|
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
68 |
, 'revision-info', '-r', '1..2..3') |
1185.1.29
by Robert Collins
merge merge tweaks from aaron, which includes latest .dev |
69 |
self.check_output(' 2 a@r-0-2\n 1 a@r-0-1\n', 'revision-info', '-r', '2..1') |
1185.5.4
by John Arbash Meinel
Updated bzr revision-info, created tests. |
70 |
|
71 |
# Now try some more advanced revision specifications
|
|
72 |
||
1185.1.29
by Robert Collins
merge merge tweaks from aaron, which includes latest .dev |
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') |