Differentiate archives and regular files in XML diffs#19372
Open
Sahitya0805 wants to merge 1 commit intoopenSUSE:masterfrom
Open
Differentiate archives and regular files in XML diffs#19372Sahitya0805 wants to merge 1 commit intoopenSUSE:masterfrom
Sahitya0805 wants to merge 1 commit intoopenSUSE:masterfrom
Conversation
12898fe to
cfff135
Compare
f8ec27c to
18f4161
Compare
hennevogel
previously requested changes
Mar 12, 2026
18f4161 to
3dee083
Compare
Contributor
Author
|
This change was made to fix the OBS build for If you'd prefer, I can move this change into a separate PR so this one only contains the XML diff |
e20f272 to
b3e644f
Compare
Contributor
Author
|
I've updated the implementation to include the I also refactored the archive detection into an |
This PR is only about backend code by now, not my area of expertise...
d98274e to
3971878
Compare
2322959 to
ab57f5d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Differentiate archives and regular files in XML diffs
Description
Currently, when requesting an XML diff of a package, the
<file>nodes do not distinguish between archive files (like.tar.gz,.zip) and regular text files. This makes it difficult for API consumers to know if a diff contains individual file changes or if it's a diff of an archive's contents without fetching the file directly.This PR introduces a
kindattribute to thefileelement in the XML diff output. Thekindattribute can have the valuearchivefor known archive formats orfilefor regular text files.This change modifies:
src/backend/BSXML.pm: Updated thesourcediffschema to include thekindattribute.src/backend/BSSrcServer/Srcdiff.pm: Added anis_archivehelper and updateddatadiffto populate thekindattribute based on file extensions.Why this change?
To improve API usability by providing more metadata about files in a diff result, enabling clients to handle different file types appropriately without extra requests.
How to verify this change?
To verify this backend change, you can use
oscto check the XML output structure.test.tar.gz) and one regular file (e.g.,test.patch).osc api "/source/<project>/<package>?cmd=diff&view=xml"kindattribute:Performance considerations
The change adds a simple regex check for file extensions during diff generation, which has negligible performance impact.
Side effects
None expected. The XML schema change is additive and backward compatible.
Closes
Closes #18399.