Remove unnecessary dependencies on client and rpc
This commit is contained in:
parent
43da36948b
commit
17925ed563
5 changed files with 21 additions and 24 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -2832,7 +2832,6 @@ dependencies = [
|
||||||
"parking_lot 0.11.2",
|
"parking_lot 0.11.2",
|
||||||
"regex",
|
"regex",
|
||||||
"rope",
|
"rope",
|
||||||
"rpc",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
|
@ -13,7 +13,6 @@ rope = { path = "../rope" }
|
||||||
text = { path = "../text" }
|
text = { path = "../text" }
|
||||||
util = { path = "../util" }
|
util = { path = "../util" }
|
||||||
sum_tree = { path = "../sum_tree" }
|
sum_tree = { path = "../sum_tree" }
|
||||||
rpc = { path = "../rpc" }
|
|
||||||
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
async-trait.workspace = true
|
async-trait.workspace = true
|
||||||
|
|
|
@ -2,7 +2,6 @@ use anyhow::Result;
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use git2::{BranchType, StatusShow};
|
use git2::{BranchType, StatusShow};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use rpc::proto;
|
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
|
@ -23,6 +22,7 @@ pub struct Branch {
|
||||||
/// Timestamp of most recent commit, normalized to Unix Epoch format.
|
/// Timestamp of most recent commit, normalized to Unix Epoch format.
|
||||||
pub unix_timestamp: Option<i64>,
|
pub unix_timestamp: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
pub trait GitRepository: Send {
|
pub trait GitRepository: Send {
|
||||||
fn reload_index(&self);
|
fn reload_index(&self);
|
||||||
|
@ -358,24 +358,6 @@ impl GitFileStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_proto(git_status: Option<i32>) -> Option<GitFileStatus> {
|
|
||||||
git_status.and_then(|status| {
|
|
||||||
proto::GitStatus::from_i32(status).map(|status| match status {
|
|
||||||
proto::GitStatus::Added => GitFileStatus::Added,
|
|
||||||
proto::GitStatus::Modified => GitFileStatus::Modified,
|
|
||||||
proto::GitStatus::Conflict => GitFileStatus::Conflict,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn to_proto(self) -> i32 {
|
|
||||||
match self {
|
|
||||||
GitFileStatus::Added => proto::GitStatus::Added as i32,
|
|
||||||
GitFileStatus::Modified => proto::GitStatus::Modified as i32,
|
|
||||||
GitFileStatus::Conflict => proto::GitStatus::Conflict as i32,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Ord, Hash, PartialOrd, Eq, PartialEq)]
|
#[derive(Clone, Debug, Ord, Hash, PartialOrd, Eq, PartialEq)]
|
||||||
|
|
|
@ -22,7 +22,6 @@ test-support = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
client = { path = "../client" }
|
|
||||||
clock = { path = "../clock" }
|
clock = { path = "../clock" }
|
||||||
collections = { path = "../collections" }
|
collections = { path = "../collections" }
|
||||||
fuzzy = { path = "../fuzzy" }
|
fuzzy = { path = "../fuzzy" }
|
||||||
|
|
|
@ -4310,7 +4310,7 @@ impl<'a> From<&'a Entry> for proto::Entry {
|
||||||
is_symlink: entry.is_symlink,
|
is_symlink: entry.is_symlink,
|
||||||
is_ignored: entry.is_ignored,
|
is_ignored: entry.is_ignored,
|
||||||
is_external: entry.is_external,
|
is_external: entry.is_external,
|
||||||
git_status: entry.git_status.map(|status| status.to_proto()),
|
git_status: entry.git_status.map(git_status_to_proto),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4337,7 +4337,7 @@ impl<'a> TryFrom<(&'a CharBag, proto::Entry)> for Entry {
|
||||||
is_symlink: entry.is_symlink,
|
is_symlink: entry.is_symlink,
|
||||||
is_ignored: entry.is_ignored,
|
is_ignored: entry.is_ignored,
|
||||||
is_external: entry.is_external,
|
is_external: entry.is_external,
|
||||||
git_status: GitFileStatus::from_proto(entry.git_status),
|
git_status: git_status_from_proto(entry.git_status),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Err(anyhow!(
|
Err(anyhow!(
|
||||||
|
@ -4366,3 +4366,21 @@ fn combine_git_statuses(
|
||||||
unstaged
|
unstaged
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn git_status_from_proto(git_status: Option<i32>) -> Option<GitFileStatus> {
|
||||||
|
git_status.and_then(|status| {
|
||||||
|
proto::GitStatus::from_i32(status).map(|status| match status {
|
||||||
|
proto::GitStatus::Added => GitFileStatus::Added,
|
||||||
|
proto::GitStatus::Modified => GitFileStatus::Modified,
|
||||||
|
proto::GitStatus::Conflict => GitFileStatus::Conflict,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn git_status_to_proto(status: GitFileStatus) -> i32 {
|
||||||
|
match status {
|
||||||
|
GitFileStatus::Added => proto::GitStatus::Added as i32,
|
||||||
|
GitFileStatus::Modified => proto::GitStatus::Modified as i32,
|
||||||
|
GitFileStatus::Conflict => proto::GitStatus::Conflict as i32,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue