forked from gitui-org/gitui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueue.rs
75 lines (70 loc) · 1.64 KB
/
queue.rs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
use crate::tabs::StashingOptions;
use asyncgit::sync::{diff::DiffLinePosition, CommitId, CommitTags};
use bitflags::bitflags;
use std::{cell::RefCell, collections::VecDeque, rc::Rc};
bitflags! {
/// flags defining what part of the app need to update
pub struct NeedsUpdate: u32 {
/// app::update
const ALL = 0b001;
/// diff may have changed (app::update_diff)
const DIFF = 0b010;
/// commands might need updating (app::update_commands)
const COMMANDS = 0b100;
}
}
/// data of item that is supposed to be reset
pub struct ResetItem {
/// path to the item (folder/file)
pub path: String,
/// are talking about a folder here? otherwise it's a single file
pub is_folder: bool,
}
///
pub enum Action {
Reset(ResetItem),
ResetHunk(String, u64),
ResetLines(String, Vec<DiffLinePosition>),
StashDrop(CommitId),
StashPop(CommitId),
DeleteBranch(String),
ForcePush(String, bool),
PullMerge { incoming: usize, rebase: bool },
}
///
pub enum InternalEvent {
///
ConfirmAction(Action),
///
ConfirmedAction(Action),
///
ShowErrorMsg(String),
///
Update(NeedsUpdate),
/// open commit msg input
OpenCommit,
///
PopupStashing(StashingOptions),
///
TabSwitch,
///
InspectCommit(CommitId, Option<CommitTags>),
///
TagCommit(CommitId),
///
CreateBranch,
///
RenameBranch(String, String),
///
SelectBranch,
///
OpenExternalEditor(Option<String>),
///
Push(String, bool),
///
Pull(String),
///
PushTags,
}
///
pub type Queue = Rc<RefCell<VecDeque<InternalEvent>>>;