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

View file

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