Skip to content

Commit

Permalink
fix version getter params
Browse files Browse the repository at this point in the history
  • Loading branch information
sirfoga committed Jul 30, 2018
1 parent 6410dd9 commit 319d5fb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hal/cvs/gits.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,27 +138,30 @@ def get_diff(self, commit, other_commit):
diff = self.r.git.diff(commit.hexsha, other_commit.hexsha)
return Diff(diff).get_totals()

def get_version(self):
def get_version(self, diff_to_increase_ratio):
"""
:param diff_to_increase_ratio: float
Ratio to convert number of changes into version increases
:return: Version
Version of this code, based on commits diffs
"""

diffs = self.get_diff_amounts()
diff_to_increase_ratio = 1 / 100
version = Version()

for diff in diffs:
version.increase_by_changes(diff, diff_to_increase_ratio)

return version

def get_pretty_version(self):
def get_pretty_version(self, diff_to_increase_ratio):
"""
:param diff_to_increase_ratio: float
Ratio to convert number of changes into version increases
:return: str
Pretty version of this repository
"""

version = self.get_version()
version = self.get_version(diff_to_increase_ratio)
last = self.get_last_commit()
return str(version) + " " + str(Commit(last))

0 comments on commit 319d5fb

Please sign in to comment.