Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Compare with" and "Diff against" previous tip commands #1819

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions core/commands/log_graph_rebase_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,18 @@ def run(self):
)
]

actions += [
(
"Compare with previous tip",
partial(self.compare_commits, current_branch, previous_tip)
),
(
"Diff against previous tip",
partial(self.diff_commit, previous_tip, current_branch)
),

]

def on_action_selection(index):
if index == -1:
return
Expand Down Expand Up @@ -370,6 +382,20 @@ def remove_previous_tip(self, view, previous_tip):
settings.set("git_savvy.log_graph_view.filters", new_filters)
view.run_command("gs_log_graph_refresh")

def compare_commits(self, base_commit, target_commit):
self.window.run_command("gs_compare_commit", {
"base_commit": base_commit,
"target_commit": target_commit,
})

def diff_commit(self, base_commit, target_commit):
self.window.run_command("gs_diff", {
"in_cached_mode": False,
"base_commit": base_commit,
"target_commit": target_commit,
"disable_stage": True
})


def commit_message_from_line(view, line):
# type: (sublime.View, TextRange) -> Optional[str]
Expand Down