14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
class TestRevisionHistory(tests.TestCaseWithTransport):
18
from bzrlib.tests import TestCaseWithTransport
19
from bzrlib.branch import Branch
22
class TestRevisionHistory(TestCaseWithTransport):
25
24
def _build_branch(self):
26
25
# setup a standalone branch with three commits
27
26
tree = self.make_branch_and_tree('test')
28
with open('test/foo', 'wb') as f:
27
open('test/foo', 'wb').write('1111\n')
31
29
tree.commit('added foo',rev_id='revision_1')
32
with open('test/foo', 'wb')as f:
30
open('test/foo', 'wb').write('2222\n')
34
31
tree.commit('updated foo',rev_id='revision_2')
35
with open('test/foo', 'wb')as f:
32
open('test/foo', 'wb').write('3333\n')
37
33
tree.commit('updated foo again',rev_id='revision_3')
40
def _check_revision_history(self, location='', working_dir=None):
41
rh = self.run_bzr(['revision-history', location],
42
working_dir=working_dir)[0]
36
def _check_revision_history(self, location=''):
37
rh = self.run_bzr(['revision-history', location])[0]
43
38
self.assertEqual(rh, 'revision_1\nrevision_2\nrevision_3\n')
45
40
def test_revision_history(self):
41
"""Tests 'revision_history' command"""
47
42
self._build_branch()
48
self._check_revision_history(working_dir='test')
44
self._check_revision_history()
50
46
def test_revision_history_with_location(self):
51
"""With a specified location."""
47
"""Tests 'revision_history' command with a specified location."""
52
48
self._build_branch()
53
49
self._check_revision_history('test')
55
51
def test_revision_history_with_repo_branch(self):
56
"""With a repository branch location."""
52
"""Tests 'revision_history' command with a location that is a
57
54
self._build_branch()
58
55
self.run_bzr('init-repo repo')
59
56
self.run_bzr('branch test repo/test')
60
57
self._check_revision_history('repo/test')
62
59
def test_revision_history_with_checkout(self):
63
"""With a repository branch checkout location."""
60
"""Tests 'revision_history' command with a location that is a
61
checkout of a repository branch."""
64
62
self._build_branch()
65
63
self.run_bzr('init-repo repo')
66
64
self.run_bzr('branch test repo/test')