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