fix: add --extra-files flag to stage additional files in bump commit#284
Open
maimul wants to merge 1 commit into
Open
fix: add --extra-files flag to stage additional files in bump commit#284maimul wants to merge 1 commit into
maimul wants to merge 1 commit into
Conversation
…4urself#259) When committing a version bump, it was not possible to include generated files (changelogs, build artifacts) that weren't modified by bumpversion itself. This adds --extra-files (repeatable, or space-separated in config) which stages arbitrary files alongside the bump commit. Changes: - cli.py: parse extra_files from config (list value) and --extra-files flag - cli.py: pass extra_files through _determine_vcs_dirty so dirty-check ignores those paths, and through _commit_to_vcs to stage them - vcs.py: Git.assert_nondirty accepts allowed_paths to skip extra files - vcs.py: Git.add_extra_path uses `git add` (not --update) so untracked files can be included; BaseVCS.add_extra_path is a no-op Fixes c4urself#259
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.
Problem
There is no way to include generated files (changelogs, build artifacts, lockfiles) in the version bump commit when those files are not part of any
[bumpversion:file:...]section. Users are forced to make a separate commit or use--allow-dirty.Fix
Add
--extra-files FILE [FILE ...]CLI flag (also settable asextra_files = ...in config) that stages arbitrary additional files alongside the bump commit. Files can be dirty or untracked.Changes
cli.pyextra_filesadded to the list-value parsing loop in_load_configuration--extra-filesargument added to_parse_arguments_phase_2_determine_vcs_dirtyacceptsextra_files=Noneand passes them toassert_nondirtyasallowed_pathsso the dirty check doesn't abort when extra files are modified_commit_to_vcsacceptsextra_files=Noneand callsvcs.add_extra_path()for each before committingvcs.pyGit.assert_nondirtyacceptsallowed_paths=None; paths in that set are excluded from the dirty checkGit.add_extra_pathusesgit add <path>(without--update) so untracked files can be stagedBaseVCS.add_extra_pathis a no-op so Mercurial doesn't breakUsage
Or in config:
Fixes #259