summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephan Dilly <dilly.stephan@gmail.com>2021-06-07 23:04:07 +0200
committerStephan Dilly <dilly.stephan@gmail.com>2021-06-07 23:04:07 +0200
commit8032c3590253587ea532d93f13510ff040564b58 (patch)
treed5e8d5640d385d779beb5bab52993c9d67335d69 /src
parent7058ab14d3ad1b8f3fffe2bc2a52729127eb1bef (diff)
refactor better name
Diffstat (limited to 'src')
-rw-r--r--src/app.rs6
-rw-r--r--src/components/blame_file.rs8
-rw-r--r--src/components/commit_details/mod.rs4
-rw-r--r--src/components/inspect_commit.rs10
-rw-r--r--src/components/pull.rs9
-rw-r--r--src/components/push.rs8
-rw-r--r--src/components/push_tags.rs8
-rw-r--r--src/components/revision_files.rs6
-rw-r--r--src/components/revision_files_popup.rs6
-rw-r--r--src/components/syntax_text.rs12
-rw-r--r--src/main.rs9
-rw-r--r--src/tabs/files.rs6
-rw-r--r--src/tabs/revlog.rs12
-rw-r--r--src/tabs/stashing.rs8
-rw-r--r--src/tabs/status.rs20
15 files changed, 68 insertions, 64 deletions
diff --git a/src/app.rs b/src/app.rs
index 6b181aed..7bba071c 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -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);
diff --git a/src/components/blame_file.rs b/src/components/blame_file.rs
index 45f308fd..aa817409 100644
--- a/src/components/blame_file.rs
+++ b/src/components/blame_file.rs
@@ -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()?;
}
}
diff --git a/src/components/commit_details/mod.rs b/src/components/commit_details/mod.rs
index 850dfc86..7966a388 100644
--- a/src/components/commit_details/mod.rs
+++ b/src/components/commit_details/mod.rs
@@ -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 {
diff --git a/src/components/inspect_commit.rs b/src/components/inspect_commit.rs
index ff596fa8..397ea943 100644
--- a/src/components/inspect_commit.rs
+++ b/src/components/inspect_commit.rs
@@ -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()?;
}
}
diff --git a/src/components/pull.rs b/src/components/pull.rs
index a041edbe..18c34771 100644
--- a/src/components/pull.rs
+++ b/src/components/pull.rs
@@ -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()?;
}
}
diff --git a/src/components/push.rs b/src/components/push.rs
index 4ea025f1..11d9ebbe 100644
--- a/src/components/push.rs
+++ b/src/components/push.rs
@@ -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()?;
}
}
diff --git a/src/components/push_tags.rs b/src/components/push_tags.rs
index 9ea4ca68..f2c84207 100644
--- a/src/components/push_tags.rs
+++ b/src/components/push_tags.rs
@@ -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()?;
}
}
diff --git a/src/components/revision_files.rs b/src/components/revision_files.rs
index 8f009a0c..8266509b 100644
--- a/src/components/revision_files.rs
+++ b/src/components/revision_files.rs
@@ -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);
}
diff --git a/src/components/revision_files_popup.rs b/src/components/revision_files_popup.rs
index b90b3ff4..437fe42d 100644
--- a/src/components/revision_files_popup.rs
+++ b/src/components/revision_files_popup.rs
@@ -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);
}
diff --git a/src/components/syntax_text.rs b/src/components/syntax_text.rs
index 978f9840..a3850f6d 100644
--- a/src/components/syntax_text.rs
+++ b/src/components/syntax_text.rs
@@ -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()
diff --git a/src/main.rs b/src/main.rs
index 68efee4a..9c4fae7c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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> {
diff --git a/src/tabs/files.rs b/src/tabs/files.rs
index 5e48fc2f..61d60857 100644
--- a/src/tabs/files.rs
+++ b/src/tabs/files.rs
@@ -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);
}
diff --git a/src/tabs/revlog.rs b/src/tabs/revlog.rs
index 12e846e9..35779265 100644
--- a/src/tabs/revlog.rs
+++ b/src/tabs/revlog.rs
@@ -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()?;
diff --git a/src/tabs/stashing.rs b/src/tabs/stashing.rs
index 2479b8bc..9cd1bde0 100644
--- a/src/tabs/stashing.rs
+++ b/src/tabs/stashing.rs
@@ -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)?;
}
diff --git a/src/tabs/status.rs b/src/tabs/status.rs
index 73e27ec0..40fac37a 100644
--- a/src/tabs/status.rs
+++ b/src/tabs/status.rs
@@ -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()
+ }
_ => (),
}