Skip to content

Commit ee5c017

Browse files
authored
Merge pull request #11433 from Byron/next2
Make `but_api::legacy::diff::commit_details()` non-legacy with macro-support.
2 parents 0e8b4cc + 6cd9895 commit ee5c017

File tree

64 files changed

+1034
-561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1034
-561
lines changed

Cargo.lock

Lines changed: 34 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/desktop/cypress/e2e/branchActions.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('Branch Actions - single branch with uncommitted changes', () => {
9090
mockCommand('changes_in_worktree', (params) => mockBackend.getWorktreeChanges(params));
9191
mockCommand('tree_change_diffs', (params) => mockBackend.getDiff(params));
9292
mockCommand('hunk_assignments', (params) => mockBackend.getHunkAssignments(params));
93-
mockCommand('commit_details', (params) => mockBackend.getCommitChanges(params));
93+
mockCommand('commit_details_with_line_stats', (params) => mockBackend.getCommitChanges(params));
9494
mockCommand('create_commit_from_worktree_changes', (params) =>
9595
mockBackend.createCommit(params)
9696
);

apps/desktop/cypress/e2e/branches.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('Branches', () => {
1111
mockCommand('update_commit_message', (params) => mockBackend.updateCommitMessage(params));
1212
mockCommand('changes_in_worktree', (params) => mockBackend.getWorktreeChanges(params));
1313
mockCommand('tree_change_diffs', (params) => mockBackend.getDiff(params));
14-
mockCommand('commit_details', (params) => mockBackend.getCommitChanges(params));
14+
mockCommand('commit_details_with_line_stats', (params) => mockBackend.getCommitChanges(params));
1515
mockCommand('create_commit_from_worktree_changes', (params) =>
1616
mockBackend.createCommit(params)
1717
);

apps/desktop/cypress/e2e/commitActions.cy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('Commit Actions', () => {
1414
mockCommand('changes_in_worktree', (params) => mockBackend.getWorktreeChanges(params));
1515
mockCommand('tree_change_diffs', (params) => mockBackend.getDiff(params));
1616
mockCommand('hunk_assignments', (params) => mockBackend.getHunkAssignments(params));
17-
mockCommand('commit_details', (params) => mockBackend.getCommitChanges(params));
17+
mockCommand('commit_details_with_line_stats', (params) => mockBackend.getCommitChanges(params));
1818
mockCommand('create_commit_from_worktree_changes', (params) =>
1919
mockBackend.createCommit(params)
2020
);
@@ -600,7 +600,7 @@ describe('Commit Actions with branches containing changes', () => {
600600
mockCommand('changes_in_worktree', (params) => mockBackend.getWorktreeChanges(params));
601601
mockCommand('update_commit_message', (params) => mockBackend.updateCommitMessage(params));
602602
mockCommand('tree_change_diffs', (params) => mockBackend.getDiff(params));
603-
mockCommand('commit_details', (params) => mockBackend.getCommitChanges(params));
603+
mockCommand('commit_details_with_line_stats', (params) => mockBackend.getCommitChanges(params));
604604
mockCommand('create_commit_from_worktree_changes', (params) =>
605605
mockBackend.createCommit(params)
606606
);
@@ -696,7 +696,7 @@ describe('Commit Actions with no stacks', () => {
696696
mockCommand('update_commit_message', (params) => mockBackend.updateCommitMessage(params));
697697
mockCommand('changes_in_worktree', (params) => mockBackend.getWorktreeChanges(params));
698698
mockCommand('tree_change_diffs', (params) => mockBackend.getDiff(params));
699-
mockCommand('commit_details', (params) => mockBackend.getCommitChanges(params));
699+
mockCommand('commit_details_with_line_stats', (params) => mockBackend.getCommitChanges(params));
700700
mockCommand('create_commit_from_worktree_changes', (params) =>
701701
mockBackend.createCommit(params)
702702
);
@@ -833,7 +833,7 @@ describe('Commit Actions with a stack of two empty branches', () => {
833833
mockCommand('update_commit_message', (params) => mockBackend.updateCommitMessage(params));
834834
mockCommand('changes_in_worktree', (params) => mockBackend.getWorktreeChanges(params));
835835
mockCommand('tree_change_diffs', (params) => mockBackend.getDiff(params));
836-
mockCommand('commit_details', (params) => mockBackend.getCommitChanges(params));
836+
mockCommand('commit_details_with_line_stats', (params) => mockBackend.getCommitChanges(params));
837837
mockCommand('create_commit_from_worktree_changes', (params) =>
838838
mockBackend.createCommit(params)
839839
);

apps/desktop/cypress/e2e/errorHandling.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('Error handling - commit actions', () => {
1717
});
1818
mockCommand('changes_in_worktree', (params) => mockBackend.getWorktreeChanges(params));
1919
mockCommand('tree_change_diffs', (params) => mockBackend.getDiff(params));
20-
mockCommand('commit_details', (params) => mockBackend.getCommitChanges(params));
20+
mockCommand('commit_details_with_line_stats', (params) => mockBackend.getCommitChanges(params));
2121
mockCommand('create_commit_from_worktree_changes', () => {
2222
throw new Error(COMMIT_ERROR_MESSAGE);
2323
});

apps/desktop/cypress/e2e/selection.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Selection', () => {
1313
mockCommand('stack_details', (params) => mockBackend.getStackDetails(params));
1414
mockCommand('changes_in_branch', (args) => mockBackend.getBranchChanges(args));
1515
mockCommand('hunk_assignments', (params) => mockBackend.getHunkAssignments(params));
16-
mockCommand('commit_details', (params) => mockBackend.getCommitChanges(params));
16+
mockCommand('commit_details_with_line_stats', (params) => mockBackend.getCommitChanges(params));
1717
mockCommand('tree_change_diffs', (params) => mockBackend.getDiff(params));
1818
mockCommand('list_workspace_rules', (params) => mockBackend.listWorkspaceRules(params));
1919
mockCommand('get_author_info', (params) => mockBackend.getAuthorInfo(params));

apps/desktop/cypress/e2e/support/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Cypress.on('window:before:load', (win) => {
109109
return MOCK_UNIFIED_DIFF;
110110
case 'git_get_global_config':
111111
return await Promise.resolve(undefined);
112-
case 'commit_details':
112+
case 'commit_details_with_line_stats':
113113
return MOCK_TREE_CHANGES;
114114
case 'stack_details':
115115
return MOCK_STACK_DETAILS;

apps/desktop/src/lib/stacks/stackService.svelte.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ function injectEndpoints(api: ClientState['backendApi'], uiState: UiState) {
11451145
{ projectId: string; commitId: string }
11461146
>({
11471147
keepUnusedDataFor: 60, // Keep for 1 minute after last use
1148-
extraOptions: { command: 'commit_details' },
1148+
extraOptions: { command: 'commit_details_with_line_stats' },
11491149
query: (args) => args,
11501150
providesTags: (_result, _error, { commitId }) => [
11511151
...providesItem(ReduxTag.CommitChanges, commitId)

crates/but-action/src/rename_branch.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ pub async fn rename_branch(
3232
.iter()
3333
.flat_map(|s| s.heads.iter().map(|h| h.name.clone().to_string()))
3434
.collect::<Vec<_>>();
35-
let changes = but_core::diff::ui::commit_changes_by_worktree_dir(repo, commit_id)?;
35+
let changes =
36+
but_core::diff::ui::commit_changes_with_line_stats_by_worktree_dir(repo, commit_id)?;
3637
let diff = changes
3738
.try_to_unidiff(repo, ctx.settings().context_lines)?
3839
.to_string();

crates/but-action/src/reword.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ pub async fn commit(
2727
let (diff, sync_ctx) = {
2828
let ctx = Context::new_from_legacy_project(event.project.clone())?;
2929
let repo = &ctx.open_repo_for_merging_non_persisting()?;
30-
let changes = but_core::diff::ui::commit_changes_by_worktree_dir(repo, event.commit_id)?;
30+
let changes = but_core::diff::ui::commit_changes_with_line_stats_by_worktree_dir(
31+
repo,
32+
event.commit_id,
33+
)?;
3134
(
3235
changes
3336
.try_to_unidiff(repo, ctx.settings().context_lines)?

0 commit comments

Comments
 (0)