@@ -208,6 +208,12 @@ def main(self) -> None:
208208 "script" : self ._migrate_0_14_0 ,
209209 "released" : True ,
210210 },
211+ {
212+ "version" : CoLRevVersion ("0.14.0" ),
213+ "target_version" : CoLRevVersion ("0.15.0" ),
214+ "script" : self ._migrate_0_15_0 ,
215+ "released" : False ,
216+ },
211217 ]
212218 self .review_manager .logger .info (
213219 "Colrev version installed: %s" , installed_colrev_version
@@ -795,6 +801,20 @@ def _migrate_0_14_0(self) -> bool:
795801
796802 return self .repo .is_dirty ()
797803
804+ def _migrate_0_15_0 (self ) -> bool :
805+
806+ # replace "commit" with "pre-commit" and "push" with "pre-push" in .pre-commit-config.yaml
807+ pre_commit_config_path = Path (".pre-commit-config.yaml" )
808+ if pre_commit_config_path .is_file ():
809+ pre_commit_contents = pre_commit_config_path .read_text (encoding = "utf-8" )
810+ pre_commit_contents = pre_commit_contents .replace (
811+ "[commit]" , "[pre-commit]"
812+ ).replace ("[push]" , "[pre-push]" )
813+ pre_commit_config_path .write_text (pre_commit_contents , encoding = "utf-8" )
814+ self .repo .index .add ([str (pre_commit_config_path )])
815+
816+ return self .repo .is_dirty ()
817+
798818
799819# Note: we can ask users to make decisions (when defaults are not clear)
800820# via input() or simply cancel the process (raise a CoLrevException)
0 commit comments