6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
1 |
# Copyright (C) 2006, 2007, 2009, 2012 Canonical Ltd
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
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 |
#
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
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 |
#
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
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
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
16 |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
17 |
from bzrlib import ( |
18 |
branch, |
|
19 |
tests, |
|
20 |
)
|
|
21 |
||
22 |
||
23 |
class TestRevisionHistory(tests.TestCaseWithTransport): |
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
24 |
|
25 |
def _build_branch(self): |
|
26 |
# setup a standalone branch with three commits
|
|
27 |
tree = self.make_branch_and_tree('test') |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
28 |
with open('test/foo', 'wb') as f: |
29 |
f.write('1111\n') |
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
30 |
tree.add('foo') |
31 |
tree.commit('added foo',rev_id='revision_1') |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
32 |
with open('test/foo', 'wb')as f: |
33 |
f.write('2222\n') |
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
34 |
tree.commit('updated foo',rev_id='revision_2') |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
35 |
with open('test/foo', 'wb')as f: |
36 |
f.write('3333\n') |
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
37 |
tree.commit('updated foo again',rev_id='revision_3') |
38 |
return tree |
|
39 |
||
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
40 |
def _check_revision_history(self, location='', working_dir=None): |
41 |
rh = self.run_bzr(['revision-history', location], |
|
42 |
working_dir=working_dir)[0] |
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
43 |
self.assertEqual(rh, 'revision_1\nrevision_2\nrevision_3\n') |
44 |
||
45 |
def test_revision_history(self): |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
46 |
"""No location"""
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
47 |
self._build_branch() |
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
48 |
self._check_revision_history(working_dir='test') |
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
49 |
|
50 |
def test_revision_history_with_location(self): |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
51 |
"""With a specified location."""
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
52 |
self._build_branch() |
53 |
self._check_revision_history('test') |
|
54 |
||
55 |
def test_revision_history_with_repo_branch(self): |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
56 |
"""With a repository branch location."""
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
57 |
self._build_branch() |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
58 |
self.run_bzr('init-repo repo') |
59 |
self.run_bzr('branch test repo/test') |
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
60 |
self._check_revision_history('repo/test') |
61 |
||
62 |
def test_revision_history_with_checkout(self): |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
63 |
"""With a repository branch checkout location."""
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
64 |
self._build_branch() |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
65 |
self.run_bzr('init-repo repo') |
66 |
self.run_bzr('branch test repo/test') |
|
67 |
self.run_bzr('checkout repo/test test-checkout') |
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
68 |
self._check_revision_history('test-checkout') |
69 |
||
70 |
def test_revision_history_with_lightweight_checkout(self): |
|
6423.1.1
by Vincent Ladeuil
Cleanup old blackbox tests and then some. Remove os.chdir() calls, caught a few bugs, make sure we don't leave file handles opened. |
71 |
"""With a repository branch lightweight checkout location."""
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
72 |
self._build_branch() |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
73 |
self.run_bzr('init-repo repo') |
74 |
self.run_bzr('branch test repo/test') |
|
75 |
self.run_bzr('checkout --lightweight repo/test test-checkout') |
|
1733.2.1
by Michael Ellerman
Add an optional location parameter to the 'revision-history' command. |
76 |
self._check_revision_history('test-checkout') |