refactor better name

This commit is contained in:
Stephan Dilly 2021-06-07 23:04:07 +02:00
parent 7058ab14d3
commit 8032c35902
26 changed files with 118 additions and 112 deletions

View file

@ -2,7 +2,7 @@ use crate::{
error::Result,
hash,
sync::{self, FileBlame},
AsyncNotification, CWD,
AsyncGitNotification, CWD,
};
use crossbeam_channel::Sender;
use std::{
@ -33,13 +33,13 @@ struct LastResult<P, R> {
pub struct AsyncBlame {
current: Arc<Mutex<Request<u64, FileBlame>>>,
last: Arc<Mutex<Option<LastResult<BlameParams, FileBlame>>>>,
sender: Sender<AsyncNotification>,
sender: Sender<AsyncGitNotification>,
pending: Arc<AtomicUsize>,
}
impl AsyncBlame {
///
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
Self {
current: Arc::new(Mutex::new(Request(0, None))),
last: Arc::new(Mutex::new(None)),
@ -120,9 +120,9 @@ impl AsyncBlame {
sender
.send(if notify {
AsyncNotification::Blame
AsyncGitNotification::Blame
} else {
AsyncNotification::FinishUnchanged
AsyncGitNotification::FinishUnchanged
})
.expect("error sending blame");
});

View file

@ -1,7 +1,7 @@
use crate::{
error::Result,
sync::{self, CommitId},
AsyncNotification, StatusItem, CWD,
AsyncGitNotification, StatusItem, CWD,
};
use crossbeam_channel::Sender;
use std::sync::{
@ -15,13 +15,13 @@ struct Request<R, A>(R, A);
///
pub struct AsyncCommitFiles {
current: Arc<Mutex<Option<Request<CommitId, ResultType>>>>,
sender: Sender<AsyncNotification>,
sender: Sender<AsyncGitNotification>,
pending: Arc<AtomicUsize>,
}
impl AsyncCommitFiles {
///
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
Self {
current: Arc::new(Mutex::new(None)),
sender: sender.clone(),
@ -74,7 +74,7 @@ impl AsyncCommitFiles {
arc_pending.fetch_sub(1, Ordering::Relaxed);
sender
.send(AsyncNotification::CommitFiles)
.send(AsyncGitNotification::CommitFiles)
.expect("error sending");
});

View file

@ -2,7 +2,7 @@ use crate::{
error::Result,
hash,
sync::{self, CommitId},
AsyncNotification, FileDiff, CWD,
AsyncGitNotification, FileDiff, CWD,
};
use crossbeam_channel::Sender;
use std::{
@ -46,13 +46,13 @@ struct LastResult<P, R> {
pub struct AsyncDiff {
current: Arc<Mutex<Request<u64, FileDiff>>>,
last: Arc<Mutex<Option<LastResult<DiffParams, FileDiff>>>>,
sender: Sender<AsyncNotification>,
sender: Sender<AsyncGitNotification>,
pending: Arc<AtomicUsize>,
}
impl AsyncDiff {
///
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
Self {
current: Arc::new(Mutex::new(Request(0, None))),
last: Arc::new(Mutex::new(None)),
@ -129,9 +129,9 @@ impl AsyncDiff {
sender
.send(if notify {
AsyncNotification::Diff
AsyncGitNotification::Diff
} else {
AsyncNotification::FinishUnchanged
AsyncGitNotification::FinishUnchanged
})
.expect("error sending diff");
});

View file

@ -4,7 +4,7 @@ use crate::{
cred::BasicAuthCredential,
remotes::{fetch, push::ProgressNotification},
},
AsyncNotification, RemoteProgress, CWD,
AsyncGitNotification, RemoteProgress, CWD,
};
use crossbeam_channel::{unbounded, Sender};
use std::{
@ -33,12 +33,12 @@ pub struct AsyncFetch {
state: Arc<Mutex<Option<FetchState>>>,
last_result: Arc<Mutex<Option<(usize, String)>>>,
progress: Arc<Mutex<Option<ProgressNotification>>>,
sender: Sender<AsyncNotification>,
sender: Sender<AsyncGitNotification>,
}
impl AsyncFetch {
///
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
Self {
state: Arc::new(Mutex::new(None)),
last_result: Arc::new(Mutex::new(None)),
@ -85,7 +85,7 @@ impl AsyncFetch {
let (progress_sender, receiver) = unbounded();
let handle = RemoteProgress::spawn_receiver_thread(
AsyncNotification::Fetch,
AsyncGitNotification::Fetch,
sender.clone(),
receiver,
arc_progress,
@ -109,7 +109,7 @@ impl AsyncFetch {
Self::clear_request(&arc_state).expect("clear error");
sender
.send(AsyncNotification::Fetch)
.send(AsyncGitNotification::Fetch)
.expect("AsyncNotification error");
});

View file

@ -61,7 +61,7 @@ use std::{
/// this type is used to communicate events back through the channel
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum AsyncNotification {
pub enum AsyncGitNotification {
/// this indicates that no new state was fetched but that a async process finished
FinishUnchanged,
///

View file

@ -4,7 +4,7 @@ use crate::{
cred::BasicAuthCredential, remotes::push::push,
remotes::push::ProgressNotification,
},
AsyncNotification, RemoteProgress, CWD,
AsyncGitNotification, RemoteProgress, CWD,
};
use crossbeam_channel::{unbounded, Sender};
use std::{
@ -35,12 +35,12 @@ pub struct AsyncPush {
state: Arc<Mutex<Option<PushState>>>,
last_result: Arc<Mutex<Option<String>>>,
progress: Arc<Mutex<Option<ProgressNotification>>>,
sender: Sender<AsyncNotification>,
sender: Sender<AsyncGitNotification>,
}
impl AsyncPush {
///
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
Self {
state: Arc::new(Mutex::new(None)),
last_result: Arc::new(Mutex::new(None)),
@ -87,7 +87,7 @@ impl AsyncPush {
let (progress_sender, receiver) = unbounded();
let handle = RemoteProgress::spawn_receiver_thread(
AsyncNotification::Push,
AsyncGitNotification::Push,
sender.clone(),
receiver,
arc_progress,
@ -113,7 +113,7 @@ impl AsyncPush {
Self::clear_request(&arc_state).expect("clear error");
sender
.send(AsyncNotification::Push)
.send(AsyncGitNotification::Push)
.expect("error sending push");
});

View file

@ -4,7 +4,7 @@ use crate::{
cred::BasicAuthCredential,
remotes::tags::{push_tags, PushTagsProgress},
},
AsyncNotification, RemoteProgress, CWD,
AsyncGitNotification, RemoteProgress, CWD,
};
use crossbeam_channel::{unbounded, Sender};
use std::{
@ -31,12 +31,12 @@ pub struct AsyncPushTags {
state: Arc<Mutex<Option<PushState>>>,
last_result: Arc<Mutex<Option<String>>>,
progress: Arc<Mutex<Option<PushTagsProgress>>>,
sender: Sender<AsyncNotification>,
sender: Sender<AsyncGitNotification>,
}
impl AsyncPushTags {
///
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
Self {
state: Arc::new(Mutex::new(None)),
last_result: Arc::new(Mutex::new(None)),
@ -83,7 +83,7 @@ impl AsyncPushTags {
let (progress_sender, receiver) = unbounded();
let handle = RemoteProgress::spawn_receiver_thread(
AsyncNotification::PushTags,
AsyncGitNotification::PushTags,
sender.clone(),
receiver,
arc_progress,
@ -103,7 +103,7 @@ impl AsyncPushTags {
Self::clear_request(&arc_state).expect("clear error");
sender
.send(AsyncNotification::PushTags)
.send(AsyncGitNotification::PushTags)
.expect("error sending push");
});

View file

@ -4,7 +4,7 @@ use crate::{
error::Result,
progress::ProgressPercent,
sync::remotes::push::{AsyncProgress, ProgressNotification},
AsyncNotification,
AsyncGitNotification,
};
use crossbeam_channel::{Receiver, Sender};
use git2::PackBuilderStage;
@ -71,8 +71,8 @@ impl RemoteProgress {
pub(crate) fn spawn_receiver_thread<
T: 'static + AsyncProgress,
>(
notification_type: AsyncNotification,
sender: Sender<AsyncNotification>,
notification_type: AsyncGitNotification,
sender: Sender<AsyncGitNotification>,
receiver: Receiver<T>,
progress: Arc<Mutex<Option<T>>>,
) -> JoinHandle<()> {

View file

@ -1,7 +1,7 @@
use crate::{
error::Result,
sync::{utils::repo, CommitId, LogWalker},
AsyncNotification, CWD,
AsyncGitNotification, CWD,
};
use crossbeam_channel::Sender;
use git2::Oid;
@ -29,7 +29,7 @@ pub enum FetchStatus {
///
pub struct AsyncLog {
current: Arc<Mutex<Vec<CommitId>>>,
sender: Sender<AsyncNotification>,
sender: Sender<AsyncGitNotification>,
pending: Arc<AtomicBool>,
background: Arc<AtomicBool>,
}
@ -40,7 +40,7 @@ static SLEEP_BACKGROUND: Duration = Duration::from_millis(1000);
impl AsyncLog {
///
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
Self {
current: Arc::new(Mutex::new(Vec::new())),
sender: sender.clone(),
@ -147,7 +147,7 @@ impl AsyncLog {
fn fetch_helper(
arc_current: &Arc<Mutex<Vec<CommitId>>>,
arc_background: &Arc<AtomicBool>,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
) -> Result<()> {
let mut entries = Vec::with_capacity(LIMIT_COUNT);
let r = repo(CWD)?;
@ -183,7 +183,9 @@ impl AsyncLog {
Ok(())
}
fn notify(sender: &Sender<AsyncNotification>) {
sender.send(AsyncNotification::Log).expect("error sending");
fn notify(sender: &Sender<AsyncGitNotification>) {
sender
.send(AsyncGitNotification::Log)
.expect("error sending");
}
}

View file

@ -2,7 +2,7 @@ use crate::{
error::Result,
hash,
sync::{self, status::StatusType},
AsyncNotification, StatusItem, CWD,
AsyncGitNotification, StatusItem, CWD,
};
use crossbeam_channel::Sender;
use std::{
@ -49,13 +49,13 @@ struct Request<R, A>(R, Option<A>);
pub struct AsyncStatus {
current: Arc<Mutex<Request<u64, Status>>>,
last: Arc<Mutex<Status>>,
sender: Sender<AsyncNotification>,
sender: Sender<AsyncGitNotification>,
pending: Arc<AtomicUsize>,
}
impl AsyncStatus {
///
pub fn new(sender: Sender<AsyncNotification>) -> Self {
pub fn new(sender: Sender<AsyncGitNotification>) -> Self {
Self {
current: Arc::new(Mutex::new(Request(0, None))),
last: Arc::new(Mutex::new(Status::default())),
@ -125,7 +125,7 @@ impl AsyncStatus {
if ok {
sender
.send(AsyncNotification::Status)
.send(AsyncGitNotification::Status)
.expect("error sending status");
}
});

View file

@ -2,7 +2,7 @@ use crate::{
error::Result,
hash,
sync::{self},
AsyncNotification, CWD,
AsyncGitNotification, CWD,
};
use crossbeam_channel::Sender;
use std::{
@ -24,13 +24,13 @@ struct TagsResult {
///
pub struct AsyncTags {
last: Arc<Mutex<Option<(Instant, TagsResult)>>>,
sender: Sender<AsyncNotification>,
sender: Sender<AsyncGitNotification>,
pending: Arc<AtomicUsize>,
}
impl AsyncTags {
///
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
Self {
last: Arc::new(Mutex::new(None)),
sender: sender.clone(),
@ -84,9 +84,9 @@ impl AsyncTags {
sender
.send(if notify {
AsyncNotification::Tags
AsyncGitNotification::Tags
} else {
AsyncNotification::FinishUnchanged
AsyncGitNotification::FinishUnchanged
})
.expect("error sending notify");
});

View file

@ -20,7 +20,7 @@ use crate::{
ui::style::{SharedTheme, Theme},
};
use anyhow::{bail, Result};
use asyncgit::{sync, AsyncNotification, CWD};
use asyncgit::{sync, AsyncGitNotification, CWD};
use crossbeam_channel::Sender;
use crossterm::event::{Event, KeyEvent};
use std::{
@ -78,7 +78,7 @@ impl App {
///
#[allow(clippy::too_many_lines)]
pub fn new(
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
input: Input,
theme: Theme,
key_config: KeyConfig,
@ -343,7 +343,7 @@ impl App {
///
pub fn update_git(
&mut self,
ev: AsyncNotification,
ev: AsyncGitNotification,
) -> Result<()> {
log::trace!("update_git: {:?}", ev);

View file

@ -12,7 +12,7 @@ use crate::{
use anyhow::Result;
use asyncgit::{
sync::{BlameHunk, CommitId, FileBlame},
AsyncBlame, AsyncNotification, BlameParams,
AsyncBlame, AsyncGitNotification, BlameParams,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -245,7 +245,7 @@ impl BlameFileComponent {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
title: &str,
theme: SharedTheme,
key_config: SharedKeyConfig,
@ -284,10 +284,10 @@ impl BlameFileComponent {
///
pub fn update_git(
&mut self,
event: AsyncNotification,
event: AsyncGitNotification,
) -> Result<()> {
if self.is_visible() {
if let AsyncNotification::Blame = event {
if let AsyncGitNotification::Blame = event {
self.update()?;
}
}

View file

@ -11,7 +11,7 @@ use crate::{
use anyhow::Result;
use asyncgit::{
sync::{CommitId, CommitTags},
AsyncCommitFiles, AsyncNotification,
AsyncCommitFiles, AsyncGitNotification,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -36,7 +36,7 @@ impl CommitDetailsComponent {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
) -> Self {

View file

@ -13,7 +13,7 @@ use crate::{
use anyhow::Result;
use asyncgit::{
sync::{CommitId, CommitTags},
AsyncDiff, AsyncNotification, DiffParams, DiffType,
AsyncDiff, AsyncGitNotification, DiffParams, DiffType,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -176,7 +176,7 @@ impl InspectCommitComponent {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
) -> Self {
@ -223,12 +223,12 @@ impl InspectCommitComponent {
///
pub fn update_git(
&mut self,
ev: AsyncNotification,
ev: AsyncGitNotification,
) -> Result<()> {
if self.is_visible() {
if let AsyncNotification::CommitFiles = ev {
if let AsyncGitNotification::CommitFiles = ev {
self.update()?;
} else if let AsyncNotification::Diff = ev {
} else if let AsyncGitNotification::Diff = ev {
self.update_diff()?;
}
}

View file

@ -19,7 +19,8 @@ use asyncgit::{
},
get_default_remote,
},
AsyncFetch, AsyncNotification, FetchRequest, RemoteProgress, CWD,
AsyncFetch, AsyncGitNotification, FetchRequest, RemoteProgress,
CWD,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -48,7 +49,7 @@ impl PullComponent {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
) -> Self {
@ -111,10 +112,10 @@ impl PullComponent {
///
pub fn update_git(
&mut self,
ev: AsyncNotification,
ev: AsyncGitNotification,
) -> Result<()> {
if self.is_visible() {
if let AsyncNotification::Fetch = ev {
if let AsyncGitNotification::Fetch = ev {
self.update()?;
}
}

View file

@ -17,7 +17,7 @@ use asyncgit::{
},
get_branch_remote, get_default_remote,
},
AsyncNotification, AsyncPush, PushRequest, RemoteProgress,
AsyncGitNotification, AsyncPush, PushRequest, RemoteProgress,
RemoteProgressState, CWD,
};
use crossbeam_channel::Sender;
@ -48,7 +48,7 @@ impl PushComponent {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
) -> Self {
@ -130,10 +130,10 @@ impl PushComponent {
///
pub fn update_git(
&mut self,
ev: AsyncNotification,
ev: AsyncGitNotification,
) -> Result<()> {
if self.is_visible() {
if let AsyncNotification::Push = ev {
if let AsyncGitNotification::Push = ev {
self.update()?;
}
}

View file

@ -17,7 +17,7 @@ use asyncgit::{
},
get_default_remote, AsyncProgress, PushTagsProgress,
},
AsyncNotification, AsyncPushTags, PushTagsRequest, CWD,
AsyncGitNotification, AsyncPushTags, PushTagsRequest, CWD,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -45,7 +45,7 @@ impl PushTagsComponent {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
) -> Self {
@ -99,10 +99,10 @@ impl PushTagsComponent {
///
pub fn update_git(
&mut self,
ev: AsyncNotification,
ev: AsyncGitNotification,
) -> Result<()> {
if self.is_visible() {
if let AsyncNotification::PushTags = ev {
if let AsyncGitNotification::PushTags = ev {
self.update()?;
}
}

View file

@ -12,7 +12,7 @@ use crate::{
use anyhow::Result;
use asyncgit::{
sync::{self, CommitId, TreeFile},
AsyncNotification, CWD,
AsyncGitNotification, CWD,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -52,7 +52,7 @@ impl RevisionFilesComponent {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
) -> Self {
@ -90,7 +90,7 @@ impl RevisionFilesComponent {
}
///
pub fn update(&mut self, ev: AsyncNotification) {
pub fn update(&mut self, ev: AsyncGitNotification) {
self.current_file.update(ev);
}

View file

@ -10,7 +10,7 @@ use crate::{
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::{sync::CommitId, AsyncNotification};
use asyncgit::{sync::CommitId, AsyncGitNotification};
use crossbeam_channel::Sender;
use crossterm::event::Event;
use tui::{backend::Backend, layout::Rect, widgets::Clear, Frame};
@ -25,7 +25,7 @@ impl RevisionFilesPopup {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
) -> Self {
@ -50,7 +50,7 @@ impl RevisionFilesPopup {
}
///
pub fn update(&mut self, ev: AsyncNotification) {
pub fn update(&mut self, ev: AsyncGitNotification) {
self.files.update(ev);
}

View file

@ -14,7 +14,7 @@ use anyhow::Result;
use asyncgit::{
asyncjob::AsyncSingleJob,
sync::{self, TreeFile},
AsyncNotification, CWD,
AsyncGitNotification, CWD,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -32,7 +32,7 @@ use tui::{
pub struct SyntaxTextComponent {
current_file: Option<(String, Either<ui::SyntaxText, String>)>,
async_highlighting:
AsyncSingleJob<AsyncSyntaxJob, AsyncNotification>,
AsyncSingleJob<AsyncSyntaxJob, AsyncGitNotification>,
key_config: SharedKeyConfig,
paragraph_state: Cell<ParagraphState>,
focused: bool,
@ -42,14 +42,14 @@ pub struct SyntaxTextComponent {
impl SyntaxTextComponent {
///
pub fn new(
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
key_config: SharedKeyConfig,
theme: SharedTheme,
) -> Self {
Self {
async_highlighting: AsyncSingleJob::new(
sender.clone(),
AsyncNotification::SyntaxHighlighting,
AsyncGitNotification::SyntaxHighlighting,
),
current_file: None,
paragraph_state: Cell::new(ParagraphState::default()),
@ -60,8 +60,8 @@ impl SyntaxTextComponent {
}
///
pub fn update(&mut self, ev: AsyncNotification) {
if ev == AsyncNotification::SyntaxHighlighting {
pub fn update(&mut self, ev: AsyncGitNotification) {
if ev == AsyncGitNotification::SyntaxHighlighting {
if let Some(job) = self.async_highlighting.take_last() {
if let Some((path, content)) =
self.current_file.as_mut()

View file

@ -37,7 +37,7 @@ mod version;
use crate::{app::App, args::process_cmdline};
use anyhow::{bail, Result};
use asyncgit::AsyncNotification;
use asyncgit::AsyncGitNotification;
use backtrace::Backtrace;
use crossbeam_channel::{tick, unbounded, Receiver, Select};
use crossterm::{
@ -72,7 +72,7 @@ static SPINNER_INTERVAL: Duration = Duration::from_millis(80);
pub enum QueueEvent {
Tick,
SpinnerUpdate,
GitEvent(AsyncNotification),
GitEvent(AsyncGitNotification),
InputEvent(InputEvent),
}
@ -148,7 +148,8 @@ fn main() -> Result<()> {
}
QueueEvent::Tick => app.update()?,
QueueEvent::GitEvent(ev)
if ev != AsyncNotification::FinishUnchanged =>
if ev
!= AsyncGitNotification::FinishUnchanged =>
{
app.update_git(ev)?;
}
@ -215,7 +216,7 @@ fn valid_path() -> Result<bool> {
fn select_event(
rx_input: &Receiver<InputEvent>,
rx_git: &Receiver<AsyncNotification>,
rx_git: &Receiver<AsyncGitNotification>,
rx_ticker: &Receiver<Instant>,
rx_spinner: &Receiver<Instant>,
) -> Result<QueueEvent> {

View file

@ -14,7 +14,7 @@ use crate::{
ui::style::SharedTheme,
};
use anyhow::Result;
use asyncgit::{sync, AsyncNotification, CWD};
use asyncgit::{sync, AsyncGitNotification, CWD};
use crossbeam_channel::Sender;
pub struct FilesTab {
@ -27,7 +27,7 @@ pub struct FilesTab {
impl FilesTab {
///
pub fn new(
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
queue: &Queue,
theme: SharedTheme,
key_config: SharedKeyConfig,
@ -60,7 +60,7 @@ impl FilesTab {
}
///
pub fn update_git(&mut self, ev: AsyncNotification) {
pub fn update_git(&mut self, ev: AsyncGitNotification) {
if self.is_visible() {
self.files.update(ev);
}

View file

@ -13,7 +13,7 @@ use anyhow::Result;
use asyncgit::{
cached,
sync::{self, CommitId},
AsyncLog, AsyncNotification, AsyncTags, FetchStatus, CWD,
AsyncGitNotification, AsyncLog, AsyncTags, FetchStatus, CWD,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -43,7 +43,7 @@ impl Revlog {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
) -> Self {
@ -111,13 +111,13 @@ impl Revlog {
///
pub fn update_git(
&mut self,
ev: AsyncNotification,
ev: AsyncGitNotification,
) -> Result<()> {
if self.visible {
match ev {
AsyncNotification::CommitFiles
| AsyncNotification::Log => self.update()?,
AsyncNotification::Tags => {
AsyncGitNotification::CommitFiles
| AsyncGitNotification::Log => self.update()?,
AsyncGitNotification::Tags => {
if let Some(tags) = self.git_tags.last()? {
self.list.set_tags(tags);
self.update()?;

View file

@ -13,7 +13,7 @@ use crate::{
use anyhow::Result;
use asyncgit::{
sync::{self, status::StatusType},
AsyncNotification, AsyncStatus, StatusParams, CWD,
AsyncGitNotification, AsyncStatus, StatusParams, CWD,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -45,7 +45,7 @@ impl Stashing {
///
pub fn new(
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
queue: &Queue,
theme: SharedTheme,
key_config: SharedKeyConfig,
@ -88,10 +88,10 @@ impl Stashing {
///
pub fn update_git(
&mut self,
ev: AsyncNotification,
ev: AsyncGitNotification,
) -> Result<()> {
if self.is_visible() {
if let AsyncNotification::Status = ev {
if let AsyncGitNotification::Status = ev {
let status = self.git_status.last()?;
self.index.update(&status.items)?;
}

View file

@ -16,8 +16,8 @@ use asyncgit::{
cached,
sync::BranchCompare,
sync::{self, status::StatusType, RepoState},
AsyncDiff, AsyncNotification, AsyncStatus, DiffParams, DiffType,
StatusParams, CWD,
AsyncDiff, AsyncGitNotification, AsyncStatus, DiffParams,
DiffType, StatusParams, CWD,
};
use crossbeam_channel::Sender;
use crossterm::event::Event;
@ -131,7 +131,7 @@ impl Status {
///
pub fn new(
queue: &Queue,
sender: &Sender<AsyncNotification>,
sender: &Sender<AsyncGitNotification>,
theme: SharedTheme,
key_config: SharedKeyConfig,
) -> Self {
@ -339,14 +339,16 @@ impl Status {
///
pub fn update_git(
&mut self,
ev: AsyncNotification,
ev: AsyncGitNotification,
) -> Result<()> {
match ev {
AsyncNotification::Diff => self.update_diff()?,
AsyncNotification::Status => self.update_status()?,
AsyncNotification::Push
| AsyncNotification::Fetch
| AsyncNotification::CommitFiles => self.branch_compare(),
AsyncGitNotification::Diff => self.update_diff()?,
AsyncGitNotification::Status => self.update_status()?,
AsyncGitNotification::Push
| AsyncGitNotification::Fetch
| AsyncGitNotification::CommitFiles => {
self.branch_compare()
}
_ => (),
}