diff --git a/src/pycalver/__main__.py b/src/pycalver/__main__.py index 9df5937..5a523ae 100644 --- a/src/pycalver/__main__.py +++ b/src/pycalver/__main__.py @@ -214,8 +214,10 @@ def _bump(cfg: config.Config, new_version: str, allow_dirty: bool = False) -> No _vcs.commit(f"bump version to {new_version}") - if cfg.tag: + if cfg.commit and cfg.tag: _vcs.tag(new_version) + + if cfg.commit and cfg.tag and cfg.push: _vcs.push(new_version) diff --git a/src/pycalver/config.py b/src/pycalver/config.py index f7b2bba..65f7082 100644 --- a/src/pycalver/config.py +++ b/src/pycalver/config.py @@ -79,8 +79,8 @@ class Config(typ.NamedTuple): current_version: str pep440_version : str - tag : bool commit: bool + tag : bool push : bool file_patterns: PatternsByFilePath @@ -91,8 +91,8 @@ def _debug_str(cfg: Config) -> str: f"Config Parsed: Config(", f"current_version='{cfg.current_version}'", f"pep440_version='{cfg.pep440_version}'", - f"tag={cfg.tag}", f"commit={cfg.commit}", + f"tag={cfg.tag}", f"push={cfg.push}", "file_patterns={", ] diff --git a/src/pycalver/vcs.py b/src/pycalver/vcs.py index 19cfbe9..ff8f9ec 100644 --- a/src/pycalver/vcs.py +++ b/src/pycalver/vcs.py @@ -64,7 +64,10 @@ class VCS: """Invoke subcommand and return output.""" cmd_tmpl = self.subcommands[cmd_name] cmd_str = cmd_tmpl.format(**kwargs) - log.debug(cmd_str) + if cmd_name in ("commit", "tag", "push_tag"): + log.info(cmd_str) + else: + log.debug(cmd_str) output_data = sp.check_output(cmd_str.split(), env=env, stderr=sp.STDOUT) # TODO (mb 2018-11-15): Detect encoding of output? @@ -122,7 +125,6 @@ class VCS: def add(self, path: str) -> None: """Add updates to be included in next commit.""" - log.info(f"{self.name} add {path}") try: self('add_path', path=path) except sp.CalledProcessError as ex: @@ -134,7 +136,6 @@ class VCS: def commit(self, message: str) -> None: """Commit added files.""" - log.info(f"{self.name} commit -m '{message}'") message_data = message.encode("utf-8") tmp_file = tempfile.NamedTemporaryFile("wb", delete=False)