diff --git a/git_machete/annotation.py b/git_machete/annotation.py index ee40db017..32a15bbea 100644 --- a/git_machete/annotation.py +++ b/git_machete/annotation.py @@ -50,6 +50,13 @@ def __init__(self, text: str): self.text_without_qualifiers = self.qualifiers.get_annotation_text_without_qualifiers() self.qualifiers_text = self.qualifiers.get_qualifiers_text() + def get_unformatted_text(self) -> str: + annotation_text = f" {self.text_without_qualifiers}" + if self.qualifiers_text != '': + annotation_text += ' ' if self.text_without_qualifiers != '' else '' + annotation_text += self.qualifiers_text + return annotation_text + def get_formatted_text(self) -> str: annotation_text = f" {utils.dim(self.text_without_qualifiers)}" if self.qualifiers_text != '': diff --git a/git_machete/client.py b/git_machete/client.py index e708ff9dc..a798dc59a 100644 --- a/git_machete/client.py +++ b/git_machete/client.py @@ -218,9 +218,8 @@ def render_tree(self) -> List[str]: self.__indent = "\t" def render_dfs(branch: LocalBranchShortName, depth: int) -> List[str]: - self.annotation = f" {self.__annotations[branch].text_without_qualifiers} {self.__annotations[branch].qualifiers_text}" \ - if branch in self.__annotations else "" - res: List[str] = [depth * self.__indent + branch + self.annotation] + annotation = self.__annotations[branch].get_unformatted_text() if branch in self.__annotations else "" + res: List[str] = [depth * self.__indent + branch + annotation] for down_branch in self.__down_branches.get(branch, []): res += render_dfs(down_branch, depth + 1) return res