mirror of
https://github.com/gitui-org/gitui
synced 2026-05-22 16:38:28 +00:00
allow inspecting top commit in branchlist
This commit is contained in:
parent
6abc7d297f
commit
bc611bca52
5 changed files with 34 additions and 9 deletions
|
|
@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||

|
||||
|
||||
## Added
|
||||
- allow opening top commit of a branch
|
||||
- new options popup (show untracked files, diff settings) ([#849](https://github.com/extrawurst/gitui/issues/849))
|
||||
- mark and drop multiple stashes ([#854](https://github.com/extrawurst/gitui/issues/854))
|
||||
- check branch name validity while typing ([#559](https://github.com/extrawurst/gitui/issues/559))
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ impl Component for BlameFileComponent {
|
|||
);
|
||||
out.push(
|
||||
CommandInfo::new(
|
||||
strings::commands::log_details_open(
|
||||
strings::commands::commit_details_open(
|
||||
&self.key_config,
|
||||
),
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use anyhow::Result;
|
|||
use asyncgit::{
|
||||
sync::{
|
||||
self, branch::checkout_remote_branch, checkout_branch,
|
||||
get_branches_info, BranchInfo,
|
||||
get_branches_info, BranchInfo, CommitId,
|
||||
},
|
||||
AsyncGitNotification, CWD,
|
||||
};
|
||||
|
|
@ -118,6 +118,14 @@ impl Component for BranchListComponent {
|
|||
true,
|
||||
));
|
||||
|
||||
out.push(CommandInfo::new(
|
||||
strings::commands::commit_details_open(
|
||||
&self.key_config,
|
||||
),
|
||||
true,
|
||||
true,
|
||||
));
|
||||
|
||||
out.push(CommandInfo::new(
|
||||
strings::commands::toggle_branch_popup(
|
||||
&self.key_config,
|
||||
|
|
@ -192,6 +200,9 @@ impl Component for BranchListComponent {
|
|||
return self
|
||||
.move_selection(ScrollType::PageUp)
|
||||
.map(Into::into);
|
||||
} else if e == self.key_config.tab_toggle {
|
||||
self.local = !self.local;
|
||||
self.update_branches()?;
|
||||
} else if e == self.key_config.enter {
|
||||
try_or_popup!(
|
||||
self,
|
||||
|
|
@ -234,13 +245,18 @@ impl Component for BranchListComponent {
|
|||
"merge branch error:",
|
||||
self.merge_branch()
|
||||
);
|
||||
self.hide();
|
||||
self.queue.push(InternalEvent::Update(
|
||||
NeedsUpdate::ALL,
|
||||
));
|
||||
} else if e == self.key_config.tab_toggle {
|
||||
self.local = !self.local;
|
||||
self.update_branches()?;
|
||||
} else if e == self.key_config.move_right
|
||||
&& self.valid_selection()
|
||||
{
|
||||
self.hide();
|
||||
if let Some(b) = self.get_selected() {
|
||||
self.queue.push(
|
||||
InternalEvent::InspectCommit(b, None),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -351,6 +367,12 @@ impl BranchListComponent {
|
|||
.count() > 0
|
||||
}
|
||||
|
||||
fn get_selected(&self) -> Option<CommitId> {
|
||||
self.branches
|
||||
.get(usize::from(self.selection))
|
||||
.map(|b| b.top_commit)
|
||||
}
|
||||
|
||||
///
|
||||
fn move_selection(&mut self, scroll: ScrollType) -> Result<bool> {
|
||||
let new_selection = match scroll {
|
||||
|
|
|
|||
|
|
@ -929,7 +929,8 @@ pub mod commands {
|
|||
CMD_GROUP_LOG,
|
||||
)
|
||||
}
|
||||
pub fn log_details_open(
|
||||
|
||||
pub fn commit_details_open(
|
||||
key_config: &SharedKeyConfig,
|
||||
) -> CommandText {
|
||||
CommandText::new(
|
||||
|
|
@ -938,9 +939,10 @@ pub mod commands {
|
|||
key_config.get_hint(key_config.focus_right),
|
||||
),
|
||||
"inspect selected commit in detail",
|
||||
CMD_GROUP_LOG,
|
||||
CMD_GROUP_GENERAL,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn blame_file(key_config: &SharedKeyConfig) -> CommandText {
|
||||
CommandText::new(
|
||||
format!(
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ impl Component for Revlog {
|
|||
));
|
||||
|
||||
out.push(CommandInfo::new(
|
||||
strings::commands::log_details_open(&self.key_config),
|
||||
strings::commands::commit_details_open(&self.key_config),
|
||||
true,
|
||||
(self.visible && self.commit_details.is_visible())
|
||||
|| force_all,
|
||||
|
|
|
|||
Loading…
Reference in a new issue