diff --git a/git_sim/enums.py b/git_sim/enums.py index f579933..7a22e17 100644 --- a/git_sim/enums.py +++ b/git_sim/enums.py @@ -15,10 +15,10 @@ class StashSubCommand(Enum): class ColorByOptions(Enum): - author = "author" - branch = "branch" - notlocal1 = "notlocal1" - notlocal2 = "notlocal2" + AUTHOR = "author" + BRANCH = "branch" + NOTLOCAL1 = "notlocal1" + NOTLOCAL2 = "notlocal2" class StyleOptions(Enum): diff --git a/git_sim/git_sim_base_command.py b/git_sim/git_sim_base_command.py index 3d970fb..a8de08b 100644 --- a/git_sim/git_sim_base_command.py +++ b/git_sim/git_sim_base_command.py @@ -1252,7 +1252,7 @@ def create_zone_text( thirdColumnFilesDict[f] = text def color_by(self, offset=0): - if settings.color_by == ColorByOptions.author: + if settings.color_by == ColorByOptions.AUTHOR: sorted_authors = sorted( self.author_groups.keys(), key=lambda k: len(self.author_groups[k]), @@ -1282,17 +1282,17 @@ def color_by(self, offset=0): self.recenter_frame() self.scale_frame() - elif settings.color_by == ColorByOptions.branch: + elif settings.color_by == ColorByOptions.BRANCH: pass - elif settings.color_by == ColorByOptions.notlocal1: + elif settings.color_by == ColorByOptions.NOTLOCAL1: for commit_id in self.drawnCommits: try: self.orig_repo.commit(commit_id) except ValueError: self.drawnCommits[commit_id].set_color(m.GOLD) - elif settings.color_by == ColorByOptions.notlocal2: + elif settings.color_by == ColorByOptions.NOTLOCAL2: for commit_id in self.drawnCommits: if not self.orig_repo.is_ancestor(commit_id, "HEAD"): self.drawnCommits[commit_id].set_color(m.GOLD) diff --git a/git_sim/push.py b/git_sim/push.py index 24ad905..a8781bf 100644 --- a/git_sim/push.py +++ b/git_sim/push.py @@ -12,6 +12,7 @@ from git_sim.git_sim_base_command import GitSimBaseCommand from git_sim.settings import settings +from git_sim.enums import ColorByOptions class Push(GitSimBaseCommand): @@ -76,12 +77,12 @@ def construct(self): push_result = 1 self.orig_repo = self.repo self.repo = self.remote_repo - settings.color_by = "notlocal1" + settings.color_by = ColorByOptions.NOTLOCAL1 elif "rejected" in e.stderr and ("non-fast-forward" in e.stderr): push_result = 2 self.orig_repo = self.repo self.repo = self.remote_repo - settings.color_by = "notlocal2" + settings.color_by = ColorByOptions.NOTLOCAL2 else: print(f"git-sim error: git push failed: {e.stderr}") return @@ -173,7 +174,7 @@ def failed_push(self, push_result): text2.move_to(text1.get_center()).shift(m.DOWN / 2) text3 = m.Text( - f"Gold commits exist are ahead of your current branch tip (need to be pulled).", + f"Gold commits are ahead of your current branch tip (need to be pulled).", font="Monospace", font_size=20, color=m.GOLD,