~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2008-07-28 06:53:44 UTC
  • mfrom: (3581 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3583.
  • Revision ID: andrew.bennetts@canonical.com-20080728065344-ocndjoycs903q6fz
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Tests for the info command of bzr."""
19
19
 
20
 
import os
21
20
import sys
22
21
 
23
 
import bzrlib
24
22
from bzrlib import (
 
23
    branch,
25
24
    bzrdir,
26
25
    errors,
27
26
    info,
28
27
    osutils,
29
 
    repository,
 
28
    upgrade,
30
29
    urlutils,
31
30
    )
32
31
from bzrlib.osutils import format_date
155
154
        # (creates backup as unknown)
156
155
        branch1.bzrdir.sprout('bound')
157
156
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
158
 
        bzrlib.upgrade.upgrade('bound', knit1_format)
159
 
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
 
157
        upgrade.upgrade('bound', knit1_format)
 
158
        branch3 = bzrdir.BzrDir.open('bound').open_branch()
160
159
        branch3.bind(branch1)
161
160
        bound_tree = branch3.bzrdir.open_workingtree()
162
161
        out, err = self.run_bzr('info -v bound')
202
201
        self.assertEqual('', err)
203
202
 
204
203
        # Checkout standalone (same as above, but does not have parent set)
205
 
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
 
204
        branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
206
205
            format=knit1_format)
207
206
        branch4.bind(branch1)
208
207
        branch4.bzrdir.open_workingtree().update()
248
247
        branch5 = tree5.branch
249
248
        out, err = self.run_bzr('info -v lightcheckout')
250
249
        self.assertEqualDiff(
251
 
"""Lightweight checkout (format: dirstate or dirstate-tags or \
 
250
"""Lightweight checkout (format: 1.6 or 1.6-rich-root \
 
251
or dirstate or dirstate-tags or \
252
252
pack-0.92 or rich-root or rich-root-pack)
253
253
Location:
254
254
  light checkout root: lightcheckout
415
415
        # Out of date lightweight checkout
416
416
        out, err = self.run_bzr('info lightcheckout --verbose')
417
417
        self.assertEqualDiff(
418
 
"""Lightweight checkout (format: dirstate or dirstate-tags or \
 
418
"""Lightweight checkout (format: 1.6 or 1.6-rich-root or \
 
419
dirstate or dirstate-tags or \
419
420
pack-0.92 or rich-root or rich-root-pack)
420
421
Location:
421
422
  light checkout root: lightcheckout
551
552
        datestring_first = format_date(rev.timestamp, rev.timezone)
552
553
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
553
554
        self.assertEqualDiff(
554
 
"""Lightweight checkout (format: dirstate or dirstate-tags or \
 
555
"""Lightweight checkout (format: 1.6 or 1.6-rich-root or \
 
556
dirstate or dirstate-tags or \
555
557
pack-0.92 or rich-root or rich-root-pack)
556
558
Location:
557
559
  light checkout root: tree/lightcheckout
674
676
        datestring_last = format_date(rev.timestamp, rev.timezone)
675
677
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
676
678
        self.assertEqualDiff(
677
 
"""Lightweight checkout (format: dirstate or dirstate-tags or \
 
679
"""Lightweight checkout (format: 1.6 or 1.6-rich-root or \
 
680
dirstate or dirstate-tags or \
678
681
pack-0.92 or rich-root or rich-root-pack)
679
682
Location:
680
683
  light checkout root: tree/lightcheckout
1089
1092
            (False, True): 'Lightweight checkout',
1090
1093
            (False, False): 'Checkout',
1091
1094
            }[(shared_repo is not None, light_checkout)]
1092
 
        format = {True: 'dirstate or dirstate-tags or pack-0.92'
 
1095
        format = {True: '1.6 or 1.6-rich-root'
 
1096
                        ' or dirstate or dirstate-tags or pack-0.92'
1093
1097
                        ' or rich-root or rich-root-pack',
1094
1098
                  False: 'dirstate'}[light_checkout]
1095
1099
        if repo_locked:
1181
1185
        transport = self.get_transport()
1182
1186
        # Create shared repository with a branch
1183
1187
        repo = self.make_repository('repo', shared=True,
1184
 
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1188
                                    format=bzrdir.BzrDirMetaFormat1())
1185
1189
        repo.set_make_working_trees(False)
1186
1190
        repo.bzrdir.root_transport.mkdir('branch')
1187
1191
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1188
 
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1192
                                    format=bzrdir.BzrDirMetaFormat1())
1189
1193
        # Do a heavy checkout
1190
1194
        transport.mkdir('tree')
1191
1195
        transport.mkdir('tree/checkout')
1192
 
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1193
 
            format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1196
        co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
 
1197
            format=bzrdir.BzrDirMetaFormat1())
1194
1198
        co_branch.bind(repo_branch)
1195
1199
        # Do a light checkout of the heavy one
1196
1200
        transport.mkdir('tree/lightcheckout')
1197
 
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1198
 
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
 
1201
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
1202
        branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1199
1203
        lco_dir.create_workingtree()
1200
1204
        lco_tree = lco_dir.open_workingtree()
1201
1205
 
1294
1298
            raise TestSkipped("don't use oslocks on win32 in unix manner")
1295
1299
 
1296
1300
        tree = self.make_branch_and_tree('branch',
1297
 
                                         format=bzrlib.bzrdir.BzrDirFormat6())
 
1301
                                         format=bzrdir.BzrDirFormat6())
1298
1302
 
1299
1303
        # Test all permutations of locking the working tree, branch and repository
1300
1304
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1368
1372
       ), out)
1369
1373
        self.assertEqual('', err)
1370
1374
        tree.unlock()
 
1375
 
 
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')
 
1384
        self.assertEqual(
 
1385
"""Standalone tree (format: development1)
 
1386
Location:
 
1387
  branch root: newbranch
 
1388
 
 
1389
Related branches:
 
1390
  parent branch: mainline
 
1391
     stacked on: mainline
 
1392
""", out)
 
1393
        self.assertEqual("", err)