mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-29 14:30:31 +08:00
bin(patch): Log more review debug output
This commit is contained in:
@@ -280,6 +280,8 @@ impl<'a> App<'a> {
|
||||
None => file.insert(FileReviewBuilder::new(item.inner.hunk())),
|
||||
};
|
||||
|
||||
log::info!("Accepting hunk ({:?})", item.inner.hunk());
|
||||
|
||||
let diff = file.item_diff(item.inner.hunk())?;
|
||||
brain.accept(diff, repo.raw())?;
|
||||
}
|
||||
@@ -309,7 +311,11 @@ impl<'a> App<'a> {
|
||||
let rejected_hunks =
|
||||
Hunks::new(DiffUtil::new(&repo).rejected_diffs(&brain, &self.revision)?);
|
||||
|
||||
for item in items {
|
||||
log::info!("Reloaded hunk states..");
|
||||
log::info!("Rejected hunks: {:?}", rejected_hunks);
|
||||
log::info!("Requested to reload hunks: {:?}", items);
|
||||
|
||||
for item in &mut *items {
|
||||
let state = if rejected_hunks.contains(item.inner.hunk()) {
|
||||
HunkState::Rejected
|
||||
} else {
|
||||
@@ -318,6 +324,8 @@ impl<'a> App<'a> {
|
||||
*item.inner.state_mut() = state;
|
||||
}
|
||||
|
||||
log::info!("Reloaded hunks: {:?}", items);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -572,7 +580,7 @@ impl<'a> store::Update<Message<'a>> for App<'a> {
|
||||
}
|
||||
Message::Accept => {
|
||||
match self.accept_current_hunk() {
|
||||
Ok(()) => log::info!("Accepted hunk."),
|
||||
Ok(()) => log::info!("Hunk accepted."),
|
||||
Err(err) => log::info!("An error occured while accepting hunk: {}", err),
|
||||
}
|
||||
let _ = self.reload_states();
|
||||
|
||||
@@ -30,7 +30,7 @@ use radicle_cli::terminal as term;
|
||||
use crate::git::HunkDiff;
|
||||
|
||||
/// Queue of items (usually hunks) left to review.
|
||||
#[derive(Clone, Default)]
|
||||
#[derive(Clone, Default, Debug)]
|
||||
pub struct Hunks {
|
||||
hunks: Vec<HunkDiff>,
|
||||
}
|
||||
@@ -153,7 +153,39 @@ impl Hunks {
|
||||
self.hunks.push(item);
|
||||
}
|
||||
|
||||
// pub fn contains(&self, )
|
||||
// pub fn contains(&self, hunk: &HunkDiff) -> bool {
|
||||
// match hunk {
|
||||
// HunkDiff::Modified {
|
||||
// path: _,
|
||||
// header: _,
|
||||
// old: _,
|
||||
// new: _,
|
||||
// hunk,
|
||||
// _stats,
|
||||
// } => {
|
||||
// let mut contains = false;
|
||||
// let other = hunk.clone();
|
||||
|
||||
// for rejected in &self.hunks {
|
||||
// match rejected {
|
||||
// HunkDiff::Modified {
|
||||
// path,
|
||||
// header,
|
||||
// old,
|
||||
// new,
|
||||
// hunk,
|
||||
// _stats,
|
||||
// } => {
|
||||
// contains = true;
|
||||
// }
|
||||
// _ => contains = other == rejected.hunk().cloned(),
|
||||
// }
|
||||
// }
|
||||
// contains
|
||||
// }
|
||||
// _ => self.hunks.contains(hunk),
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
impl std::ops::Deref for Hunks {
|
||||
@@ -439,15 +471,6 @@ impl<'a> ReviewBuilder<'a> {
|
||||
let diff = DiffUtil::new(self.repo).all_diffs(revision)?;
|
||||
Ok(Hunks::new(diff))
|
||||
}
|
||||
|
||||
// pub fn rejected_hunks(
|
||||
// &self,
|
||||
// brain: &'a Brain<'a>,
|
||||
// revision: &Revision,
|
||||
// ) -> anyhow::Result<Hunks> {
|
||||
// let diff = DiffUtil::new(self.repo).rejected_diffs(brain, revision)?;
|
||||
// Ok(Hunks::new(diff))
|
||||
// }
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
|
||||
Reference in New Issue
Block a user