~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_info.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2011 Canonical Ltd
 
1
# Copyright (C) 2007-2012 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
31
31
    def test_describe_standalone_layout(self):
32
32
        tree = self.make_branch_and_tree('tree')
33
33
        self.assertEqual('Empty control directory', info.describe_layout())
34
 
        self.assertEqual('Unshared repository with trees',
35
 
            info.describe_layout(tree.branch.repository))
 
34
        self.assertEqual(
 
35
            'Unshared repository with trees and colocated branches',
 
36
            info.describe_layout(tree.branch.repository, control=tree.bzrdir))
36
37
        tree.branch.repository.set_make_working_trees(False)
37
 
        self.assertEqual('Unshared repository',
38
 
            info.describe_layout(tree.branch.repository))
 
38
        self.assertEqual('Unshared repository with colocated branches',
 
39
            info.describe_layout(tree.branch.repository, control=tree.bzrdir))
39
40
        self.assertEqual('Standalone branch',
40
 
            info.describe_layout(tree.branch.repository, tree.branch))
 
41
            info.describe_layout(tree.branch.repository, tree.branch,
 
42
                control=tree.bzrdir))
41
43
        self.assertEqual('Standalone branchless tree',
42
 
            info.describe_layout(tree.branch.repository, None, tree))
 
44
            info.describe_layout(tree.branch.repository, None, tree,
 
45
                control=tree.bzrdir))
43
46
        self.assertEqual('Standalone tree',
44
 
            info.describe_layout(tree.branch.repository, tree.branch, tree))
 
47
            info.describe_layout(tree.branch.repository, tree.branch, tree,
 
48
                control=tree.bzrdir))
45
49
        tree.branch.bind(tree.branch)
46
50
        self.assertEqual('Bound branch',
47
 
            info.describe_layout(tree.branch.repository, tree.branch))
 
51
            info.describe_layout(tree.branch.repository, tree.branch,
 
52
                control=tree.bzrdir))
48
53
        self.assertEqual('Checkout',
49
 
            info.describe_layout(tree.branch.repository, tree.branch, tree))
 
54
            info.describe_layout(tree.branch.repository, tree.branch, tree,
 
55
                control=tree.bzrdir))
50
56
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
51
57
        self.assertEqual('Lightweight checkout',
52
58
            info.describe_layout(checkout.branch.repository, checkout.branch,
53
 
                                 checkout))
 
59
                                 checkout, control=tree.bzrdir))
54
60
 
55
61
    def test_describe_repository_layout(self):
56
62
        repository = self.make_repository('.', shared=True)
57
63
        tree = controldir.ControlDir.create_branch_convenience('tree',
58
64
            force_new_tree=True).bzrdir.open_workingtree()
59
 
        self.assertEqual('Shared repository with trees',
60
 
            info.describe_layout(tree.branch.repository))
 
65
        self.assertEqual('Shared repository with trees and colocated branches',
 
66
            info.describe_layout(tree.branch.repository, control=tree.bzrdir))
61
67
        repository.set_make_working_trees(False)
62
 
        self.assertEqual('Shared repository',
63
 
            info.describe_layout(tree.branch.repository))
 
68
        self.assertEqual('Shared repository with colocated branches',
 
69
            info.describe_layout(tree.branch.repository, control=tree.bzrdir))
64
70
        self.assertEqual('Repository branch',
65
 
            info.describe_layout(tree.branch.repository, tree.branch))
 
71
            info.describe_layout(tree.branch.repository, tree.branch,
 
72
                control=tree.bzrdir))
66
73
        self.assertEqual('Repository branchless tree',
67
 
            info.describe_layout(tree.branch.repository, None, tree))
 
74
            info.describe_layout(tree.branch.repository, None, tree,
 
75
                control=tree.bzrdir))
68
76
        self.assertEqual('Repository tree',
69
 
            info.describe_layout(tree.branch.repository, tree.branch, tree))
 
77
            info.describe_layout(tree.branch.repository, tree.branch, tree,
 
78
                control=tree.bzrdir))
70
79
        tree.branch.bind(tree.branch)
71
80
        self.assertEqual('Repository checkout',
72
 
            info.describe_layout(tree.branch.repository, tree.branch, tree))
 
81
            info.describe_layout(tree.branch.repository, tree.branch, tree,
 
82
                control=tree.bzrdir))
73
83
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
74
84
        self.assertEqual('Lightweight checkout',
75
85
            info.describe_layout(checkout.branch.repository, checkout.branch,
76
 
                                 checkout))
 
86
                                 checkout, control=tree.bzrdir))
77
87
 
78
88
    def assertTreeDescription(self, format):
79
89
        """Assert a tree's format description matches expectations"""
312
322
 
313
323
    def test_gather_related_braches(self):
314
324
        branch = self.make_branch('.')
315
 
        branch.set_public_branch('baz')
316
 
        branch.set_push_location('bar')
317
 
        branch.set_parent('foo')
318
 
        branch.set_submit_branch('qux')
 
325
        branch.lock_write()
 
326
        try:
 
327
            branch.set_public_branch('baz')
 
328
            branch.set_push_location('bar')
 
329
            branch.set_parent('foo')
 
330
            branch.set_submit_branch('qux')
 
331
        finally:
 
332
            branch.unlock()
319
333
        self.assertEqual(
320
334
            [('public branch', 'baz'), ('push branch', 'bar'),
321
335
             ('parent branch', 'foo'), ('submit branch', 'qux')],