1099
def bazaar_identity(branch, associated_series, is_dev_focus):
1102
def bazaar_identity(branch, is_dev_focus):
1100
1103
"""Return the shortest lp: style branch identity."""
1101
1104
lp_prefix = config.codehosting.bzr_lp_prefix
1116
1119
return lp_prefix + branch.product.name
1118
1121
# If there are no associated series, then use the unique name.
1119
associated_series = list(associated_series)
1120
if [] == associated_series:
1122
associated_series = sorted(
1123
branch.associatedProductSeries(), key=attrgetter('datecreated'))
1124
if len(associated_series) == 0:
1121
1125
return lp_prefix + branch.unique_name
1123
use_series = sorted(
1124
associated_series, key=attrgetter('datecreated'))[-1]
1126
# Use the most recently created series.
1127
use_series = associated_series[-1]
1125
1128
return "%(prefix)s%(product)s/%(series)s" % {
1126
1129
'prefix': lp_prefix,
1127
1130
'product': use_series.product.name,
1128
1131
'series': use_series.name}
1130
1133
if branch.sourcepackage is not None:
1131
sourcepackage = branch.sourcepackage
1132
linked_branches = sourcepackage.linked_branches
1133
for pocket, linked_branch in linked_branches:
1134
if linked_branch == branch:
1135
return lp_prefix + sourcepackage.getPocketPath(pocket)
1134
suite_sourcepackages = branch.associatedSuiteSourcePackages()
1135
# Take the first link if there is one.
1136
if len(suite_sourcepackages) > 0:
1137
suite_source_package = suite_sourcepackages[0]
1138
return lp_prefix + suite_source_package.path
1137
1140
return lp_prefix + branch.unique_name