~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_info.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-09 19:25:42 UTC
  • mto: (5777.5.1 inventoryworkingtree)
  • mto: This revision was merged to the branch mainline in revision 5781.
  • Revision ID: jelmer@samba.org-20110409192542-8bbedp36s7nj928e
Split InventoryTree out of Tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib import (
23
23
    branch,
24
24
    bzrdir,
25
 
    controldir,
26
25
    errors,
27
26
    info,
28
27
    osutils,
126
125
""", out)
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)
131
130
 
132
131
        # Branch standalone with push location
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)
234
233
 
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()
318
317
        self.build_tree(['standalone/b'])
319
318
        tree1.add('b')
320
319
        tree1.commit('commit two')
321
 
        rev = branch1.repository.get_revision(branch1.last_revision())
 
320
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
322
321
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
323
322
 
324
323
        # Out of date branched standalone branch will not be detected
530
529
 
531
530
        # Create branch inside shared repository
532
531
        repo.bzrdir.root_transport.mkdir('branch')
533
 
        branch1 = controldir.ControlDir.create_branch_convenience(
534
 
            'repo/branch', format=format)
 
532
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
 
533
            format=format)
535
534
        out, err = self.run_bzr('info -v repo/branch')
536
535
        self.assertEqualDiff(
537
536
"""Repository branch (format: dirstate or knit)
572
571
        self.build_tree(['tree/lightcheckout/a'])
573
572
        tree2.add('a')
574
573
        tree2.commit('commit one')
575
 
        rev = repo.get_revision(branch2.last_revision())
 
574
        rev = repo.get_revision(branch2.revision_history()[0])
576
575
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
577
576
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
578
577
        self.assertEqualDiff(
691
690
        tree3.commit('commit two')
692
691
 
693
692
        # Out of date lightweight checkout
694
 
        rev = repo.get_revision(branch1.last_revision())
 
693
        rev = repo.get_revision(branch1.revision_history()[-1])
695
694
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
696
695
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
697
696
        self.assertEqualDiff(
804
803
 
805
804
        # Create two branches
806
805
        repo.bzrdir.root_transport.mkdir('branch1')
807
 
        branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
 
806
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
808
807
            format=format)
809
808
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
810
809
 
847
846
        tree1 = branch1.bzrdir.open_workingtree()
848
847
        tree1.add('a')
849
848
        tree1.commit('commit one')
850
 
        rev = repo.get_revision(branch1.last_revision())
 
849
        rev = repo.get_revision(branch1.revision_history()[0])
851
850
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
852
851
        out, err = self.run_bzr('info -v repo/branch1')
853
852
        self.assertEqualDiff(
1222
1221
                                    format=bzrdir.BzrDirMetaFormat1())
1223
1222
        repo.set_make_working_trees(False)
1224
1223
        repo.bzrdir.root_transport.mkdir('branch')
1225
 
        repo_branch = controldir.ControlDir.create_branch_convenience(
1226
 
            'repo/branch', format=bzrdir.BzrDirMetaFormat1())
 
1224
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
 
1225
                                    format=bzrdir.BzrDirMetaFormat1())
1227
1226
        # Do a heavy checkout
1228
1227
        transport.mkdir('tree')
1229
1228
        transport.mkdir('tree/checkout')
1230
 
        co_branch = controldir.ControlDir.create_branch_convenience(
1231
 
            'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
 
1229
        co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
 
1230
            format=bzrdir.BzrDirMetaFormat1())
1232
1231
        co_branch.bind(repo_branch)
1233
1232
        # Do a light checkout of the heavy one
1234
1233
        transport.mkdir('tree/lightcheckout')
1346
1345
     stacked on: mainline
1347
1346
""", out)
1348
1347
        self.assertEqual("", err)
1349
 
 
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)
1354
 
        self.overrideAttr(
1355
 
            branch.Branch, "last_revision_info", last_revision_info)
1356
 
        out, err = self.run_bzr('info -v .')
1357
 
        self.assertEqual(
1358
 
"""Standalone tree (format: 2a)
1359
 
Location:
1360
 
  branch root: .
1361
 
 
1362
 
Format:
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
1367
 
 
1368
 
In the working tree:
1369
 
         0 unchanged
1370
 
         0 modified
1371
 
         0 added
1372
 
         0 removed
1373
 
         0 renamed
1374
 
         0 unknown
1375
 
         0 ignored
1376
 
         0 versioned subdirectories
1377
 
""", out)
1378
 
        self.assertEqual("", err)