Compare commits

..

No commits in common. "9720fd01fc53656333684c4aade5108402851b22" and "d2048d8a34dca003a2918f0c19dad4f9333f1ee2" have entirely different histories.

2 changed files with 11 additions and 13 deletions

View file

@ -1,4 +1,3 @@
use color_eyre::owo_colors::OwoColorize;
// //
use git_next_core::git::graph::Log; use git_next_core::git::graph::Log;
use lazy_static::lazy_static; use lazy_static::lazy_static;
@ -63,6 +62,7 @@ impl From<LogLine> for Line<'_> {
let pre = caps["pre"].to_owned(); let pre = caps["pre"].to_owned();
let hash = caps["hash"].to_owned(); let hash = caps["hash"].to_owned();
let message = caps["message"].to_owned(); let message = caps["message"].to_owned();
info!(branches=?caps["branches"], "raw branches");
let mut branches = BRANCHES let mut branches = BRANCHES
.captures_iter(&caps["branches"]) .captures_iter(&caps["branches"])
.map(|captures| captures["branch"].to_owned()) .map(|captures| captures["branch"].to_owned())
@ -80,13 +80,16 @@ impl From<LogLine> for Line<'_> {
} else { } else {
// line withbranches // line withbranches
let mut spans = vec![pre.into(), " ".into(), hash.into(), " ".into()]; let mut spans = vec![pre.into(), " ".into(), hash.into(), " ".into()];
info!(?branches, "matched branch list");
branches.sort(); branches.sort();
branches branches
.into_iter() .into_iter()
.map(|branch| format!("({branch})")) .map(|branch| Span::from(branch).style(Style::default().fg(Color::Blue)))
.map(Span::from) .for_each(|span| {
.map(|span| span.style(Style::default().fg(Color::White).bg(Color::Blue))) spans.push("[".into());
.for_each(|span| spans.push(span)); spans.push(span);
spans.push("]".into());
});
spans.push(" ".into()); spans.push(" ".into());
spans.push(message.into()); spans.push(message.into());
Line::from(spans) Line::from(spans)

View file

@ -36,16 +36,11 @@ impl<'a> Identity<'a> {
impl<'a> Identity<'a> { impl<'a> Identity<'a> {
fn spans(self) -> Vec<Span<'a>> { fn spans(self) -> Vec<Span<'a>> {
let label = self.label; let label = self.label;
let repo_alias = Span::from(self.repo_alias.to_string()).style(if self.alert.is_some() { let repo_alias = self.repo_alias;
Style::default().fg(Color::Black).bg(Color::Red)
} else {
Style::default().fg(Color::Cyan).bg(Color::Black)
});
let alert = self let alert = self
.alert .alert
.map_or(String::new(), |a| format!("{a} ")) .map_or(String::new(), |a| format!("{a} "))
.fg(Color::Black) .fg(Color::Red);
.bg(Color::Red);
let message = self.message; let message = self.message;
let main = self let main = self
.repo_branches .repo_branches
@ -61,7 +56,7 @@ impl<'a> Identity<'a> {
.map_or_else(|| "_".to_string(), |b| b.to_string()); .map_or_else(|| "_".to_string(), |b| b.to_string());
vec![ vec![
" ".into(), " ".into(),
repo_alias, Span::from(repo_alias.to_string()).style(Style::default().fg(Color::Blue)),
format!(" ({label}) ").into(), format!(" ({label}) ").into(),
alert, alert,
format!("({main}/{next}/{dev}) [").into(), format!("({main}/{next}/{dev}) [").into(),