1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// SPDX-License-Identifier: Apache-2.0
//! Action operation types.
use serde::{Deserialize, Serialize};
use super::ChangeId;
/// Type of operation performed.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum Operation {
/// Repository initialization.
Init,
/// Capture worktree as new state.
Snapshot,
/// Move worktree to a different state.
Goto,
/// Create a new branch of exploration.
Fork,
/// Squash multiple states into one.
Collapse {
/// Source states that were collapsed.
sources: Vec<ChangeId>,
},
/// AI-generated merge/reconciliation.
Synthesize {
/// Source states that were synthesized.
sources: Vec<ChangeId>,
},
/// Update a thread reference.
ThreadUpdate {
/// Name of the thread.
thread: String,
},
/// Import from external source.
Import {
/// Description of the source.
source: String,
},
}
impl Operation {
/// Get a short description of the operation.
pub fn description(&self) -> &'static str {
match self {
Operation::Init => "initialize repository",
Operation::Snapshot => "snapshot",
Operation::Goto => "goto",
Operation::Fork => "fork",
Operation::Collapse { .. } => "collapse",
Operation::Synthesize { .. } => "synthesize",
Operation::ThreadUpdate { .. } => "update thread",
Operation::Import { .. } => "import",
}
}
}