Skip to content

Commit

Permalink
Add current branch to the current version display
Browse files Browse the repository at this point in the history
  • Loading branch information
Dramelac committed Mar 1, 2024
1 parent 1f96f3a commit 9df0eff
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions exegol/manager/UpdateManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def __compareVersion(cls, version) -> bool:
def __get_current_version(cls):
"""Get the current version of the exegol wrapper. Handle dev version and release stable version depending on the current version."""
current_version = ConstantConfig.version
if re.search(r'[a-z]', ConstantConfig.version, re.IGNORECASE):
if re.search(r'[a-z]', ConstantConfig.version, re.IGNORECASE) and ConstantConfig.git_source_installation:
module = ExegolModules().getWrapperGit(fast_load=True)
if module.isAvailable:
current_version = str(module.get_current_commit())[:8]
Expand All @@ -259,12 +259,19 @@ def __get_current_version(cls):
@staticmethod
def display_current_version():
"""Get the current version of the exegol wrapper. Handle dev version and release stable version depending on the current version."""
commit_version = ""
if re.search(r'[a-z]', ConstantConfig.version, re.IGNORECASE):
version_details = ""
if ConstantConfig.git_source_installation:
module = ExegolModules().getWrapperGit(fast_load=True)
if module.isAvailable:
commit_version = f" [bright_black]\\[{str(module.get_current_commit())[:8]}][/bright_black]"
return f"[blue]v{ConstantConfig.version}[/blue]{commit_version}"
current_branch = module.getCurrentBranch()
commit_version = ""
if re.search(r'[a-z]', ConstantConfig.version, re.IGNORECASE):
commit_version = "-" + str(module.get_current_commit())[:8]
if current_branch is None:
current_branch = "HEAD"
if current_branch != "master" or commit_version != "":
version_details = f" [bright_black]\\[{current_branch}{commit_version}][/bright_black]"
return f"[blue]v{ConstantConfig.version}[/blue]{version_details}"

@classmethod
def __tagUpdateAvailable(cls, latest_version, current_version=None):
Expand Down

0 comments on commit 9df0eff

Please sign in to comment.