45
47
self.assertEqual(out, '')
46
48
self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
50
def test_info_empty_controldir(self):
51
self.make_bzrdir('ctrl')
52
out, err = self.run_bzr('info ctrl')
53
self.assertEquals(out,
54
'Empty control directory (format: 1.14 or 1.14-rich-root or 2a or pack-0.92)\n'
56
' control directory: ctrl\n')
57
self.assertEquals(err, '')
59
def test_info_dangling_branch_reference(self):
60
br = self.make_branch('target')
61
br.create_checkout('from', lightweight=True)
62
shutil.rmtree('target')
63
out, err = self.run_bzr('info from')
64
self.assertEquals(out,
65
'Dangling branch reference (format: 1.14 or 1.14-rich-root or 2a or pack-0.92)\n'
67
' control directory: from\n'
68
' checkout of branch: target\n')
69
self.assertEquals(err, '')
48
71
def test_info_standalone(self):
49
72
transport = self.get_transport()
51
74
# Create initial standalone branch
52
tree1 = self.make_branch_and_tree('standalone', 'weave')
75
tree1 = self.make_branch_and_tree('standalone', 'knit')
53
76
self.build_tree(['standalone/a'])
55
78
branch1 = tree1.branch
57
80
out, err = self.run_bzr('info standalone')
58
81
self.assertEqualDiff(
59
"""Standalone tree (format: weave)
82
"""Standalone tree (format: knit)
61
84
branch root: standalone
65
88
# Standalone branch - verbose mode
66
89
out, err = self.run_bzr('info standalone -v')
67
90
self.assertEqualDiff(
68
"""Standalone tree (format: weave)
91
"""Standalone tree (format: knit)
70
93
branch root: standalone
73
control: All-in-one format 6
74
working tree: Working tree format 2
75
branch: Branch format 4
76
repository: Weave repository format 6
96
control: Meta directory format 1
97
working tree: Working tree format 3
98
branch: Branch format 5
99
repository: Knit repository format 1
78
101
In the working tree:
96
119
# Standalone branch - really verbose mode
97
120
out, err = self.run_bzr('info standalone -vv')
98
121
self.assertEqualDiff(
99
"""Standalone tree (format: weave)
122
"""Standalone tree (format: knit)
101
124
branch root: standalone
104
control: All-in-one format 6
105
working tree: Working tree format 2
106
branch: Branch format 4
107
repository: Weave repository format 6
127
control: Meta directory format 1
128
working tree: Working tree format 3
129
branch: Branch format 5
130
repository: Knit repository format 1
109
132
In the working tree:
126
149
self.assertEqual('', err)
127
150
tree1.commit('commit one')
128
rev = branch1.repository.get_revision(branch1.revision_history()[0])
151
rev = branch1.repository.get_revision(branch1.last_revision())
129
152
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
131
154
# Branch standalone with push location
155
178
parent branch: standalone
158
control: All-in-one format 6
159
working tree: Working tree format 2
160
branch: Branch format 4
161
repository: Weave repository format 6
181
control: Meta directory format 1
182
working tree: Working tree format 3
183
branch: Branch format 5
184
repository: Knit repository format 1
163
186
In the working tree:
187
210
branch1.bzrdir.sprout('bound')
188
211
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
189
212
upgrade.upgrade('bound', knit1_format)
190
branch3 = bzrdir.BzrDir.open('bound').open_branch()
213
branch3 = controldir.ControlDir.open('bound').open_branch()
191
214
branch3.bind(branch1)
192
215
bound_tree = branch3.bzrdir.open_workingtree()
193
216
out, err = self.run_bzr('info -v bound')
232
255
self.assertEqual('', err)
234
257
# Checkout standalone (same as above, but does not have parent set)
235
branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
258
branch4 = controldir.ControlDir.create_branch_convenience('checkout',
236
259
format=knit1_format)
237
260
branch4.bind(branch1)
238
261
branch4.bzrdir.open_workingtree().update()
276
299
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
277
300
branch5 = tree5.branch
278
301
out, err = self.run_bzr('info -v lightcheckout')
302
if "metaweave" in bzrdir.format_registry:
303
format_description = "knit or metaweave"
305
format_description = "knit"
279
306
self.assertEqualDiff(
280
307
"""Lightweight checkout (format: %s)
286
313
control: Meta directory format 1
287
working tree: Working tree format 6
288
branch: Branch format 4
289
repository: Weave repository format 6
314
working tree: Working tree format 3
315
branch: Branch format 5
316
repository: Knit repository format 1
291
318
In the working tree:
309
""" % (self._repo_strings, datestring_first, datestring_first,), out)
336
""" % (format_description, datestring_first, datestring_first,), out)
310
337
self.assertEqual('', err)
312
339
# Update initial standalone branch
313
340
self.build_tree(['standalone/b'])
315
342
tree1.commit('commit two')
316
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
343
rev = branch1.repository.get_revision(branch1.last_revision())
317
344
datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
319
346
# Out of date branched standalone branch will not be detected
320
347
out, err = self.run_bzr('info -v branch')
321
348
self.assertEqualDiff(
322
"""Standalone tree (format: weave)
349
"""Standalone tree (format: knit)
324
351
branch root: branch
328
355
parent branch: standalone
331
control: All-in-one format 6
332
working tree: Working tree format 2
333
branch: Branch format 4
334
repository: Weave repository format 6
358
control: Meta directory format 1
359
working tree: Working tree format 3
360
branch: Branch format 5
361
repository: Knit repository format 1
336
363
In the working tree:
448
475
control: Meta directory format 1
449
working tree: Working tree format 6
450
branch: Branch format 4
451
repository: Weave repository format 6
476
working tree: Working tree format 3
477
branch: Branch format 5
478
repository: Knit repository format 1
453
480
Working tree is out of date: missing 1 revision.
473
""" % (self._repo_strings, datestring_first, datestring_last,), out)
500
""" % (format_description, datestring_first, datestring_last,), out)
474
501
self.assertEqual('', err)
476
503
def test_info_standalone_no_tree(self):
526
553
# Create branch inside shared repository
527
554
repo.bzrdir.root_transport.mkdir('branch')
528
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
555
branch1 = controldir.ControlDir.create_branch_convenience(
556
'repo/branch', format=format)
530
557
out, err = self.run_bzr('info -v repo/branch')
531
558
self.assertEqualDiff(
532
559
"""Repository branch (format: dirstate or knit)
567
594
self.build_tree(['tree/lightcheckout/a'])
569
596
tree2.commit('commit one')
570
rev = repo.get_revision(branch2.revision_history()[0])
597
rev = repo.get_revision(branch2.last_revision())
571
598
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
572
599
out, err = self.run_bzr('info tree/lightcheckout --verbose')
573
600
self.assertEqualDiff(
686
713
tree3.commit('commit two')
688
715
# Out of date lightweight checkout
689
rev = repo.get_revision(branch1.revision_history()[-1])
716
rev = repo.get_revision(branch1.last_revision())
690
717
datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
691
718
out, err = self.run_bzr('info tree/lightcheckout --verbose')
692
719
self.assertEqualDiff(
800
827
# Create two branches
801
828
repo.bzrdir.root_transport.mkdir('branch1')
802
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
829
branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
804
831
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
842
869
tree1 = branch1.bzrdir.open_workingtree()
844
871
tree1.commit('commit one')
845
rev = repo.get_revision(branch1.revision_history()[0])
872
rev = repo.get_revision(branch1.last_revision())
846
873
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
847
874
out, err = self.run_bzr('info -v repo/branch1')
848
875
self.assertEqualDiff(
1217
1244
format=bzrdir.BzrDirMetaFormat1())
1218
1245
repo.set_make_working_trees(False)
1219
1246
repo.bzrdir.root_transport.mkdir('branch')
1220
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1221
format=bzrdir.BzrDirMetaFormat1())
1247
repo_branch = controldir.ControlDir.create_branch_convenience(
1248
'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1222
1249
# Do a heavy checkout
1223
1250
transport.mkdir('tree')
1224
1251
transport.mkdir('tree/checkout')
1225
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1226
format=bzrdir.BzrDirMetaFormat1())
1252
co_branch = controldir.ControlDir.create_branch_convenience(
1253
'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
1227
1254
co_branch.bind(repo_branch)
1228
1255
# Do a light checkout of the heavy one
1229
1256
transport.mkdir('tree/lightcheckout')
1323
1350
self.knownFailure('Win32 cannot run "bzr info"'
1324
1351
' when the tree is locked.')
1326
def test_info_locking_oslocks(self):
1327
if sys.platform == "win32":
1328
self.skip("don't use oslocks on win32 in unix manner")
1329
# This test tests old (all-in-one, OS lock using) behaviour which
1330
# simply cannot work on windows (and is indeed why we changed our
1331
# design. As such, don't try to remove the thisFailsStrictLockCheck
1333
self.thisFailsStrictLockCheck()
1335
tree = self.make_branch_and_tree('branch',
1336
format=bzrdir.BzrDirFormat6())
1338
# Test all permutations of locking the working tree, branch and repository
1339
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1340
# implemented by raising NotImplementedError and get_physical_lock_status()
1341
# always returns false. This makes bzr info hide the lock status. (Olaf)
1345
out, err = self.run_bzr('info -v branch')
1346
self.assertEqualDiff(
1347
"""Standalone tree (format: weave)
1352
control: All-in-one format 6
1353
working tree: Working tree format 2
1354
branch: Branch format 4
1357
In the working tree:
1365
0 versioned subdirectories
1372
""" % ('branch', tree.branch.repository._format.get_format_description(),
1374
self.assertEqual('', err)
1377
out, err = self.run_bzr('info -v branch')
1378
self.assertEqualDiff(
1379
"""Standalone tree (format: weave)
1384
control: All-in-one format 6
1385
working tree: Working tree format 2
1386
branch: Branch format 4
1389
In the working tree:
1397
0 versioned subdirectories
1404
""" % ('branch', tree.branch.repository._format.get_format_description(),
1406
self.assertEqual('', err)
1409
1353
def test_info_stacked(self):
1410
1354
# We have a mainline
1411
1355
trunk_tree = self.make_branch_and_tree('mainline',
1424
1368
stacked on: mainline
1426
1370
self.assertEqual("", err)
1372
def test_info_revinfo_optional(self):
1373
tree = self.make_branch_and_tree('.')
1374
def last_revision_info(self):
1375
raise errors.UnsupportedOperation(last_revision_info, self)
1377
branch.Branch, "last_revision_info", last_revision_info)
1378
out, err = self.run_bzr('info -v .')
1380
"""Standalone tree (format: 2a)
1385
control: Meta directory format 1
1386
working tree: Working tree format 6
1387
branch: Branch format 7
1388
repository: Repository format 2a - rich roots, group compression and chk inventories
1390
In the working tree:
1398
0 versioned subdirectories
1400
self.assertEqual("", err)
1402
def test_info_shows_colocated_branches(self):
1403
bzrdir = self.make_branch('.', format='development-colo').bzrdir
1404
bzrdir.create_branch(name="colo1")
1405
bzrdir.create_branch(name="colo2")
1406
bzrdir.create_branch(name="colo3")
1407
out, err = self.run_bzr('info -v .')
1408
self.assertEqualDiff(
1409
"""Standalone branch (format: development-colo)
1414
control: Meta directory format 1 with support for colocated branches
1415
branch: Branch format 7
1416
repository: Repository format 2a - rich roots, group compression and chk inventories
1427
self.assertEqual("", err)