32
import olive.backend.errors as errors
33
import olive.backend.info as info
32
import bzrlib.errors as errors
35
""" Get info about branch, working tree, and repository
37
:param location: the location of the branch/working tree/repository
39
:return: the information in dictionary format
41
The following informations are delivered (if available):
42
ret['location']['lightcoroot']: Light checkout root
43
ret['location']['sharedrepo']: Shared repository
44
ret['location']['repobranch']: Repository branch
45
ret['location']['cobranch']: Checkout of branch
46
ret['location']['repoco']: Repository checkout
47
ret['location']['coroot']: Checkout root
48
ret['location']['branchroot']: Branch root
49
ret['related']['parentbranch']: Parent branch
50
ret['related']['publishbranch']: Publish to branch
51
ret['format']['control']: Control format
52
ret['format']['workingtree']: Working tree format
53
ret['format']['branch']: Branch format
54
ret['format']['repository']: Repository format
55
ret['locking']['workingtree']: Working tree lock status
56
ret['locking']['branch']: Branch lock status
57
ret['locking']['repository']: Repository lock status
58
ret['missing']['branch']: Missing revisions in branch
59
ret['missing']['workingtree']: Missing revisions in working tree
60
ret['wtstats']['unchanged']: Unchanged files
61
ret['wtstats']['modified']: Modified files
62
ret['wtstats']['added']: Added files
63
ret['wtstats']['removed']: Removed files
64
ret['wtstats']['renamed']: Renamed files
65
ret['wtstats']['unknown']: Unknown files
66
ret['wtstats']['ignored']: Ingnored files
67
ret['wtstats']['subdirs']: Versioned subdirectories
68
ret['brstats']['revno']: Revisions in branch
69
ret['brstats']['commiters']: Number of commiters
70
ret['brstats']['age']: Age of branch in days
71
ret['brstats']['firstrev']: Time of first revision
72
ret['brstats']['lastrev']: Time of last revision
73
ret['repstats']['revisions']: Revisions in repository
74
ret['repstats']['size']: Size of repository in bytes
76
import bzrlib.bzrdir as bzrdir
82
a_bzrdir = bzrdir.BzrDir.open_containing(location)[0]
83
except errors.NotBranchError:
84
raise NotBranchError(location)
87
working = a_bzrdir.open_workingtree()
90
branch = working.branch
91
repository = branch.repository
92
control = working.bzrdir
94
ret['location'] = info_helper.get_location_info(repository, branch, working)
95
ret['related'] = info_helper.get_related_info(branch)
96
ret['format'] = info_helper.get_format_info(control, repository, branch, working)
97
ret['locking'] = info_helper.get_locking_info(repository, branch, working)
99
ret['missing']['branch'] = info_helper.get_missing_revisions_branch(branch)
100
ret['missing']['workingtree'] = info_helper.get_missing_revisions_working(working)
101
ret['wtstats'] = info_helper.get_working_stats(working)
102
ret['brstats'] = info_helper.get_branch_stats(branch)
103
ret['repstats'] = info_helper.get_repository_stats(repository)
108
except (errors.NoWorkingTree, errors.NotLocalUrl):
112
branch = a_bzrdir.open_branch()
115
ret['location'] = info_helper.get_location_info(repository, branch)
116
ret['related'] = info_helper.get_related_info(branch)
117
ret['format'] = info_helper.get_format_info(control, repository, branch)
118
ret['locking'] = info_helper.get_locking_info(repository, branch)
119
ret['missing']['branch'] = info_helper.get_missing_revisions_branch(branch)
120
ret['brstats'] = info_helper.get_branch_stats(branch)
121
ret['repstats'] = info_helper.get_repository_stats(repository)
126
except errors.NotBranchError:
130
repository = a_bzrdir.open_repository()
131
repository.lock_read()
133
ret['location'] = info_helper.get_location_info(repository)
134
ret['format'] = info_helper.get_format_info(control, repository)
135
ret['locking'] = info_helper.get_locking_info(repository)
136
ret['repstats'] = info_helper.get_repository_stats(repository)
141
except errors.NoRepositoryPresent:
36
146
""" Display Informations window and perform the needed actions. """