mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-25 10:33:21 +03:00
Record entering edit mode in oplog
This commit is contained in:
parent
7ab7731a31
commit
dbe8013de3
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2206,6 +2206,7 @@ dependencies = [
|
||||
"gitbutler-command-context",
|
||||
"gitbutler-commit",
|
||||
"gitbutler-operating-modes",
|
||||
"gitbutler-oplog",
|
||||
"gitbutler-project",
|
||||
"gitbutler-reference",
|
||||
"gitbutler-repo",
|
||||
|
@ -144,6 +144,8 @@
|
||||
return { text: 'Update workspace base', icon: 'rebase' };
|
||||
case 'RestoreFromSnapshot':
|
||||
return { text: 'Revert snapshot', icon: 'empty' };
|
||||
case 'EnterEditMode':
|
||||
return { text: 'Enter Edit Mode', icon: 'edit-text' };
|
||||
default:
|
||||
return { text: snapshotDetails.operation, icon: 'commit' };
|
||||
}
|
||||
|
@ -29,7 +29,8 @@ export type Operation =
|
||||
| 'ReorderCommit'
|
||||
| 'InsertBlankCommit'
|
||||
| 'MoveCommitFile'
|
||||
| 'FileChanges';
|
||||
| 'FileChanges'
|
||||
| 'EnterEditMode';
|
||||
|
||||
export class Trailer {
|
||||
key!: string;
|
||||
|
@ -18,3 +18,4 @@ gitbutler-project.workspace = true
|
||||
gitbutler-branch-actions.workspace = true
|
||||
gitbutler-reference.workspace = true
|
||||
gitbutler-time.workspace = true
|
||||
gitbutler-oplog.workspace = true
|
||||
|
@ -1,6 +1,10 @@
|
||||
use anyhow::{Context, Result};
|
||||
use gitbutler_command_context::CommandContext;
|
||||
use gitbutler_operating_modes::{assure_edit_mode, assure_open_workspace_mode, EditModeMetadata};
|
||||
use gitbutler_oplog::{
|
||||
entry::{OperationKind, SnapshotDetails},
|
||||
OplogExt,
|
||||
};
|
||||
use gitbutler_project::{access::WriteWorkspaceGuard, Project};
|
||||
use gitbutler_reference::ReferenceName;
|
||||
|
||||
@ -24,7 +28,20 @@ pub fn enter_edit_mode(
|
||||
.find_reference(&editee_branch)
|
||||
.context("Failed to find editee branch reference")?;
|
||||
|
||||
crate::enter_edit_mode(&ctx, &editee, &editee_branch, guard.write_permission())
|
||||
let snapshot = project
|
||||
.prepare_snapshot(guard.read_permission())
|
||||
.context("Failed to prepare snapshot")?;
|
||||
|
||||
let edit_mode_metadata =
|
||||
crate::enter_edit_mode(&ctx, &editee, &editee_branch, guard.write_permission())?;
|
||||
|
||||
let _ = project.commit_snapshot(
|
||||
snapshot,
|
||||
SnapshotDetails::new(OperationKind::EnterEditMode),
|
||||
guard.write_permission(),
|
||||
);
|
||||
|
||||
Ok(edit_mode_metadata)
|
||||
}
|
||||
|
||||
pub fn save_and_return_to_workspace(project: &Project) -> Result<()> {
|
||||
|
@ -155,6 +155,7 @@ pub enum OperationKind {
|
||||
InsertBlankCommit,
|
||||
MoveCommitFile,
|
||||
FileChanges,
|
||||
EnterEditMode,
|
||||
#[default]
|
||||
Unknown,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user