diff --git a/src/pycalver/__main__.py b/src/pycalver/__main__.py index af6d607..2f03c13 100644 --- a/src/pycalver/__main__.py +++ b/src/pycalver/__main__.py @@ -240,4 +240,11 @@ def bump( if dry or not cfg.commit: return - # TODO (mb 2018-09-04): add files and commit + for filepath in filepaths: + _vcs.add(filepath) + + _vcs.commit(f"bump version to {new_version}") + + if cfg.tag: + _vcs.tag(new_version) + _vcs.push() diff --git a/src/pycalver/config.py b/src/pycalver/config.py index 22efd18..d08a886 100644 --- a/src/pycalver/config.py +++ b/src/pycalver/config.py @@ -119,6 +119,11 @@ def _parse_buffer(cfg_buffer: io.StringIO, config_filename: str = " None: + self('fetch') + def status(self) -> typ.List[str]: status_output = self('status') return [ @@ -77,8 +80,12 @@ class VCS: if not line.strip().startswith(b"??") ] - def fetch(self) -> None: - self('fetch') + def ls_tags(self) -> typ.List[str]: + ls_tag_lines = self('ls_tags').splitlines() + log.debug(f"ls_tags output {ls_tag_lines}") + return [ + line.decode("utf-8").strip() for line in ls_tag_lines if line.strip().startswith(b"v") + ] def add(self, path) -> None: log.info(f"{self.name} add {path}") @@ -104,12 +111,8 @@ class VCS: def tag(self, name) -> None: self('tag', name=name) - def ls_tags(self) -> typ.List[str]: - ls_tag_lines = self('ls_tags').splitlines() - log.debug(f"ls_tags output {ls_tag_lines}") - return [ - line.decode("utf-8").strip() for line in ls_tag_lines if line.strip().startswith(b"v") - ] + def push(self) -> None: + self('push') def __repr__(self) -> str: return f"VCS(name='{self.name}')"