Skip to content

Conversation

@IonBazan
Copy link
Owner

This PR introduces new operation type: Changed which represents an operation where at least one of the components is referencing a branch/commit or a version constraint (for platform dependencies).

Among with the refactoring, there are following breaking changes:

  • PackageDiff::getPackageDiff() now returns DiffEntries instead of array
  • Formatters use DiffEntries instead array too
  • When it's not possible to normalize the version (for example in platform dependencies, when version constraint is used), the operation is now "changed" instead of "upgraded"
  • All dev- version changes are treated as Changed instead of Upgraded which slightly differs from Composer output (which uses more sophisticated method to decide whether it's upgrade or downgrade - for example, any dev-master -> dev-branch will be treated as downgrade)

@IonBazan IonBazan added the enhancement New feature or request label Jun 15, 2021
@IonBazan IonBazan self-assigned this Jun 15, 2021
@codecov
Copy link

codecov bot commented Jun 15, 2021

Codecov Report

Merging #6 (b44fcd2) into master (4fcbe58) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##              master        #6   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       141       162   +21     
===========================================
  Files             16        19    +3     
  Lines            386       430   +44     
===========================================
+ Hits             386       430   +44     
Impacted Files Coverage Δ
src/Composer/Plugin.php 100.00% <ø> (ø)
src/Command/DiffCommand.php 100.00% <100.00%> (ø)
src/Diff/DiffEntries.php 100.00% <100.00%> (ø)
src/Diff/DiffEntry.php 100.00% <100.00%> (ø)
src/Diff/VersionComparator.php 100.00% <100.00%> (ø)
src/Formatter/AbstractFormatter.php 100.00% <100.00%> (ø)
src/Formatter/JsonFormatter.php 100.00% <100.00%> (ø)
src/Formatter/MarkdownListFormatter.php 100.00% <100.00%> (ø)
src/Formatter/MarkdownTableFormatter.php 100.00% <100.00%> (ø)
src/PackageDiff.php 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4fcbe58...b44fcd2. Read the comment docs.

@IonBazan IonBazan linked an issue Jun 15, 2021 that may be closed by this pull request
@IonBazan
Copy link
Owner Author

@trakos Please check if this solves your issue. Comparing these dev- parts is quite tricky so let me know if it's returning an expected result. Please check the test cases for more info.

@trakos
Copy link
Contributor

trakos commented Jun 15, 2021

@IonBazan thanks a lot, yes it does :) I use composer 2, and it shows Changed as expected for dev- versions.

I've also checked the test cases I mentioned in the issue and it shows Changed for all of them :)

@IonBazan
Copy link
Owner Author

Good to hear! I am still thinking about implementing custom version comparison logic instead of using VersionParser and Semver as they produce slightly different results between different Composer versions to make it more consistent. The thing is that there is tons of logic behind it so I will most probably leave it as is. That's because the operation name is not that important as showing correct base and target versions.

@IonBazan IonBazan force-pushed the diff-change branch 3 times, most recently from f4395aa to 3b2ddc8 Compare June 15, 2021 08:19
@IonBazan IonBazan merged commit 6c50a71 into master Jun 17, 2021
@IonBazan IonBazan deleted the diff-change branch June 17, 2021 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistency when comparing dev- versions

3 participants