151
149
""" % (datestring_first, datestring_first,
152
# poking at _revision_store isn't all that clean, but neither is
153
# having the ui test dependent on the exact overhead of a given store.
154
branch2.repository._revision_store.total_size(
155
branch2.repository.get_transaction())[1] / 1024,
157
151
self.assertEqual('', err)
160
154
# (creates backup as unknown)
161
155
branch1.bzrdir.sprout('bound')
162
156
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
163
bzrlib.upgrade.upgrade('bound', knit1_format)
164
branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
157
upgrade.upgrade('bound', knit1_format)
158
branch3 = bzrdir.BzrDir.open('bound').open_branch()
165
159
branch3.bind(branch1)
166
160
bound_tree = branch3.bzrdir.open_workingtree()
167
161
out, err = self.run_bzr('info -v bound')
203
196
""" % (bound_tree._format.get_format_description(),
204
197
branch3._format.get_format_description(),
205
198
branch3.repository._format.get_format_description(),
206
199
datestring_first, datestring_first,
207
# poking at _revision_store isn't all that clean, but neither is
208
# having the ui test dependent on the exact overhead of a given store.
209
branch3.repository._revision_store.total_size(
210
branch3.repository.get_transaction())[1] / 1024,
212
201
self.assertEqual('', err)
214
203
# Checkout standalone (same as above, but does not have parent set)
215
branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
204
branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
216
205
format=knit1_format)
217
206
branch4.bind(branch1)
218
207
branch4.bzrdir.open_workingtree().update()
252
240
""" % (branch4.repository._format.get_format_description(),
253
241
datestring_first, datestring_first,
254
# poking at _revision_store isn't all that clean, but neither is
255
# having the ui test dependent on the exact overhead of a given store.
256
branch4.repository._revision_store.total_size(
257
branch4.repository.get_transaction())[1] / 1024,
259
243
self.assertEqual('', err)
263
247
branch5 = tree5.branch
264
248
out, err = self.run_bzr('info -v lightcheckout')
265
249
self.assertEqualDiff(
266
"""Lightweight checkout (format: dirstate or dirstate-tags)
250
"""Lightweight checkout (format: 1.6 or 1.6-rich-root \
251
or dirstate or dirstate-tags or \
252
pack-0.92 or rich-root or rich-root-pack)
268
254
light checkout root: lightcheckout
269
255
checkout of branch: standalone
387
370
""" % (branch3.repository._format.get_format_description(),
388
371
datestring_first, datestring_first,
389
# poking at _revision_store isn't all that clean, but neither is
390
# having the ui test dependent on the exact overhead of a given store.
391
branch3.repository._revision_store.total_size(
392
branch3.repository.get_transaction())[1] / 1024,
394
373
self.assertEqual('', err)
432
410
""" % (branch4.repository._format.get_format_description(),
433
411
datestring_first, datestring_first,
434
# poking at _revision_store isn't all that clean, but neither is
435
# having the ui test dependent on the exact overhead of a given store.
436
branch4.repository._revision_store.total_size(
437
branch4.repository.get_transaction())[1] / 1024,
439
413
self.assertEqual('', err)
441
415
# Out of date lightweight checkout
442
416
out, err = self.run_bzr('info lightcheckout --verbose')
443
417
self.assertEqualDiff(
444
"""Lightweight checkout (format: dirstate or dirstate-tags)
418
"""Lightweight checkout (format: 1.6 or 1.6-rich-root or \
419
dirstate or dirstate-tags or \
420
pack-0.92 or rich-root or rich-root-pack)
446
422
light checkout root: lightcheckout
447
423
checkout of branch: standalone
503
""" % (format.get_branch_format().get_format_description(),
477
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
478
format.get_branch_format().get_format_description(),
504
479
format.repository_format.get_format_description(),
506
481
self.assertEqual('', err)
579
552
datestring_first = format_date(rev.timestamp, rev.timezone)
580
553
out, err = self.run_bzr('info tree/lightcheckout --verbose')
581
554
self.assertEqualDiff(
582
"""Lightweight checkout (format: dirstate or dirstate-tags)
555
"""Lightweight checkout (format: 1.6 or 1.6-rich-root or \
556
dirstate or dirstate-tags or \
557
pack-0.92 or rich-root or rich-root-pack)
584
559
light checkout root: tree/lightcheckout
585
560
checkout of branch: repo/branch
614
588
""" % (format.get_branch_format().get_format_description(),
615
589
format.repository_format.get_format_description(),
616
590
datestring_first, datestring_first,
617
# poking at _revision_store isn't all that clean, but neither is
618
# having the ui test dependent on the exact overhead of a given store.
619
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
621
592
self.assertEqual('', err)
698
667
""" % (format.get_branch_format().get_format_description(),
699
668
format.repository_format.get_format_description(),
700
669
datestring_first, datestring_first,
701
# poking at _revision_store isn't all that clean, but neither is
702
# having the ui test dependent on the exact overhead of a given store.
703
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
705
671
self.assertEqual('', err)
706
672
tree3.commit('commit two')
710
676
datestring_last = format_date(rev.timestamp, rev.timezone)
711
677
out, err = self.run_bzr('info tree/lightcheckout --verbose')
712
678
self.assertEqualDiff(
713
"""Lightweight checkout (format: dirstate or dirstate-tags)
679
"""Lightweight checkout (format: 1.6 or 1.6-rich-root or \
680
dirstate or dirstate-tags or \
681
pack-0.92 or rich-root or rich-root-pack)
715
683
light checkout root: tree/lightcheckout
716
684
checkout of branch: repo/branch
747
714
""" % (format.get_branch_format().get_format_description(),
748
715
format.repository_format.get_format_description(),
749
716
datestring_first, datestring_last,
750
# poking at _revision_store isn't all that clean, but neither is
751
# having the ui test dependent on the exact overhead of a given store.
752
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
754
718
self.assertEqual('', err)
779
742
""" % (format.get_branch_format().get_format_description(),
780
743
format.repository_format.get_format_description(),
781
744
datestring_first, datestring_last,
782
# poking at _revision_store isn't all that clean, but neither is
783
# having the ui test dependent on the exact overhead of a given store.
784
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
786
746
self.assertEqual('', err)
802
761
""" % (format.repository_format.get_format_description(),
803
# poking at _revision_store isn't all that clean, but neither is
804
# having the ui test dependent on the exact overhead of a given store.
805
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
807
763
self.assertEqual('', err)
917
870
""" % (format.get_branch_format().get_format_description(),
918
871
format.repository_format.get_format_description(),
919
872
datestring_first, datestring_first,
920
# poking at _revision_store isn't all that clean, but neither is
921
# having the ui test dependent on the exact overhead of a given store.
922
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
924
874
self.assertEqual('', err)
960
909
""" % (format.get_branch_format().get_format_description(),
961
910
format.repository_format.get_format_description(),
962
# poking at _revision_store isn't all that clean, but neither is
963
# having the ui test dependent on the exact overhead of a given store.
964
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
966
912
self.assertEqual('', err)
1007
952
""" % (format.get_branch_format().get_format_description(),
1008
953
format.repository_format.get_format_description(),
1009
954
datestring_first, datestring_first,
1010
# poking at _revision_store isn't all that clean, but neither is
1011
# having the ui test dependent on the exact overhead of a given store.
1012
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1014
956
self.assertEqual('', err)
1032
973
""" % (format.repository_format.get_format_description(),
1033
# poking at _revision_store isn't all that clean, but neither is
1034
# having the ui test dependent on the exact overhead of a given store.
1035
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1038
976
self.assertEqual('', err)
1100
1036
""" % (format.get_branch_format().get_format_description(),
1101
1037
format.repository_format.get_format_description(),
1103
1039
self.assertEqual('', err)
1105
def assertCheckoutStatusOutput(self,
1041
def assertCheckoutStatusOutput(self,
1106
1042
command_string, lco_tree, shared_repo=None,
1107
1043
repo_branch=None,
1108
1044
tree_locked=False,
1127
1063
:param tree_locked: If true, expect the tree to be locked.
1128
1064
:param branch_locked: If true, expect the branch to be locked.
1129
1065
:param repo_locked: If true, expect the repository to be locked.
1066
Note that the lco_tree.branch.repository is inspected, and if is not
1067
actually locked then this parameter is overridden. This is because
1068
pack repositories do not have any public API for obtaining an
1069
exclusive repository wide lock.
1130
1070
:param verbose: If true, expect verbose output
1132
1072
def friendly_location(url):
1136
1076
except errors.PathNotChild:
1139
if tree_locked and sys.platform == 'win32':
1140
# We expect this to fail because of locking errors. (A write-locked
1141
# file cannot be read-locked in the same process).
1080
# We expect this to fail because of locking errors.
1081
# (A write-locked file cannot be read-locked
1082
# in the different process -- either on win32 or on linux).
1142
1083
# This should be removed when the locking errors are fixed.
1143
self.run_bzr_error([], 'info ' + command_string)
1084
self.expectFailure('OS locks are exclusive '
1085
'for different processes (Bug #174055)',
1086
self.run_bzr_subprocess,
1087
'info ' + command_string)
1145
1088
out, err = self.run_bzr('info %s' % command_string)
1146
1089
description = {
1147
1090
(True, True): 'Lightweight checkout',
1149
1092
(False, True): 'Lightweight checkout',
1150
1093
(False, False): 'Checkout',
1151
1094
}[(shared_repo is not None, light_checkout)]
1152
format = {True: 'dirstate or dirstate-tags',
1095
format = {True: '1.6 or 1.6-rich-root'
1096
' or dirstate or dirstate-tags or pack-0.92'
1097
' or rich-root or rich-root-pack',
1153
1098
False: 'dirstate'}[light_checkout]
1100
repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1154
1101
if repo_locked or branch_locked or tree_locked:
1155
1102
def locked_message(a_bool):
1239
1185
transport = self.get_transport()
1240
1186
# Create shared repository with a branch
1241
1187
repo = self.make_repository('repo', shared=True,
1242
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1188
format=bzrdir.BzrDirMetaFormat1())
1243
1189
repo.set_make_working_trees(False)
1244
1190
repo.bzrdir.root_transport.mkdir('branch')
1245
1191
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1246
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1192
format=bzrdir.BzrDirMetaFormat1())
1247
1193
# Do a heavy checkout
1248
1194
transport.mkdir('tree')
1249
1195
transport.mkdir('tree/checkout')
1250
co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1251
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1196
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1197
format=bzrdir.BzrDirMetaFormat1())
1252
1198
co_branch.bind(repo_branch)
1253
1199
# Do a light checkout of the heavy one
1254
1200
transport.mkdir('tree/lightcheckout')
1255
lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1256
bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1201
lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1202
branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1257
1203
lco_dir.create_workingtree()
1258
1204
lco_tree = lco_dir.open_workingtree()
1352
1298
raise TestSkipped("don't use oslocks on win32 in unix manner")
1354
1300
tree = self.make_branch_and_tree('branch',
1355
format=bzrlib.bzrdir.BzrDirFormat6())
1301
format=bzrdir.BzrDirFormat6())
1357
1303
# Test all permutations of locking the working tree, branch and repository
1358
1304
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1427
1371
""" % ('branch', tree.branch.repository._format.get_format_description(),
1429
1373
self.assertEqual('', err)
1376
def test_info_stacked(self):
1377
# We have a mainline
1378
trunk_tree = self.make_branch_and_tree('mainline',
1379
format='development1')
1380
trunk_tree.commit('mainline')
1381
# and a branch from it which is stacked
1382
new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1383
out, err = self.run_bzr('info newbranch')
1385
"""Standalone tree (format: development1)
1387
branch root: newbranch
1390
parent branch: mainline
1391
stacked on: mainline
1393
self.assertEqual("", err)