49
def _show_location_info(repository=None, branch=None, working=None):
41
def _repo_relpath(repo_path, path):
42
"""Return path with common prefix of repository path removed.
44
If path is not part of the repository, the original path is returned.
45
If path is equal to the repository, the current directory marker '.' is
48
path = osutils.normalizepath(path)
49
repo_path = osutils.normalizepath(repo_path)
52
if osutils.is_inside(repo_path, path):
53
return osutils.relpath(repo_path, path)
57
def _show_location_info(repository, branch=None, working=None):
50
58
"""Show known locations for working, branch and repository."""
59
repository_path = repository.bzrdir.root_transport.base
52
if working and branch and working.bzrdir != branch.bzrdir:
53
# Lightweight checkout
54
print ' checkout root: %s' % (
55
working.bzrdir.root_transport.base)
56
print ' checkout of branch: %s' % (
57
branch.bzrdir.root_transport.base)
61
if working and branch:
62
working_path = working.bzrdir.root_transport.base
63
branch_path = branch.bzrdir.root_transport.base
64
if working_path != branch_path:
65
# lightweight checkout
66
print ' light checkout root: %s' % working_path
67
if repository.is_shared():
68
# lightweight checkout of branch in shared repository
69
print ' shared repository: %s' % repository_path
70
print ' repository branch: %s' % (
71
_repo_relpath(repository_path, branch_path))
73
# lightweight checkout of standalone branch
74
print ' checkout of branch: %s' % branch_path
75
elif repository.is_shared():
76
# branch with tree inside shared repository
77
print ' shared repository: %s' % repository_path
78
print ' repository checkout: %s' % (
79
_repo_relpath(repository_path, branch_path))
80
elif branch.get_bound_location():
82
print ' checkout root: %s' % working_path
83
print ' checkout of branch: %s' % branch.get_bound_location()
86
print ' branch root: %s' % working_path
59
# Standalone or bound branch (normal checkout)
60
print ' branch root: %s' % (
61
branch.bzrdir.root_transport.base)
62
if branch.get_bound_location():
63
print ' bound to branch: %s' % branch.get_bound_location()
65
if repository and (not branch or repository.bzrdir != branch.bzrdir):
66
if repository.is_shared():
67
print ' shared repository: %s' % (
68
repository.bzrdir.root_transport.base)
70
print ' repository: %s' % (
71
repository.bzrdir.root_transport.base)
88
# branch is part of shared repository
89
assert repository.is_shared()
90
branch_path = branch.bzrdir.root_transport.base
91
print ' shared repository: %s' % repository_path
92
print ' repository branch: %s' % (
93
_repo_relpath(repository_path, branch_path))
96
assert repository.is_shared()
97
print ' shared repository: %s' % repository_path
100
def _show_related_info(branch):
101
"""Show parent and push location of branch."""
102
if branch.get_parent() or branch.get_push_location():
104
print 'Related branches:'
74
105
if branch.get_parent():
75
print ' parent branch: %s' % branch.get_parent()
106
if branch.get_push_location():
107
print ' parent branch: %s' % branch.get_parent()
109
print ' parent branch: %s' % branch.get_parent()
76
110
if branch.get_push_location():
77
print ' push to branch: %s' % branch.get_push_location()
111
print ' publish to branch: %s' % branch.get_push_location()
80
114
def _show_format_info(control=None, repository=None, branch=None, working=None):
91
125
print ' repository: %s' % repository._format.get_format_description()
128
def _show_locking_info(repository, branch=None, working=None):
129
"""Show locking status of working, branch and repository."""
130
if (repository.get_physical_lock_status() or
131
(branch and branch.get_physical_lock_status()) or
132
(working and working.get_physical_lock_status())):
136
if working.get_physical_lock_status():
140
print ' working tree: %s' % status
142
if branch.get_physical_lock_status():
146
print ' branch: %s' % status
148
if repository.get_physical_lock_status():
152
print ' repository: %s' % status
94
155
def _show_missing_revisions_branch(branch):
95
156
"""Show missing master revisions in branch."""
96
157
# Try with inaccessible branch ?
273
336
control = branch.bzrdir
275
338
_show_location_info(repository, branch)
339
_show_related_info(branch)
276
340
_show_format_info(control, repository, branch)
341
_show_locking_info(repository, branch)
277
342
_show_missing_revisions_branch(branch)
278
343
_show_branch_stats(branch, verbose)
279
344
_show_repository_stats(repository)
282
347
def show_repository_info(repository, verbose):
283
"""Output to stdout the 'info' for branch."""
348
"""Output to stdout the 'info' for repository."""
284
349
control = repository.bzrdir
286
351
_show_location_info(repository)
287
352
_show_format_info(control, repository)
353
_show_locking_info(repository)
288
354
_show_repository_info(repository)
289
355
_show_repository_stats(repository)