-
Notifications
You must be signed in to change notification settings - Fork 906
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
(#2304) Make list --exact --all-versions to filter out prereleases by default #2308
(#2304) Make list --exact --all-versions to filter out prereleases by default #2308
Conversation
Hrm, seems like the underlying Nuget lib doesn't like the resulting OData query here. Marking this as WIP until I have had a better look. |
I have a solution for this, but leaving in WIP for now as we have some decisions to make. Before the changes that affected this command went in, in 0.10.13 the behaviour was:
In other words, the problem this addresses was already in 0.10.13 before we made the recent breaks and fixes to the command logic. Will be following up internally to confirm this is the right avenue to go for fixing this issue, and will need to verify whether the issue with I'll push some additional changes shortly that will have this functional, but I expect we'll also want to add some tests around the expected behaviour here before we call this sorted, once a decision is made internally. |
5be2fd4
to
e7e1249
Compare
e7e1249
to
fcc7f84
Compare
To follow up on my previous comment:
We acknowledge this is a departure from established behaviour for this specific case (it was the same even back to 0.10.13, and likely earlier). This will make the @gep13 I think this one is ready for review. I haven't gone too wild adding test cases, but I have added tests for the specific cases this should affect. Let me know what other cases we want to add here, if any. |
Converting this to Draft until I can have a conversation about it. |
Conversations had, removing it from Draft. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit-pick, but otherwise, LGTM!
@@ -496,8 +496,8 @@ public void should_contain_debugging_messages() | |||
MockLogger.contains_message("Start of List", LogLevel.Debug).ShouldBeTrue(); | |||
MockLogger.contains_message("End of List", LogLevel.Debug).ShouldBeTrue(); | |||
} | |||
} | |||
|
|||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer to see this whitespace change in a standalone commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorted!
fcc7f84
to
f1704e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Due to a prior fix in the logic for `list -e -a`, all packages with the target ID were being returned, regardless of whether the user uses the `--pre` flag or not. Since the same search without `--exact` does not return prerelease versions unless the `--pre` option is also passed, the behaviour for `list -e -a` should match this. This fix modifies the search logic used when listing all package versions with `--exact` to also check for and respect the `--pre` flag from the configuration context, much like other list commands use the setting in this file in other places. Also includes a minor refactor to avoid doing a double query here; now we only call the Search() function if we're actually going to use those results. The code paths for AllVersions completely discard that already, so this just removes the need to call the method unnecessarily.
f1704e8
to
50a21c4
Compare
@vexx32 I have switched this PR to target the |
@vexx32 thanks for getting this fixed up! |
Due to a prior fix in the logic for
list -e -a
, all packages with the target ID were being returned, regardless of whether the user uses the--pre
flag or not. Since the same search without--exact
does not return prerelease versions unless the--pre
option is also passed, the behaviour forlist -e -a
should match this.This fix modifies the search logic used when listing all package versions with
--exact
to also check for and respect the--pre
flag from the configuration context, much like other list commands use the setting in this file in other places.Changes
choco list $x --all --exact
no longer lists prerelease packages by defaultchoco list $x --all --exact --pre
lists everything, prereleases includedFixes #2304
Manual Testing / Verification
You can either build choco from this branch or modify the configuration in VS to start choco in debug mode with specific arguments. You will need to ensure you have access to the community repository in your configuration (and ideally nothing else, for the purposes of this particular test).
list python3 --exact --all
list python3 --exact --all --pre
list python3 --exact
python3
should be returned.list python3 --exact --pre
python3
should be returned.