@@ -52,6 +52,17 @@ def is_initial_tag(self, current_tag_version: str, is_yes: bool = False) -> bool
52
52
is_initial = questionary .confirm ("Is this the first tag created?" ).ask ()
53
53
return is_initial
54
54
55
+ def find_increment (self , commits : list ) -> Optional [str ]:
56
+ bump_pattern = self .cz .bump_pattern
57
+ bump_map = self .cz .bump_map
58
+ if not bump_map or not bump_pattern :
59
+ out .error (f"'{ self .config ['name' ]} ' rule does not support bump" )
60
+ raise SystemExit (NO_PATTERN_MAP )
61
+ increment = bump .find_increment (
62
+ commits , regex = bump_pattern , increments_map = bump_map
63
+ )
64
+ return increment
65
+
55
66
def __call__ (self ):
56
67
"""Steps executed to bump."""
57
68
try :
@@ -75,6 +86,7 @@ def __call__(self):
75
86
is_yes : bool = self .arguments ["yes" ]
76
87
prerelease : str = self .arguments ["prerelease" ]
77
88
increment : Optional [str ] = self .arguments ["increment" ]
89
+ is_files_only : Optional [bool ] = self .arguments ["files_only" ]
78
90
79
91
is_initial = self .is_initial_tag (current_tag_version , is_yes )
80
92
commits = git .get_commits (current_tag_version , from_beginning = is_initial )
@@ -87,14 +99,7 @@ def __call__(self):
87
99
raise SystemExit (NO_COMMITS_FOUND )
88
100
89
101
if increment is None :
90
- bump_pattern = self .cz .bump_pattern
91
- bump_map = self .cz .bump_map
92
- if not bump_map or not bump_pattern :
93
- out .error (f"'{ self .config ['name' ]} ' rule does not support bump" )
94
- raise SystemExit (NO_PATTERN_MAP )
95
- increment = bump .find_increment (
96
- commits , regex = bump_pattern , increments_map = bump_map
97
- )
102
+ increment = self .find_increment (commits )
98
103
99
104
# Increment is removed when current and next version
100
105
# are expected to be prereleases.
@@ -118,8 +123,11 @@ def __call__(self):
118
123
if dry_run :
119
124
raise SystemExit ()
120
125
121
- config .set_key ("version" , new_version .public )
122
126
bump .update_version_in_files (current_version , new_version .public , files )
127
+ if is_files_only :
128
+ raise SystemExit ()
129
+
130
+ config .set_key ("version" , new_version .public )
123
131
c = git .commit (message , args = "-a" )
124
132
if c .err :
125
133
out .error ('git.commit errror: "{}"' .format (c .err .strip ()))
0 commit comments