Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added minor-only option to show command to only show packages with minor updates #5552

Merged
merged 7 commits into from Aug 29, 2016
Merged

Added minor-only option to show command to only show packages with minor updates #5552

merged 7 commits into from Aug 29, 2016

Conversation

fvdb
Copy link
Contributor

@fvdb fvdb commented Jul 26, 2016

This adds a new option to the show command: --minor-only.

When used in combination with --outdated, it will only show packages that have minor semver-compatible updates.

The use case for this is that we want to use composer to check if our project has any direct dependencies with minor semver-compatible updates, and fail our CI build if that's the case. The alternative would've been either trying to parse the original output checking for minor versions, or write a separate tool that hooks into composer to do the check.

This seemed like the simplest option.

Looking forward to your feedback.

@alcohol
Copy link
Member

alcohol commented Jul 26, 2016

LGTM

@@ -314,6 +315,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
$latestPackackage = $latestPackages[$package->getPrettyName()];
}

if ($input->getOption('outdated') && $input->getOption('minor-only') && $latestPackackage && (!$this->isImmediateSemverCompliantUpgradeNeeded($package, $latestPackackage) || $latestPackackage->isAbandoned())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation is broken: even if the latest package is a new major version, it does not mean that there is no new versions of the packages for the major version you use.

You will need to change the way to fetch packages instead

Copy link
Member

@alcohol alcohol Jul 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, well spotted.

Assuming 1.6.1 is installed, and the latest is 1.7.2, but the 1.6 branch also has a 1.6.2 tag, then ~1.6.0 and 1.7.2 would yield a no-upgrade-required state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks. Will look into this.

@fvdb
Copy link
Contributor Author

fvdb commented Aug 26, 2016

@alcohol @stof Instead of simply omitting major versions, I've changed how package versions are fetched when the minor-only option is enabled to ensure we get the latest semver-compatible versions regardless of whether there are major updates.

@mvanbaak
Copy link

LGTM

@Seldaek Seldaek added this to the 1.3 milestone Aug 29, 2016
@Seldaek Seldaek merged commit f3af3ed into composer:master Aug 29, 2016
@Seldaek
Copy link
Member

Seldaek commented Aug 29, 2016

Thanks!

@fvdb fvdb deleted the add-minor-only-option branch August 29, 2016 17:58
@mbrodala
Copy link
Contributor

mbrodala commented Aug 30, 2016

Just from reading this change: doesn't this also include major changes, making the name --minor-only misleading?

If a package foo is installed in version 1.2.3, internally the constraint ^1.2.3 is used which includes minor and major updates. Thus the flag should be renamed to --without-breaking or similar IMO.

Strike that, got confused myself. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants