Skip to content

Commit 8032c35

Browse files
author
Stephan Dilly
committed
refactor better name
1 parent 7058ab1 commit 8032c35

26 files changed

+118
-112
lines changed

asyncgit/src/blame.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{
22
error::Result,
33
hash,
44
sync::{self, FileBlame},
5-
AsyncNotification, CWD,
5+
AsyncGitNotification, CWD,
66
};
77
use crossbeam_channel::Sender;
88
use std::{
@@ -33,13 +33,13 @@ struct LastResult<P, R> {
3333
pub struct AsyncBlame {
3434
current: Arc<Mutex<Request<u64, FileBlame>>>,
3535
last: Arc<Mutex<Option<LastResult<BlameParams, FileBlame>>>>,
36-
sender: Sender<AsyncNotification>,
36+
sender: Sender<AsyncGitNotification>,
3737
pending: Arc<AtomicUsize>,
3838
}
3939

4040
impl AsyncBlame {
4141
///
42-
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
42+
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
4343
Self {
4444
current: Arc::new(Mutex::new(Request(0, None))),
4545
last: Arc::new(Mutex::new(None)),
@@ -120,9 +120,9 @@ impl AsyncBlame {
120120

121121
sender
122122
.send(if notify {
123-
AsyncNotification::Blame
123+
AsyncGitNotification::Blame
124124
} else {
125-
AsyncNotification::FinishUnchanged
125+
AsyncGitNotification::FinishUnchanged
126126
})
127127
.expect("error sending blame");
128128
});

asyncgit/src/commit_files.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
error::Result,
33
sync::{self, CommitId},
4-
AsyncNotification, StatusItem, CWD,
4+
AsyncGitNotification, StatusItem, CWD,
55
};
66
use crossbeam_channel::Sender;
77
use std::sync::{
@@ -15,13 +15,13 @@ struct Request<R, A>(R, A);
1515
///
1616
pub struct AsyncCommitFiles {
1717
current: Arc<Mutex<Option<Request<CommitId, ResultType>>>>,
18-
sender: Sender<AsyncNotification>,
18+
sender: Sender<AsyncGitNotification>,
1919
pending: Arc<AtomicUsize>,
2020
}
2121

2222
impl AsyncCommitFiles {
2323
///
24-
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
24+
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
2525
Self {
2626
current: Arc::new(Mutex::new(None)),
2727
sender: sender.clone(),
@@ -74,7 +74,7 @@ impl AsyncCommitFiles {
7474
arc_pending.fetch_sub(1, Ordering::Relaxed);
7575

7676
sender
77-
.send(AsyncNotification::CommitFiles)
77+
.send(AsyncGitNotification::CommitFiles)
7878
.expect("error sending");
7979
});
8080

asyncgit/src/diff.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{
22
error::Result,
33
hash,
44
sync::{self, CommitId},
5-
AsyncNotification, FileDiff, CWD,
5+
AsyncGitNotification, FileDiff, CWD,
66
};
77
use crossbeam_channel::Sender;
88
use std::{
@@ -46,13 +46,13 @@ struct LastResult<P, R> {
4646
pub struct AsyncDiff {
4747
current: Arc<Mutex<Request<u64, FileDiff>>>,
4848
last: Arc<Mutex<Option<LastResult<DiffParams, FileDiff>>>>,
49-
sender: Sender<AsyncNotification>,
49+
sender: Sender<AsyncGitNotification>,
5050
pending: Arc<AtomicUsize>,
5151
}
5252

5353
impl AsyncDiff {
5454
///
55-
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
55+
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
5656
Self {
5757
current: Arc::new(Mutex::new(Request(0, None))),
5858
last: Arc::new(Mutex::new(None)),
@@ -129,9 +129,9 @@ impl AsyncDiff {
129129

130130
sender
131131
.send(if notify {
132-
AsyncNotification::Diff
132+
AsyncGitNotification::Diff
133133
} else {
134-
AsyncNotification::FinishUnchanged
134+
AsyncGitNotification::FinishUnchanged
135135
})
136136
.expect("error sending diff");
137137
});

asyncgit/src/fetch.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
cred::BasicAuthCredential,
55
remotes::{fetch, push::ProgressNotification},
66
},
7-
AsyncNotification, RemoteProgress, CWD,
7+
AsyncGitNotification, RemoteProgress, CWD,
88
};
99
use crossbeam_channel::{unbounded, Sender};
1010
use std::{
@@ -33,12 +33,12 @@ pub struct AsyncFetch {
3333
state: Arc<Mutex<Option<FetchState>>>,
3434
last_result: Arc<Mutex<Option<(usize, String)>>>,
3535
progress: Arc<Mutex<Option<ProgressNotification>>>,
36-
sender: Sender<AsyncNotification>,
36+
sender: Sender<AsyncGitNotification>,
3737
}
3838

3939
impl AsyncFetch {
4040
///
41-
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
41+
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
4242
Self {
4343
state: Arc::new(Mutex::new(None)),
4444
last_result: Arc::new(Mutex::new(None)),
@@ -85,7 +85,7 @@ impl AsyncFetch {
8585
let (progress_sender, receiver) = unbounded();
8686

8787
let handle = RemoteProgress::spawn_receiver_thread(
88-
AsyncNotification::Fetch,
88+
AsyncGitNotification::Fetch,
8989
sender.clone(),
9090
receiver,
9191
arc_progress,
@@ -109,7 +109,7 @@ impl AsyncFetch {
109109
Self::clear_request(&arc_state).expect("clear error");
110110

111111
sender
112-
.send(AsyncNotification::Fetch)
112+
.send(AsyncGitNotification::Fetch)
113113
.expect("AsyncNotification error");
114114
});
115115

asyncgit/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ use std::{
6161

6262
/// this type is used to communicate events back through the channel
6363
#[derive(Copy, Clone, Debug, PartialEq)]
64-
pub enum AsyncNotification {
64+
pub enum AsyncGitNotification {
6565
/// this indicates that no new state was fetched but that a async process finished
6666
FinishUnchanged,
6767
///

asyncgit/src/push.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
cred::BasicAuthCredential, remotes::push::push,
55
remotes::push::ProgressNotification,
66
},
7-
AsyncNotification, RemoteProgress, CWD,
7+
AsyncGitNotification, RemoteProgress, CWD,
88
};
99
use crossbeam_channel::{unbounded, Sender};
1010
use std::{
@@ -35,12 +35,12 @@ pub struct AsyncPush {
3535
state: Arc<Mutex<Option<PushState>>>,
3636
last_result: Arc<Mutex<Option<String>>>,
3737
progress: Arc<Mutex<Option<ProgressNotification>>>,
38-
sender: Sender<AsyncNotification>,
38+
sender: Sender<AsyncGitNotification>,
3939
}
4040

4141
impl AsyncPush {
4242
///
43-
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
43+
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
4444
Self {
4545
state: Arc::new(Mutex::new(None)),
4646
last_result: Arc::new(Mutex::new(None)),
@@ -87,7 +87,7 @@ impl AsyncPush {
8787
let (progress_sender, receiver) = unbounded();
8888

8989
let handle = RemoteProgress::spawn_receiver_thread(
90-
AsyncNotification::Push,
90+
AsyncGitNotification::Push,
9191
sender.clone(),
9292
receiver,
9393
arc_progress,
@@ -113,7 +113,7 @@ impl AsyncPush {
113113
Self::clear_request(&arc_state).expect("clear error");
114114

115115
sender
116-
.send(AsyncNotification::Push)
116+
.send(AsyncGitNotification::Push)
117117
.expect("error sending push");
118118
});
119119

asyncgit/src/push_tags.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
cred::BasicAuthCredential,
55
remotes::tags::{push_tags, PushTagsProgress},
66
},
7-
AsyncNotification, RemoteProgress, CWD,
7+
AsyncGitNotification, RemoteProgress, CWD,
88
};
99
use crossbeam_channel::{unbounded, Sender};
1010
use std::{
@@ -31,12 +31,12 @@ pub struct AsyncPushTags {
3131
state: Arc<Mutex<Option<PushState>>>,
3232
last_result: Arc<Mutex<Option<String>>>,
3333
progress: Arc<Mutex<Option<PushTagsProgress>>>,
34-
sender: Sender<AsyncNotification>,
34+
sender: Sender<AsyncGitNotification>,
3535
}
3636

3737
impl AsyncPushTags {
3838
///
39-
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
39+
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
4040
Self {
4141
state: Arc::new(Mutex::new(None)),
4242
last_result: Arc::new(Mutex::new(None)),
@@ -83,7 +83,7 @@ impl AsyncPushTags {
8383
let (progress_sender, receiver) = unbounded();
8484

8585
let handle = RemoteProgress::spawn_receiver_thread(
86-
AsyncNotification::PushTags,
86+
AsyncGitNotification::PushTags,
8787
sender.clone(),
8888
receiver,
8989
arc_progress,
@@ -103,7 +103,7 @@ impl AsyncPushTags {
103103
Self::clear_request(&arc_state).expect("clear error");
104104

105105
sender
106-
.send(AsyncNotification::PushTags)
106+
.send(AsyncGitNotification::PushTags)
107107
.expect("error sending push");
108108
});
109109

asyncgit/src/remote_progress.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
error::Result,
55
progress::ProgressPercent,
66
sync::remotes::push::{AsyncProgress, ProgressNotification},
7-
AsyncNotification,
7+
AsyncGitNotification,
88
};
99
use crossbeam_channel::{Receiver, Sender};
1010
use git2::PackBuilderStage;
@@ -71,8 +71,8 @@ impl RemoteProgress {
7171
pub(crate) fn spawn_receiver_thread<
7272
T: 'static + AsyncProgress,
7373
>(
74-
notification_type: AsyncNotification,
75-
sender: Sender<AsyncNotification>,
74+
notification_type: AsyncGitNotification,
75+
sender: Sender<AsyncGitNotification>,
7676
receiver: Receiver<T>,
7777
progress: Arc<Mutex<Option<T>>>,
7878
) -> JoinHandle<()> {

asyncgit/src/revlog.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
error::Result,
33
sync::{utils::repo, CommitId, LogWalker},
4-
AsyncNotification, CWD,
4+
AsyncGitNotification, CWD,
55
};
66
use crossbeam_channel::Sender;
77
use git2::Oid;
@@ -29,7 +29,7 @@ pub enum FetchStatus {
2929
///
3030
pub struct AsyncLog {
3131
current: Arc<Mutex<Vec<CommitId>>>,
32-
sender: Sender<AsyncNotification>,
32+
sender: Sender<AsyncGitNotification>,
3333
pending: Arc<AtomicBool>,
3434
background: Arc<AtomicBool>,
3535
}
@@ -40,7 +40,7 @@ static SLEEP_BACKGROUND: Duration = Duration::from_millis(1000);
4040

4141
impl AsyncLog {
4242
///
43-
pub fn new(sender: &Sender<AsyncNotification>) -> Self {
43+
pub fn new(sender: &Sender<AsyncGitNotification>) -> Self {
4444
Self {
4545
current: Arc::new(Mutex::new(Vec::new())),
4646
sender: sender.clone(),
@@ -147,7 +147,7 @@ impl AsyncLog {
147147
fn fetch_helper(
148148
arc_current: &Arc<Mutex<Vec<CommitId>>>,
149149
arc_background: &Arc<AtomicBool>,
150-
sender: &Sender<AsyncNotification>,
150+
sender: &Sender<AsyncGitNotification>,
151151
) -> Result<()> {
152152
let mut entries = Vec::with_capacity(LIMIT_COUNT);
153153
let r = repo(CWD)?;
@@ -183,7 +183,9 @@ impl AsyncLog {
183183
Ok(())
184184
}
185185

186-
fn notify(sender: &Sender<AsyncNotification>) {
187-
sender.send(AsyncNotification::Log).expect("error sending");
186+
fn notify(sender: &Sender<AsyncGitNotification>) {
187+
sender
188+
.send(AsyncGitNotification::Log)
189+
.expect("error sending");
188190
}
189191
}

asyncgit/src/status.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{
22
error::Result,
33
hash,
44
sync::{self, status::StatusType},
5-
AsyncNotification, StatusItem, CWD,
5+
AsyncGitNotification, StatusItem, CWD,
66
};
77
use crossbeam_channel::Sender;
88
use std::{
@@ -49,13 +49,13 @@ struct Request<R, A>(R, Option<A>);
4949
pub struct AsyncStatus {
5050
current: Arc<Mutex<Request<u64, Status>>>,
5151
last: Arc<Mutex<Status>>,
52-
sender: Sender<AsyncNotification>,
52+
sender: Sender<AsyncGitNotification>,
5353
pending: Arc<AtomicUsize>,
5454
}
5555

5656
impl AsyncStatus {
5757
///
58-
pub fn new(sender: Sender<AsyncNotification>) -> Self {
58+
pub fn new(sender: Sender<AsyncGitNotification>) -> Self {
5959
Self {
6060
current: Arc::new(Mutex::new(Request(0, None))),
6161
last: Arc::new(Mutex::new(Status::default())),
@@ -125,7 +125,7 @@ impl AsyncStatus {
125125

126126
if ok {
127127
sender
128-
.send(AsyncNotification::Status)
128+
.send(AsyncGitNotification::Status)
129129
.expect("error sending status");
130130
}
131131
});

0 commit comments

Comments
 (0)