first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+20 -20
View File
@@ -1,16 +1,15 @@
use std::path::PathBuf;
use galaxyui::{
elements::ChildView, ui_components::components::UiComponentStyles, AppContext, Element, Entity,
TypedActionView, View, ViewContext, ViewHandle,
};
use galaxyui::elements::ChildView;
use galaxyui::ui_components::components::UiComponentStyles;
use galaxyui::{AppContext, Element, Entity, TypedActionView, View, ViewContext, ViewHandle};
use crate::{
code_review::diff_state::DiffStateModel,
tab_configs::PickerStyle,
util::git::detect_current_branch,
view_components::{DropdownItem, FilterableDropdown},
use crate::tab_configs::PickerStyle;
use crate::util::git::{
detect_current_branch, get_all_branches, get_all_branches_with_known_main,
sort_branches_main_first, BranchEntry,
};
use crate::view_components::{DropdownItem, FilterableDropdown};
const DEFAULT_DROPDOWN_WIDTH: f32 = 380.;
/// Placeholder text shown in the dropdown top bar while branches are loading.
@@ -137,10 +136,9 @@ impl BranchPicker {
async move {
let branches = match known_main {
Some(ref main) => {
DiffStateModel::get_all_branches_with_known_main(&cwd, main, None, false)
.await
get_all_branches_with_known_main(&cwd, main, None, false).await
}
None => DiffStateModel::get_all_branches(&cwd, None, false).await,
None => get_all_branches(&cwd, None, false).await,
};
// git for-each-ref only lists refs backed by actual commits,
@@ -153,7 +151,10 @@ impl BranchPicker {
if let Ok(current) = detect_current_branch(&cwd).await {
let trimmed = current.trim().to_string();
if !trimmed.is_empty() {
return Ok(vec![(trimmed, true)]);
return Ok(vec![BranchEntry {
name: trimmed,
is_main: true,
}]);
}
}
branches
@@ -185,20 +186,19 @@ impl BranchPicker {
if me.cached_main_branch.is_none() {
me.cached_main_branch = branches
.iter()
.find(|(_, is_main)| *is_main)
.map(|(name, _)| name.clone());
.find(|entry| entry.is_main)
.map(|entry| entry.name.clone());
}
// Main branches first, then the rest in recency order.
let mut items: Vec<DropdownItem<String>> =
DiffStateModel::sort_branches_main_first(&branches)
.map(|(name, _)| DropdownItem::new(name.clone(), name.clone()))
.collect();
let mut items: Vec<DropdownItem<String>> = sort_branches_main_first(&branches)
.map(|entry| DropdownItem::new(entry.name.clone(), entry.name.clone()))
.collect();
// Add the default as the first item if it isn't already in the list
// (e.g. the user typed a branch name that doesn't exist locally yet).
if let Some(ref default) = me.default_value {
if !branches.iter().any(|(name, _)| name == default) {
if !branches.iter().any(|entry| entry.name == *default) {
items.insert(0, DropdownItem::new(default.clone(), default.clone()));
}
}