mirror of
https://github.com/extrawurst/gitui.git
synced 2024-12-28 03:22:51 +03:00
consistent log:: usage
This commit is contained in:
parent
d8b5a4b2c5
commit
38413d069e
@ -2,7 +2,6 @@ use crate::{
|
|||||||
error::Result, hash, sync, AsyncNotification, FileDiff, CWD,
|
error::Result, hash, sync, AsyncNotification, FileDiff, CWD,
|
||||||
};
|
};
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use log::trace;
|
|
||||||
use std::{
|
use std::{
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
sync::{
|
sync::{
|
||||||
@ -72,7 +71,7 @@ impl AsyncDiff {
|
|||||||
&mut self,
|
&mut self,
|
||||||
params: DiffParams,
|
params: DiffParams,
|
||||||
) -> Result<Option<FileDiff>> {
|
) -> Result<Option<FileDiff>> {
|
||||||
trace!("request");
|
log::trace!("request");
|
||||||
|
|
||||||
let hash = hash(¶ms);
|
let hash = hash(¶ms);
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use git2::Oid;
|
use git2::Oid;
|
||||||
use log::debug;
|
|
||||||
use scopetime::scope_time;
|
use scopetime::scope_time;
|
||||||
use std::{
|
use std::{
|
||||||
iter::FromIterator,
|
iter::FromIterator,
|
||||||
@ -89,11 +88,6 @@ impl AsyncLog {
|
|||||||
fn head_changed(&self) -> Result<bool> {
|
fn head_changed(&self) -> Result<bool> {
|
||||||
if let Ok(head) = repo(CWD)?.head() {
|
if let Ok(head) = repo(CWD)?.head() {
|
||||||
if let Some(head) = head.target() {
|
if let Some(head) = head.target() {
|
||||||
debug!(
|
|
||||||
"repo head vs current log head: {} vs. {}",
|
|
||||||
head,
|
|
||||||
self.current_head()?
|
|
||||||
);
|
|
||||||
return Ok(head != self.current_head()?);
|
return Ok(head != self.current_head()?);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ use crate::{
|
|||||||
error::Result, hash, sync, AsyncNotification, StatusItem, CWD,
|
error::Result, hash, sync, AsyncNotification, StatusItem, CWD,
|
||||||
};
|
};
|
||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use log::trace;
|
|
||||||
use std::{
|
use std::{
|
||||||
hash::Hash,
|
hash::Hash,
|
||||||
sync::{
|
sync::{
|
||||||
@ -86,7 +85,7 @@ impl AsyncStatus {
|
|||||||
) -> Result<Option<Status>> {
|
) -> Result<Option<Status>> {
|
||||||
let hash_request = hash(¶ms);
|
let hash_request = hash(¶ms);
|
||||||
|
|
||||||
trace!("request: [hash: {}]", hash_request);
|
log::trace!("request: [hash: {}]", hash_request);
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut current = self.current.lock()?;
|
let mut current = self.current.lock()?;
|
||||||
@ -135,7 +134,7 @@ impl AsyncStatus {
|
|||||||
arc_last: Arc<Mutex<Status>>,
|
arc_last: Arc<Mutex<Status>>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let res = Self::get_status(status_type, include_untracked)?;
|
let res = Self::get_status(status_type, include_untracked)?;
|
||||||
trace!("status fetched: {}", hash(&res));
|
log::trace!("status fetched: {}", hash(&res));
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut current = arc_current.lock()?;
|
let mut current = arc_current.lock()?;
|
||||||
|
@ -4,7 +4,6 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::{error::Error, error::Result, hash};
|
use crate::{error::Error, error::Result, hash};
|
||||||
use git2::{ApplyLocation, ApplyOptions, Diff};
|
use git2::{ApplyLocation, ApplyOptions, Diff};
|
||||||
use log::error;
|
|
||||||
use scopetime::scope_time;
|
use scopetime::scope_time;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -72,7 +71,6 @@ pub fn unstage_hunk(
|
|||||||
let hunk_index = find_hunk_index(&diff, hunk_hash);
|
let hunk_index = find_hunk_index(&diff, hunk_hash);
|
||||||
|
|
||||||
if hunk_index.is_none() {
|
if hunk_index.is_none() {
|
||||||
error!("hunk not found");
|
|
||||||
return Err(Error::Generic("hunk not found".to_string()));
|
return Err(Error::Generic("hunk not found".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +98,6 @@ pub fn unstage_hunk(
|
|||||||
.apply(&diff, ApplyLocation::Index, Some(&mut opt))
|
.apply(&diff, ApplyLocation::Index, Some(&mut opt))
|
||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
error!("apply failed");
|
|
||||||
return Err(Error::Generic("apply failed".to_string()));
|
return Err(Error::Generic("apply failed".to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#![forbid(missing_docs)]
|
#![forbid(missing_docs)]
|
||||||
#![deny(clippy::result_unwrap_used)]
|
#![deny(clippy::result_unwrap_used)]
|
||||||
|
|
||||||
use log::trace;
|
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -37,7 +36,7 @@ impl<'a> ScopeTimeLog<'a> {
|
|||||||
|
|
||||||
impl<'a> Drop for ScopeTimeLog<'a> {
|
impl<'a> Drop for ScopeTimeLog<'a> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
trace!(
|
log::trace!(
|
||||||
"scopetime: {:?} ms [{}::{}] @{}:{}",
|
"scopetime: {:?} ms [{}::{}] @{}:{}",
|
||||||
self.time.elapsed().as_millis(),
|
self.time.elapsed().as_millis(),
|
||||||
self.mod_path,
|
self.mod_path,
|
||||||
|
@ -16,7 +16,6 @@ use asyncgit::{sync, AsyncNotification, CWD};
|
|||||||
use crossbeam_channel::Sender;
|
use crossbeam_channel::Sender;
|
||||||
use crossterm::event::Event;
|
use crossterm::event::Event;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use log::trace;
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use strings::commands;
|
use strings::commands;
|
||||||
use tui::{
|
use tui::{
|
||||||
@ -113,7 +112,7 @@ impl App {
|
|||||||
|
|
||||||
///
|
///
|
||||||
pub fn event(&mut self, ev: Event) -> Result<()> {
|
pub fn event(&mut self, ev: Event) -> Result<()> {
|
||||||
trace!("event: {:?}", ev);
|
log::trace!("event: {:?}", ev);
|
||||||
|
|
||||||
if self.check_quit(ev) {
|
if self.check_quit(ev) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@ -155,7 +154,7 @@ impl App {
|
|||||||
//TODO: do we need this?
|
//TODO: do we need this?
|
||||||
/// forward ticking to components that require it
|
/// forward ticking to components that require it
|
||||||
pub fn update(&mut self) -> Result<()> {
|
pub fn update(&mut self) -> Result<()> {
|
||||||
trace!("update");
|
log::trace!("update");
|
||||||
self.status_tab.update()?;
|
self.status_tab.update()?;
|
||||||
self.revlog.update()?;
|
self.revlog.update()?;
|
||||||
self.stashing_tab.update()?;
|
self.stashing_tab.update()?;
|
||||||
@ -168,7 +167,7 @@ impl App {
|
|||||||
&mut self,
|
&mut self,
|
||||||
ev: AsyncNotification,
|
ev: AsyncNotification,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
trace!("update_git: {:?}", ev);
|
log::trace!("update_git: {:?}", ev);
|
||||||
|
|
||||||
self.status_tab.update_git(ev)?;
|
self.status_tab.update_git(ev)?;
|
||||||
self.stashing_tab.update_git(ev)?;
|
self.stashing_tab.update_git(ev)?;
|
||||||
|
@ -10,7 +10,6 @@ use crate::{
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use asyncgit::{sync, CWD};
|
use asyncgit::{sync, CWD};
|
||||||
use crossterm::event::{Event, KeyCode};
|
use crossterm::event::{Event, KeyCode};
|
||||||
use log::error;
|
|
||||||
use strings::commands;
|
use strings::commands;
|
||||||
use sync::HookResult;
|
use sync::HookResult;
|
||||||
use tui::{backend::Backend, layout::Rect, Frame};
|
use tui::{backend::Backend, layout::Rect, Frame};
|
||||||
@ -104,7 +103,7 @@ impl CommitComponent {
|
|||||||
if let HookResult::NotOk(e) =
|
if let HookResult::NotOk(e) =
|
||||||
sync::hooks_commit_msg(CWD, &mut msg)?
|
sync::hooks_commit_msg(CWD, &mut msg)?
|
||||||
{
|
{
|
||||||
error!("commit-msg hook error: {}", e);
|
log::error!("commit-msg hook error: {}", e);
|
||||||
self.queue.borrow_mut().push_back(
|
self.queue.borrow_mut().push_back(
|
||||||
InternalEvent::ShowErrorMsg(format!(
|
InternalEvent::ShowErrorMsg(format!(
|
||||||
"commit-msg hook error:\n{}",
|
"commit-msg hook error:\n{}",
|
||||||
@ -115,7 +114,7 @@ impl CommitComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = sync::commit(CWD, &msg) {
|
if let Err(e) = sync::commit(CWD, &msg) {
|
||||||
error!("commit error: {}", &e);
|
log::error!("commit error: {}", &e);
|
||||||
self.queue.borrow_mut().push_back(
|
self.queue.borrow_mut().push_back(
|
||||||
InternalEvent::ShowErrorMsg(format!(
|
InternalEvent::ShowErrorMsg(format!(
|
||||||
"commit failed:\n{}",
|
"commit failed:\n{}",
|
||||||
@ -126,7 +125,7 @@ impl CommitComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let HookResult::NotOk(e) = sync::hooks_post_commit(CWD)? {
|
if let HookResult::NotOk(e) = sync::hooks_post_commit(CWD)? {
|
||||||
error!("post-commit hook error: {}", e);
|
log::error!("post-commit hook error: {}", e);
|
||||||
self.queue.borrow_mut().push_back(
|
self.queue.borrow_mut().push_back(
|
||||||
InternalEvent::ShowErrorMsg(format!(
|
InternalEvent::ShowErrorMsg(format!(
|
||||||
"post-commit hook error:\n{}",
|
"post-commit hook error:\n{}",
|
||||||
|
Loading…
Reference in New Issue
Block a user