Skip to content

Commit

Permalink
Only consider rosidstros of the same type distros when looking for a …
Browse files Browse the repository at this point in the history
…repo name in recent distros. (#501)
  • Loading branch information
dirk-thomas authored and nuclearsandwich committed Dec 4, 2018
1 parent 9426042 commit 431b3ad
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions bloom/commands/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ def list_distributions():
return sorted(get_index().distributions.keys())


def get_most_recent(thing_name, repository):
def get_distribution_type(distro):
return get_index().distributions[distro].get('distribution_type')


def get_most_recent(thing_name, repository, reference_distro):
reference_distro_type = get_distribution_type(reference_distro)
distros_with_entry = {}
get_things = {
'release': lambda r: None if r.release_repository is None else r.release_repository,
Expand All @@ -237,6 +242,10 @@ def get_most_recent(thing_name, repository):
}
get_thing = get_things[thing_name]
for distro in list_distributions():
# skip distros with a different type if the information is available
if reference_distro_type is not None:
if get_distribution_type(distro) != reference_distro_type:
continue
distro_file = get_distribution_file(distro)
if repository in distro_file.repositories:
thing = get_thing(distro_file.repositories[repository])
Expand Down Expand Up @@ -345,7 +354,7 @@ def get_repo_uri(repository, distro):
info("Here is the url for a typical release repository on GitHub: https://github.com/ros-gbp/rviz-release.git")
# Calculate a reasonable default from the list of previous distros
info(fmt("@{gf}@!==> @|") + "Looking for a release of this repository in a different distribution...")
default_distro, default_release = get_most_recent('release', repository)
default_distro, default_release = get_most_recent('release', repository, distro)
default_release_repo_url = default_release.url if default_release else "press enter to abort"
if default_distro is not None:
warning("A different distribution, '{0}', released this repository.".format(default_distro))
Expand Down Expand Up @@ -536,7 +545,7 @@ def get_repository_info_from_user(url_type, defaults=None):
if not docs and maybe_continue(msg='Would you like to add documentation information for this repository?'):
defaults = None
info(fmt("@{gf}@!==> @|") + "Looking for a doc entry for this repository in a different distribution...")
default_distro, default_doc = get_most_recent('doc', repository)
default_distro, default_doc = get_most_recent('doc', repository, distro)
if default_distro is None:
warning("No existing doc entries found for use as defaults.")
else:
Expand All @@ -559,7 +568,7 @@ def get_repository_info_from_user(url_type, defaults=None):
defaults = None
info(fmt("@{gf}@!==> @|") +
"Looking for a source entry for this repository in a different distribution...")
default_distro, default_source = get_most_recent('source', repository)
default_distro, default_source = get_most_recent('source', repository, distro)
if default_distro is None:
warning("No existing source entries found for use as defaults.")
else:
Expand Down

0 comments on commit 431b3ad

Please sign in to comment.