-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added methods related to version control to new file
Moved methods that relate to updating or retrieving a version to new file - versioning.py reduced comparison to single method
- Loading branch information
1 parent
b7503e6
commit d1d139d
Showing
4 changed files
with
49 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from typing import List | ||
|
||
import semver | ||
from pathlib import Path | ||
|
||
|
||
def get_semver(file: Path) -> semver: | ||
with open(file, "r", encoding="utf-8") as release_file: | ||
return release_file.read().strip("\n") | ||
|
||
|
||
def read_file(path1: Path) -> str: | ||
""" | ||
Read both version files and return the contents | ||
:param path1: Path to branched version | ||
:return: branch_ver | ||
""" | ||
with open(path1, "r", encoding="utf-8") as file1: | ||
content1 = file1.read() | ||
return content1 | ||
|
||
|
||
def bump_semver_by_label(old_semver: semver.Version, labels: List[str]) -> semver.Version: | ||
for label in labels: | ||
|
||
if label == "major": | ||
bumped_semver = old_semver.bump_major() | ||
elif label == "minor": | ||
bumped_semver = old_semver.bump_minor() | ||
elif label == "patch": | ||
bumped_semver = old_semver.bump_patch() | ||
|
||
return bumped_semver |