Skip to content

Commit

Permalink
Merge pull request #748 from randy3k/loggraphaction
Browse files Browse the repository at this point in the history
Other: refactor GsLogGraphActionCommand
  • Loading branch information
stoivo committed Aug 22, 2017
2 parents 8dc3114 + e6d5f8c commit f836adc
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions core/commands/log_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def run(self, edit):
r'\1' + COMMIT_NODE_CHAR, graph_content,
flags=re.MULTILINE)

self.view.run_command("gs_replace_view_text", {"text": graph_content, "nuke_cursors": True})
self.view.run_command("gs_replace_view_text", {"text": graph_content})
self.view.run_command("gs_log_graph_more_info")

self.view.run_command("gs_handle_vintageous")
Expand Down Expand Up @@ -173,13 +173,19 @@ def update_actions(self):
super().update_actions()
view = self.window.active_view()
if view.settings().get("git_savvy.log_graph_view"):
self.actions.insert(3, ["revert_commit", "Revert commit"])
if self._file_path:
# for `git: graph current file`, two more options would be inserted
# at index 1
self.actions.insert(5, ["revert_commit", "Revert commit"])
else:
self.actions.insert(3, ["revert_commit", "Revert commit"])

if view.settings().get("git_savvy.log_graph_view"):
self.actions.extend([
["diff_commit", "Diff commit"],
["diff_commit_cache", "Diff commit (cached)"],
])
elif view.settings().get("git_savvy.compare_commit_view"):
pass

def run(self):
view = self.window.active_view()
Expand All @@ -199,18 +205,6 @@ def run(self):

super().run(commit_hash=self._commit_hash, file_path=self._file_path)

def cherry_pick(self):
self.git("cherry-pick", self._commit_hash)
util.view.refresh_gitsavvy(self.view, refresh_sidebar=True)

def revert_commit(self):
self.window.run_command("gs_revert_commit", {"commit_hash": self._commit_hash})

def show_file_at_commit(self):
self.window.run_command(
"gs_show_file_at_commit",
{"commit_hash": self._commit_hash, "filepath": self._file_path})


class GsLogGraphNavigateCommand(GsNavigate):

Expand Down

0 comments on commit f836adc

Please sign in to comment.