1
# Copyright (C) 2006 by Canonical Ltd
2
# -*- coding: utf-8 -*-
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
"""Tests for the info command of bzr."""
22
from bzrlib.osutils import format_date
23
from bzrlib.tests import TestSkipped
24
from bzrlib.tests.blackbox import ExternalBase
27
class TestInfo(ExternalBase):
29
def test_info_standalone_trivial(self):
31
out, err = self.runbzr('info')
33
"""branch format: Bazaar-NG branch, format 6
43
0 versioned subdirectories
54
self.assertEqual('', err)
56
def test_info_up_to_date_checkout(self):
57
a_branch = self.make_branch_and_tree('branch')
58
self.runbzr('checkout branch checkout')
59
out, err = self.runbzr('info checkout')
61
"""working tree format: Bazaar-NG Working Tree format 3
63
branch format: Bazaar-NG branch, format 6
73
0 versioned subdirectories
82
""" % a_branch.bzrdir.root_transport.base,
84
self.assertEqual('', err)
86
def test_info_out_of_date_standalone_tree(self):
87
# FIXME the default format has to change for this to pass
88
# because it currently uses the branch last-revision marker.
89
raise TestSkipped('default format too old')
90
self.make_branch_and_tree('branch')
92
self.runbzr('checkout branch checkout')
93
self.build_tree(['checkout/file'])
94
self.runbzr('add checkout/file')
95
self.runbzr('commit -m add-file checkout')
96
# now branch should be out of date
97
out,err = self.runbzr('update branch')
99
"""branch format: Bazaar-NG branch, format 6
101
Working tree is out of date: missing 1 revision.
110
0 versioned subdirectories
119
""" % a_branch.bzrdir.root_transport.base,
121
self.assertEqual('', err)
123
def test_info_out_of_date_checkout(self):
124
# note this deliberately uses a checkout at 'None' to
125
# test the out of date message with a revision notin the
127
a_branch = self.make_branch('branch')
129
self.runbzr('checkout branch checkout')
130
self.runbzr('checkout branch checkout2')
131
self.build_tree(['checkout/file'])
132
self.runbzr('add checkout/file')
133
self.runbzr('commit -m add-file checkout')
134
# now checkout2 should be out of date
135
out,err = self.runbzr('info checkout2')
136
rev = a_branch.repository.get_revision(a_branch.revision_history()[0])
137
datestring = format_date(rev.timestamp, rev.timezone)
138
self.assertEqualDiff(
139
"""working tree format: Bazaar-NG Working Tree format 3
141
branch format: Bazaar-NG branch, format 6
143
Working tree is out of date: missing 1 revision.
152
0 versioned subdirectories
164
""" % (a_branch.bzrdir.root_transport.base,
169
self.assertEqual('', err)