/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/info.py

Simplified construct detection in location overview a lot.
Renamed bound branches to checkouts and added prefix light to lightweight
checkouts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
def _show_location_info(repository, branch=None, working=None):
66
66
    """Show known locations for working, branch and repository."""
 
67
    repository_path = repository.bzrdir.root_transport.base
67
68
    print 'Location:'
68
 
    repo_path = repository.bzrdir.root_transport.base
69
 
    if branch:
 
69
    if working and branch:
 
70
        working_path = working.bzrdir.root_transport.base
70
71
        branch_path = branch.bzrdir.root_transport.base
71
 
        if repository.bzrdir == branch.bzrdir:
72
 
            if working:
73
 
                work_path = working.bzrdir.root_transport.base
74
 
                if working.bzrdir == branch.bzrdir:
75
 
                    if repository.is_shared():
76
 
                        # checkout in root of repository
77
 
                        print '    shared repository: %s' % repo_path
78
 
                        print '  repository checkout: %s' % (
79
 
                            _repo_relpath(repo_path, work_path))
80
 
                    elif branch.get_bound_location():
81
 
                        # bound branch
82
 
                        print '      branch root: %s' % branch_path
83
 
                        print '  bound to branch: %s' % (
84
 
                            branch.get_bound_location())
85
 
                    else:
86
 
                        # standalone branch
87
 
                        print '  branch root: %s' % branch_path
88
 
                else:
89
 
                    # lightweight checkout of standalone branch
90
 
                    print '       checkout root: %s' % work_path
91
 
                    print '  checkout of branch: %s' % branch_path
 
72
        if working_path != branch_path:
 
73
            # lightweight checkout
 
74
            print '  light checkout root: %s' % working_path
 
75
            if repository.is_shared():
 
76
                # lightweight checkout of branch in shared repository
 
77
                print '    shared repository: %s' % repository_path
 
78
                print '    repository branch: %s' % (
 
79
                    _repo_relpath(repository_path, branch_path))
92
80
            else:
93
 
                # repository with a branch inside root
94
 
                if repository.is_shared():
95
 
                    print '  shared repository: %s' % repo_path
96
 
                    print '  repository branch: %s' % (
97
 
                        _repo_relpath(repo_path, branch_path))
98
 
                else:
99
 
                    print "this isn't possible, right? (1)"
 
81
                # lightweight checkout of standalone branch
 
82
                print '   checkout of branch: %s' % branch_path
 
83
        elif repository.is_shared():
 
84
            # branch with tree inside shared repository
 
85
            print '    shared repository: %s' % repository_path
 
86
            print '  repository checkout: %s' % (
 
87
                _repo_relpath(repository_path, branch_path))
 
88
        elif branch.get_bound_location():
 
89
            # normal checkout
 
90
            print '       checkout root: %s' % working_path
 
91
            print '  checkout of branch: %s' % branch.get_bound_location()
100
92
        else:
101
 
            if working:
102
 
                work_path = working.bzrdir.root_transport.base
103
 
                if working.bzrdir != branch.bzrdir and (working.bzrdir !=
104
 
                                                        repository.bzrdir):
105
 
                    if osutils.is_inside(osutils.normalizepath(repo_path),
106
 
                                         osutils.normalizepath(work_path)):
107
 
                        # lightweight checkout inside repository
108
 
                        print '    shared repository: %s' % repo_path
109
 
                        print '  repository checkout: %s' % (
110
 
                            _repo_relpath(repo_path, work_path))
111
 
                        print '    repository branch: %s' % (
112
 
                            _repo_relpath(repo_path, branch_path))
113
 
                    else:
114
 
                        # lightweight checkout outside repository
115
 
                        print '      checkout root: %s' % work_path
116
 
                        print '  shared repository: %s' % repo_path
117
 
                        print '  repository branch: %s' % (
118
 
                            _repo_relpath(repo_path, branch_path))
119
 
                else:
120
 
                    # working tree inside branch or inside root
121
 
                    # of shared repository
122
 
                    print '    shared repository: %s' % repo_path
123
 
                    if working.bzrdir == branch.bzrdir:
124
 
                        print '  repository checkout: %s' % (
125
 
                            _repo_relpath(repo_path, work_path))
126
 
                    else:
127
 
                        print '    repository branch: %s' % (
128
 
                            _repo_relpath(repo_path, branch_path))
129
 
            else:
130
 
                # repository with branch
131
 
                if repository.is_shared():
132
 
                    print '  shared repository: %s' % repo_path
133
 
                    print '  repository branch: %s' % (
134
 
                        _repo_relpath(repo_path, branch_path))
135
 
                else:
136
 
                    print "this isn't possible, right? (2)"
 
93
            # standalone
 
94
            print '  branch root: %s' % working_path
 
95
    elif branch:
 
96
        # branch is part of shared repository
 
97
        assert repository.is_shared()
 
98
        branch_path = branch.bzrdir.root_transport.base
 
99
        print '  shared repository: %s' % repository_path
 
100
        print '  repository branch: %s' % (
 
101
            _repo_relpath(repository_path, branch_path))
137
102
    else:
138
 
        # repository
139
 
        if repository.is_shared():
140
 
            print '  shared repository: %s' % repo_path
141
 
        else:
142
 
            print '  repository: %s' % repo_path
 
103
        # shared repository
 
104
        assert repository.is_shared()
 
105
        print '  shared repository: %s' % repository_path
143
106
 
144
107
 
145
108
def _show_related_info(branch):