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

(GH-293) choco upgrade all -except="package1,package2" #343

Closed

Conversation

christianrondeau
Copy link
Contributor

This pull request implements #293 by providing a list of packages to ignore.

  • It will print These packages will not be upgraded because they were specified in '-except': package1 when specifying packages to skip
  • If some packages specified in -except do not exist in the installed list of packages, it will display a warning: Some packages specified in '-except' were not found in the local packages: 'package1'
  • If the -except argument is not provided, there is no difference
  • There was no tests for choco upgrade all that I could find, so I added a very basic one, based on the fact that upgrades are already tested in UpgradeScenarios
  • I would have preferred -skip but it seems -s* will be catched by -source, so I stucked with -except

Hopefully, all will be good with that pull request :)

Fixes #293.

}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This should roll in under the upgrade scenarios. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my first attempt, but the Context (the tests setup) was very different, so I thought it'd be easier to understand if it was separate. Merging the two would require a refactor of UpgradeScenarios that goes beyond the PR.

Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why I consider this refactoring outside of the PR? Because there was no test initially (that I could find) that tested "upgrade all", so I added some but the choco upgrade all command already existed prior to that PR.

Also, the upgrade tests all shared a common "context" (test setup), so changing that would require refactoring the whole UpgradeScenarios class, changing each test or restructuring them... but the PR only focus on filtering choco upgrade all packages, so changing this file completely - adding to this eventual merge issues if the PR is not quickly merged - falls outside of the actual except feature.

I tried to keep the new file as clean and simple as possible so that if eventually UpgradeScenarios and UpgradeAllScenarios were to be merged, there would be minimal headaches.

Copy link
Member

Choose a reason for hiding this comment

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

Also, the upgrade tests all shared a common "context" (test setup), so changing that would require refactoring the whole UpgradeScenarios class, changing each test or restructuring them... but the PR only focus on filtering choco upgrade all packages, so changing this file completely - adding to this eventual merge issues if the PR is not quickly merged - falls outside of the actual except feature.

Well they share it, but they can override it in each individual spec class. And if you look through many of them, they do. Some override and still call the base, although not required. The way it is setup is quite flexible, no refactoring required.

@ferventcoder
Copy link
Member

Overall +1

@christianrondeau
Copy link
Contributor Author

Feedback included and merge complete. Is there anything to do for documentation, or will you be taking care of this?

@ferventcoder
Copy link
Member

Documentation, yes, Would need to include some information in the help method related to this.

@christianrondeau
Copy link
Contributor Author

I added some documentation to the choco upgrade --help screen, but I was referring to the "wiki" page https://github.com/chocolatey/choco/wiki/CommandsUpgrade - is there any action required from me?

@@ -97,7 +97,7 @@ public IEnumerable<PackageResult> list_run(ChocolateyConfiguration config)
if (config.RegularOutput) this.Log().Debug(() => "Running list with the following filter = '{0}'".format_with(config.Input));
if (config.RegularOutput) this.Log().Debug(() => "--- Start of List ---");
foreach (var pkg in NugetList.GetPackages(config, _nugetLogger))

Copy link
Member

Choose a reason for hiding this comment

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

new line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was from the merge, and was not my change (I should have just rebased)

Copy link
Member

Choose a reason for hiding this comment

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

actually a rebase is what we always hope for. I don't like merge commits anywhere except for explicit merges.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understandable, I'd ask the same. I was lazy, I'll rebase as soon as I can :)

@ferventcoder
Copy link
Member

On the wiki, not at the current time. Sometimes when we add something new, we mention what version it is coming out in.

@christianrondeau
Copy link
Contributor Author

Squashed and rebased on master!

@christianrondeau christianrondeau changed the title choco upgrade all -except="package1,package2" (GH-293) choco upgrade all -except="package1,package2" Jan 27, 2016
@christianrondeau
Copy link
Contributor Author

Merged the UpgradeScenarios and UpgradeAllScenarios, ready to merge

@ferventcoder
Copy link
Member

Rebased, commit message fixed up and merged into stable.

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

Successfully merging this pull request may close these issues.

2 participants