49
50
transport = self.get_transport()
51
52
# Create initial standalone branch
52
tree1 = self.make_branch_and_tree('standalone', 'weave')
53
tree1 = self.make_branch_and_tree('standalone', 'knit')
53
54
self.build_tree(['standalone/a'])
55
56
branch1 = tree1.branch
57
58
out, err = self.run_bzr('info standalone')
58
59
self.assertEqualDiff(
59
"""Standalone tree (format: weave)
60
"""Standalone tree (format: knit)
61
62
branch root: standalone
65
66
# Standalone branch - verbose mode
66
67
out, err = self.run_bzr('info standalone -v')
67
68
self.assertEqualDiff(
68
"""Standalone tree (format: weave)
69
"""Standalone tree (format: knit)
70
71
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
74
control: Meta directory format 1
75
working tree: Working tree format 3
76
branch: Branch format 5
77
repository: Knit repository format 1
78
79
In the working tree:
96
97
# Standalone branch - really verbose mode
97
98
out, err = self.run_bzr('info standalone -vv')
98
99
self.assertEqualDiff(
99
"""Standalone tree (format: weave)
100
"""Standalone tree (format: knit)
101
102
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
105
control: Meta directory format 1
106
working tree: Working tree format 3
107
branch: Branch format 5
108
repository: Knit repository format 1
109
110
In the working tree:
126
127
self.assertEqual('', err)
127
128
tree1.commit('commit one')
128
rev = branch1.repository.get_revision(branch1.revision_history()[0])
129
rev = branch1.repository.get_revision(branch1.last_revision())
129
130
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
131
132
# Branch standalone with push location
155
156
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
159
control: Meta directory format 1
160
working tree: Working tree format 3
161
branch: Branch format 5
162
repository: Knit repository format 1
163
164
In the working tree:
187
188
branch1.bzrdir.sprout('bound')
188
189
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
189
190
upgrade.upgrade('bound', knit1_format)
190
branch3 = bzrdir.BzrDir.open('bound').open_branch()
191
branch3 = controldir.ControlDir.open('bound').open_branch()
191
192
branch3.bind(branch1)
192
193
bound_tree = branch3.bzrdir.open_workingtree()
193
194
out, err = self.run_bzr('info -v bound')
232
233
self.assertEqual('', err)
234
235
# Checkout standalone (same as above, but does not have parent set)
235
branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
236
branch4 = controldir.ControlDir.create_branch_convenience('checkout',
236
237
format=knit1_format)
237
238
branch4.bind(branch1)
238
239
branch4.bzrdir.open_workingtree().update()
276
277
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
277
278
branch5 = tree5.branch
278
279
out, err = self.run_bzr('info -v lightcheckout')
280
if "metaweave" in bzrdir.format_registry:
281
format_description = "knit or metaweave"
283
format_description = "knit"
279
284
self.assertEqualDiff(
280
285
"""Lightweight checkout (format: %s)
286
291
control: Meta directory format 1
287
working tree: Working tree format 6
288
branch: Branch format 4
289
repository: Weave repository format 6
292
working tree: Working tree format 3
293
branch: Branch format 5
294
repository: Knit repository format 1
291
296
In the working tree:
309
""" % (self._repo_strings, datestring_first, datestring_first,), out)
314
""" % (format_description, datestring_first, datestring_first,), out)
310
315
self.assertEqual('', err)
312
317
# Update initial standalone branch
313
318
self.build_tree(['standalone/b'])
315
320
tree1.commit('commit two')
316
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
321
rev = branch1.repository.get_revision(branch1.last_revision())
317
322
datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
319
324
# Out of date branched standalone branch will not be detected
320
325
out, err = self.run_bzr('info -v branch')
321
326
self.assertEqualDiff(
322
"""Standalone tree (format: weave)
327
"""Standalone tree (format: knit)
324
329
branch root: branch
328
333
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
336
control: Meta directory format 1
337
working tree: Working tree format 3
338
branch: Branch format 5
339
repository: Knit repository format 1
336
341
In the working tree:
448
453
control: Meta directory format 1
449
working tree: Working tree format 6
450
branch: Branch format 4
451
repository: Weave repository format 6
454
working tree: Working tree format 3
455
branch: Branch format 5
456
repository: Knit repository format 1
453
458
Working tree is out of date: missing 1 revision.
473
""" % (self._repo_strings, datestring_first, datestring_last,), out)
478
""" % (format_description, datestring_first, datestring_last,), out)
474
479
self.assertEqual('', err)
476
481
def test_info_standalone_no_tree(self):
526
531
# Create branch inside shared repository
527
532
repo.bzrdir.root_transport.mkdir('branch')
528
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
533
branch1 = controldir.ControlDir.create_branch_convenience(
534
'repo/branch', format=format)
530
535
out, err = self.run_bzr('info -v repo/branch')
531
536
self.assertEqualDiff(
532
537
"""Repository branch (format: dirstate or knit)
567
572
self.build_tree(['tree/lightcheckout/a'])
569
574
tree2.commit('commit one')
570
rev = repo.get_revision(branch2.revision_history()[0])
575
rev = repo.get_revision(branch2.last_revision())
571
576
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
572
577
out, err = self.run_bzr('info tree/lightcheckout --verbose')
573
578
self.assertEqualDiff(
686
691
tree3.commit('commit two')
688
693
# Out of date lightweight checkout
689
rev = repo.get_revision(branch1.revision_history()[-1])
694
rev = repo.get_revision(branch1.last_revision())
690
695
datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
691
696
out, err = self.run_bzr('info tree/lightcheckout --verbose')
692
697
self.assertEqualDiff(
800
805
# Create two branches
801
806
repo.bzrdir.root_transport.mkdir('branch1')
802
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
807
branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
804
809
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
842
847
tree1 = branch1.bzrdir.open_workingtree()
844
849
tree1.commit('commit one')
845
rev = repo.get_revision(branch1.revision_history()[0])
850
rev = repo.get_revision(branch1.last_revision())
846
851
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
847
852
out, err = self.run_bzr('info -v repo/branch1')
848
853
self.assertEqualDiff(
1217
1222
format=bzrdir.BzrDirMetaFormat1())
1218
1223
repo.set_make_working_trees(False)
1219
1224
repo.bzrdir.root_transport.mkdir('branch')
1220
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1221
format=bzrdir.BzrDirMetaFormat1())
1225
repo_branch = controldir.ControlDir.create_branch_convenience(
1226
'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1222
1227
# Do a heavy checkout
1223
1228
transport.mkdir('tree')
1224
1229
transport.mkdir('tree/checkout')
1225
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1226
format=bzrdir.BzrDirMetaFormat1())
1230
co_branch = controldir.ControlDir.create_branch_convenience(
1231
'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
1227
1232
co_branch.bind(repo_branch)
1228
1233
# Do a light checkout of the heavy one
1229
1234
transport.mkdir('tree/lightcheckout')
1323
1328
self.knownFailure('Win32 cannot run "bzr info"'
1324
1329
' 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
1331
def test_info_stacked(self):
1410
1332
# We have a mainline
1411
1333
trunk_tree = self.make_branch_and_tree('mainline',
1424
1346
stacked on: mainline
1426
1348
self.assertEqual("", err)
1350
def test_info_revinfo_optional(self):
1351
tree = self.make_branch_and_tree('.')
1352
def last_revision_info(self):
1353
raise errors.UnsupportedOperation(last_revision_info, self)
1355
branch.Branch, "last_revision_info", last_revision_info)
1356
out, err = self.run_bzr('info -v .')
1358
"""Standalone tree (format: 2a)
1363
control: Meta directory format 1
1364
working tree: Working tree format 6
1365
branch: Branch format 7
1366
repository: Repository format 2a - rich roots, group compression and chk inventories
1368
In the working tree:
1376
0 versioned subdirectories
1378
self.assertEqual("", err)