You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add valid_bumps and invalid_bumps to file configuration
Updated the configuration file model to support valid_bumps and invalid_bumps. This feature provides control over which version section updates can trigger file changes. Adjusted various test fixtures and cleaned up tests to match these changes. Also, some updates were made to the documentation accordingly.
Copy file name to clipboardexpand all lines: docs/reference/configuration.md
+55-19
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ By using a configuration file, you no longer need to specify those options on th
25
25
26
26
## Global Configuration
27
27
28
-
The general configuration is grouped in a `[tool.bumpversion]` or `[bumpversion]` section, depending on if it is a TOML or INI file respectfully.
28
+
The general configuration is grouped in a `[tool.bumpversion]` or `[bumpversion]` section, depending on if it is a TOML or INI file, respectfully.
29
29
30
30
### allow_dirty
31
31
@@ -46,7 +46,7 @@ The general configuration is grouped in a `[tool.bumpversion]` or `[bumpversion
46
46
: `BUMPVERSION_ALLOW_DIRTY`
47
47
48
48
49
-
Bump-my-version's default behavior is to abort if the working directory has uncommitted changes. This is to protect you from releasing unversioned files and/or overwriting unsaved changes.
49
+
Bump-my-version's default behavior is to abort if the working directory has uncommitted changes. This protects you from releasing unversioned files and overwriting unsaved changes.
50
50
51
51
### commit
52
52
@@ -68,7 +68,7 @@ Bump-my-version's default behavior is to abort if the working directory has unco
68
68
69
69
Whether to create a commit using git or Mercurial.
70
70
71
-
If you have pre-commit hooks, you might also want to add an option to [`commit_args`](configuration.md#commit_args) to disable your pre-commit hooks. For Git use `--no-verify` and use `--config hooks.pre-commit=` for Mercurial.
71
+
If you have pre-commit hooks, add an option to [`commit_args`](configuration.md#commit_args) to turn off your pre-commit hooks. For Git, use `--no-verify` and use `--config hooks.pre-commit=` for Mercurial.
72
72
73
73
### commit_args
74
74
@@ -91,7 +91,7 @@ If you have pre-commit hooks, you might also want to add an option to [`commit_a
91
91
92
92
Extra arguments to pass to commit command. This is only used when the [`commit`](configuration.md#commit) option is set to `True`.
93
93
94
-
If you have pre-commit hooks, you might also want to add an option to disable your pre-commit hooks. For Git use `--no-verify` and use `--config hooks.pre-commit=` for Mercurial.
94
+
If you have pre-commit hooks, add an option to turn off your pre-commit hooks. For Git, use `--no-verify` and use `--config hooks.pre-commit=` for Mercurial.
95
95
96
96
### current_version
97
97
@@ -196,7 +196,7 @@ This string is templated using the [Python Format String Syntax](https://docs.py
196
196
environment var
197
197
: `BUMPVERSION_PARSE`
198
198
199
-
This is the default regular expression (using [Python regular expression syntax](https://docs.python.org/3/library/re.html#regular-expression-syntax)) for finding and parsing the version string into its components. Individual part or file configurations may override this.
199
+
This is the default regular expression (Python regular expression syntax](https://docs.python.org/3/library/re.html#regular-expression-syntax)) for finding and parsing the version string into its components. Individual part or file configurations may override this.
200
200
201
201
The regular expression must be able to parse all strings produced by the configured [`serialize`](configuration.md#serialize) value. Named matching groups ("`(?P<name>...)`") indicate the version part the matched value belongs to.
202
202
@@ -259,9 +259,9 @@ This is the template to create the string that will replace the current version
259
259
environment var
260
260
: `BUMPVERSION_SEARCH`
261
261
262
-
This is the template string how to search for the string to be replaced in the file. Individual file configurations may override this. This can span multiple lines, and is templated using [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax). The [formatting context reference](formatting-context.md) describes the available variables.
262
+
This is the template string for searching. It is rendered using the [formatting context](formatting-context.md) for searching in the file. Individual file configurations may override this. This can span multiple lines and is templated using [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax). The [formatting context reference](formatting-context.md) describes the available variables.
263
263
264
-
This is useful if there is the remotest possibility that the current version number might be present multiple times in the file and you mean to only bump one of the occurrences.
264
+
This is useful if there is the remotest possibility that the current version number might be present multiple times in the file and you mean to bump only one of the occurrences.
265
265
266
266
### serialize
267
267
@@ -361,11 +361,11 @@ If you are using `git`, don't forget to `git-push` with the `--tags` flag when y
361
361
environment var
362
362
: `BUMPVERSION_TAG_MESSAGE`
363
363
364
-
The tag message template to use when creating a tag, when [`tag`](configuration.md#tag) is `True`
364
+
The tag message template to use when creating a tag when [`tag`](configuration.md#tag) is `True`
365
365
366
366
This string is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax). The [formatting context reference](formatting-context.md) describes the available variables.
367
367
368
-
Bump My Version creates an *annotated* tag in Git by default. To disable this and create a *lightweight* tag, you must explicitly set an empty `tag_message` value.
368
+
Bump My Version creates an *annotated* tag in Git by default. To turn this off and create a *lightweight* tag, you must explicitly set an empty `tag_message` value.
369
369
370
370
### tag_name
371
371
@@ -386,7 +386,7 @@ Bump My Version creates an *annotated* tag in Git by default. To disable this an
386
386
environment var
387
387
: `BUMPVERSION_TAG_NAME`
388
388
389
-
The name template used to render the tag, when [`tag`](configuration.md#tag) is `True`.
389
+
The template used to render the tag when [`tag`](configuration.md#tag) is `True`.
390
390
391
391
This string is templated using the [Python Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax). The [formatting context reference](formatting-context.md) describes the available variables.
392
392
@@ -465,7 +465,7 @@ An explicit list of all values to iterate through when bumping this part. An emp
465
465
type
466
466
: string
467
467
468
-
When the version part matches this value it is considered optional when serializing the final version string.
468
+
When the version part matches this value, it is considered optional when serializing the final version string.
469
469
470
470
!!! note
471
471
@@ -514,7 +514,7 @@ independent of the other parts. It is useful when you have a build number in you
514
514
515
515
default
516
516
: `False` (`True` if `calver_format` is set)
517
-
517
+
518
518
type
519
519
: boolean
520
520
@@ -581,7 +581,7 @@ The name of the file to modify.
581
581
582
582
!!! note
583
583
584
-
‡ This is only used with TOML configuration, and is only required if [`glob`](#glob) is _not_ specified. INI-style configuration files specify the file name as part of the grouping.
584
+
‡ This is only used with TOML configuration and is only required if [`glob`](#glob) is _not_ specified. INI-style configuration files specify the file name as part of the grouping.
585
585
586
586
587
587
### glob
@@ -590,6 +590,7 @@ The name of the file to modify.
590
590
required
591
591
: **Yes‡**
592
592
593
+
593
594
default
594
595
: empty
595
596
@@ -613,7 +614,7 @@ The glob pattern specifying the files to modify.
613
614
614
615
type
615
616
: list of string
616
-
617
+
617
618
A list of glob patterns to exclude from the files found via the `glob` parameter. Does nothing if `filename` is specified.
618
619
619
620
@@ -670,7 +671,7 @@ This is an override to the default template string how to search for the string
670
671
: No
671
672
672
673
default
673
-
: the valued configured in the global `regex` field
674
+
: the value configured in the global `regex` field
674
675
675
676
type
676
677
: boolean
@@ -722,6 +723,40 @@ If `True`, don't fail if the version string to be replaced is not found in the f
722
723
723
724
if `True`, don't fail if the configured file is missing.
724
725
726
+
### valid_bumps
727
+
728
+
::: field-list
729
+
730
+
required
731
+
: No
732
+
733
+
default
734
+
: all version parts
735
+
736
+
type
737
+
: list of strings
738
+
739
+
The `valid_bumps` file configuration allows you to control when this file is changed. When a `bump <version component>` command is issued, this file is changed only if the version component is in this list and not in [`invalid_bumps`](#invalid_bumps). The [parse](#parse) configuration defines version components.
740
+
741
+
The default value, or an empty list, includes all version components.
742
+
743
+
### invalid_bumps
744
+
745
+
::: field-list
746
+
747
+
required
748
+
: No
749
+
750
+
default
751
+
: `[]`
752
+
753
+
type
754
+
: list of strings
755
+
756
+
The `invalid_bumps` file configuration allows you to control when this file is changed by exclusion. When a `bump <version component>` command is issued, this file is only changed if the version component is *not in this list.* The [parse](#parse) configuration defines version components.
757
+
758
+
The default value does not exclude anything.
759
+
725
760
### Examples
726
761
727
762
=== "TOML"
@@ -753,10 +788,11 @@ if `True`, don't fail if the configured file is missing.
753
788
!!! note
754
789
755
790
The configuration file format requires each section header to be unique. If you want to process a certain file multiple times, you may append a description between parens to the `file` keyword: `[bumpversion:file (special one):…]`.
756
-
757
-
758
-
For example, to change `coolapp/__init__.py` with the defaults, and alter `CHANGELOG.md` in twice:
759
-
791
+
792
+
793
+
794
+
For example, to change `coolapp/__init__.py` with the defaults, and alter `CHANGELOG.md` in twice:
0 commit comments