feat: Add --compare-to option to override commit hash for incremental updates#67
Open
p0thi wants to merge 1 commit into
Open
feat: Add --compare-to option to override commit hash for incremental updates#67p0thi wants to merge 1 commit into
p0thi wants to merge 1 commit into
Conversation
… incremental updates
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.
TL;DR
This PR adds a new
--compare-to <commit-hash>CLI option to thegeneratecommand, allowing developers to explicitly specify the base commit to compare against when running incremental updates.Description
Previously, incremental updates relied solely on the
commit_idstored inmetadata.jsonfrom the last generation run. This works well for local, continuous workflows but breaks down in CI/CD pipelines or after squashed PR merges, where the stored commit hash may no longer represent the correct baseline for detecting changes.This pull request introduces a
--compare-toflag that overrides the stored commit hash and uses a user-supplied commit as the diff baseline. When provided, the flag implicitly enables--updatemode, so users do not need to pass both flags.Key Changes:
CLI Option (
generate.py):--compare-to <commit-hash>option to thegeneratecommand.--update, simplifying the command invocation for CI/CD usage.Change Detection (
generate.py):_detect_changed_filesto accept an optionalcompare_toargument.compare_tois provided, it is used directly asprev_commit, bypassing the read ofmetadata.jsonand its storedcommit_id.metadata.json) when--compare-tois not supplied.Documentation (
README.md):codewiki generate --compare-to <commit-hash>, including a note that it is useful in CI/CD or squashed PR scenarios.