pub struct BranchEntry {
pub name: String,
pub worktree_path: Option<PathBuf>,
pub has_session: bool,
pub is_current: bool,
pub is_default: bool,
pub remote: Option<String>,
pub session_activity_ts: Option<u64>,
pub agent_status: Option<AgentStatus>,
}Expand description
Rich branch entry with worktree and session metadata
Fields§
§name: String§worktree_path: Option<PathBuf>If a worktree already exists for this branch
has_session: bool§is_current: bool§is_default: boolWhether this is the default branch (main/master)
remote: Option<String>The remote this branch comes from, if it is a remote-only branch.
session_activity_ts: Option<u64>Last activity timestamp for the session (if any)
agent_status: Option<AgentStatus>Status of any AI agent running in the session
Implementations§
Source§impl BranchEntry
impl BranchEntry
Sourcepub fn build(
repo: &Repo,
branch_names: &[String],
active_sessions: &[String],
) -> Vec<Self>
pub fn build( repo: &Repo, branch_names: &[String], active_sessions: &[String], ) -> Vec<Self>
Build branch entries from a repo’s branches, worktrees, and active tmux sessions (unsorted).
Sourcepub fn build_sorted(
repo: &Repo,
branch_names: &[String],
active_sessions: &[String],
) -> Vec<Self>
pub fn build_sorted( repo: &Repo, branch_names: &[String], active_sessions: &[String], ) -> Vec<Self>
Build sorted branch entries from a repo’s branches, worktrees, and active tmux sessions.
Sorted by: sessions first, then worktrees, then alphabetical.
Sourcepub fn build_sorted_with_activity(
repo: &Repo,
branch_names: &[String],
active_sessions: &[String],
default_branch: Option<&str>,
session_activity: &HashMap<String, u64>,
cwd: Option<&Path>,
) -> Vec<Self>
pub fn build_sorted_with_activity( repo: &Repo, branch_names: &[String], active_sessions: &[String], default_branch: Option<&str>, session_activity: &HashMap<String, u64>, cwd: Option<&Path>, ) -> Vec<Self>
Build sorted branch entries with activity timestamps and default branch info.
cwd is the user’s current working directory (resolved to a repo/worktree root).
When it matches a worktree path, that worktree’s branch is marked as current.
Falls back to the main worktree’s branch when cwd is None or doesn’t match.
Sourcepub fn build_remote(
remote: &str,
remote_names: &[String],
local_names: &[String],
) -> Vec<Self>
pub fn build_remote( remote: &str, remote_names: &[String], local_names: &[String], ) -> Vec<Self>
Build remote-only branch entries, skipping branches that already exist locally.
pub fn sort_entries(entries: &mut [Self])
Trait Implementations§
Source§impl Clone for BranchEntry
impl Clone for BranchEntry
Source§fn clone(&self) -> BranchEntry
fn clone(&self) -> BranchEntry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more