@@ -52,6 +52,17 @@ def is_initial_tag(self, current_tag_version: str, is_yes: bool = False) -> bool
5252 is_initial = questionary .confirm ("Is this the first tag created?" ).ask ()
5353 return is_initial
5454
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+
5566 def __call__ (self ):
5667 """Steps executed to bump."""
5768 try :
@@ -75,6 +86,7 @@ def __call__(self):
7586 is_yes : bool = self .arguments ["yes" ]
7687 prerelease : str = self .arguments ["prerelease" ]
7788 increment : Optional [str ] = self .arguments ["increment" ]
89+ is_files_only : Optional [bool ] = self .arguments ["files_only" ]
7890
7991 is_initial = self .is_initial_tag (current_tag_version , is_yes )
8092 commits = git .get_commits (current_tag_version , from_beginning = is_initial )
@@ -87,14 +99,7 @@ def __call__(self):
8799 raise SystemExit (NO_COMMITS_FOUND )
88100
89101 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 )
98103
99104 # Increment is removed when current and next version
100105 # are expected to be prereleases.
@@ -118,8 +123,11 @@ def __call__(self):
118123 if dry_run :
119124 raise SystemExit ()
120125
121- config .set_key ("version" , new_version .public )
122126 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 )
123131 c = git .commit (message , args = "-a" )
124132 if c .err :
125133 out .error ('git.commit errror: "{}"' .format (c .err .strip ()))
0 commit comments