mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-10-27 15:20:34 +08:00
radicle-surf: move vcs::git to git
Other VCS systems are no longer expected to be supported. Remove the git hierarchy up to the top-level and remove the vcs hierarchy. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
|
||||
use radicle_surf::{
|
||||
file_system::{unsound, Path},
|
||||
vcs::git::{Branch, Repository},
|
||||
git::{Branch, Repository},
|
||||
};
|
||||
|
||||
fn last_commit_comparison(c: &mut Criterion) {
|
||||
|
||||
@@ -20,7 +20,7 @@ extern crate radicle_surf;
|
||||
use std::{env::Args, str::FromStr, time::Instant};
|
||||
|
||||
use radicle_git_ext::Oid;
|
||||
use radicle_surf::{diff::Diff, vcs::git};
|
||||
use radicle_surf::{diff::Diff, git};
|
||||
|
||||
fn main() {
|
||||
let options = get_options_or_exit();
|
||||
|
||||
@@ -26,10 +26,9 @@ use serde::{
|
||||
use crate::{
|
||||
diff,
|
||||
file_system,
|
||||
git::Glob,
|
||||
git::{self, BranchName, Glob, RepositoryRef},
|
||||
person::Person,
|
||||
revision::Revision,
|
||||
vcs::git::{self, BranchName, RepositoryRef},
|
||||
};
|
||||
|
||||
use radicle_git_ext::Oid;
|
||||
|
||||
@@ -24,7 +24,7 @@ use serde::{ser, Serialize, Serializer};
|
||||
|
||||
use crate::{
|
||||
file_system::{Directory, Path},
|
||||
vcs::git::{Error, RepositoryRef},
|
||||
git::{Error, RepositoryRef},
|
||||
};
|
||||
|
||||
pub mod git;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
use crate::{
|
||||
file_system::{error::LabelError, path::*, Error},
|
||||
vcs::git::{self, RepositoryRef, Revision},
|
||||
git::{self, RepositoryRef, Revision},
|
||||
};
|
||||
use git2::Blob;
|
||||
use radicle_git_ext::Oid;
|
||||
|
||||
@@ -121,8 +121,6 @@ pub trait Revision {
|
||||
fn object_id(&self, repo: &RepositoryRef) -> Result<Oid, Error>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
impl Revision for Oid {
|
||||
fn object_id(&self, _repo: &RepositoryRef) -> Result<Oid, Error> {
|
||||
Ok(*self)
|
||||
@@ -15,7 +15,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::vcs::git::{self, error::Error, ext};
|
||||
use crate::git::{self, error::Error, ext};
|
||||
#[cfg(feature = "serialize")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{cmp::Ordering, convert::TryFrom, fmt, str};
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
use crate::{
|
||||
file_system::{self, directory},
|
||||
vcs::git::{error::Error, Branch, RepositoryRef, Tag, TagName},
|
||||
git::{error::Error, Branch, RepositoryRef, Tag, TagName},
|
||||
};
|
||||
use radicle_git_ext::Oid;
|
||||
use std::{convert::TryFrom, str};
|
||||
@@ -16,17 +16,17 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! Collection of errors and helper instances that can occur when performing
|
||||
//! operations from [`crate::vcs::git`].
|
||||
//! operations from [`crate::git`].
|
||||
|
||||
use crate::{
|
||||
diff,
|
||||
file_system,
|
||||
vcs::git::{BranchName, Namespace, TagName},
|
||||
git::{BranchName, Namespace, TagName},
|
||||
};
|
||||
use std::str;
|
||||
use thiserror::Error;
|
||||
|
||||
/// Enumeration of errors that can occur in operations from [`crate::vcs::git`].
|
||||
/// Enumeration of errors that can occur in operations from [`crate::git`].
|
||||
#[derive(Debug, PartialEq, Error)]
|
||||
#[non_exhaustive]
|
||||
pub enum Error {
|
||||
@@ -15,7 +15,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::vcs::git::Error;
|
||||
use crate::git::Error;
|
||||
use git_ref_format::refspec::PatternString;
|
||||
use std::{convert::TryFrom, marker::PhantomData, str};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
use crate::{
|
||||
file_system,
|
||||
vcs::git::{commit::ToCommit, Commit, Error, RepositoryRef},
|
||||
git::{commit::ToCommit, Commit, Error, RepositoryRef},
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::vcs::git::error::Error;
|
||||
use crate::git::error::Error;
|
||||
use nonempty::NonEmpty;
|
||||
pub use radicle_git_ext::Oid;
|
||||
use std::{convert::TryFrom, fmt, str};
|
||||
@@ -19,7 +19,7 @@ use crate::{
|
||||
diff::*,
|
||||
file_system,
|
||||
file_system::{directory, DirectoryEntry, Label},
|
||||
vcs::git::{
|
||||
git::{
|
||||
error::*,
|
||||
Branch,
|
||||
BranchName,
|
||||
@@ -15,7 +15,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::vcs::git::{self, error::Error, Author};
|
||||
use crate::git::{self, error::Error, Author};
|
||||
use git_ref_format::RefString;
|
||||
use radicle_git_ext::Oid;
|
||||
use std::{convert::TryFrom, fmt, str};
|
||||
@@ -82,7 +82,7 @@
|
||||
//! ```
|
||||
pub mod diff;
|
||||
pub mod file_system;
|
||||
pub mod vcs;
|
||||
pub mod git;
|
||||
|
||||
pub mod commit;
|
||||
pub use commit::{commit, commits, Commit};
|
||||
@@ -103,5 +103,3 @@ pub use syntax::SYNTAX_SET;
|
||||
|
||||
// Private modules
|
||||
mod nonempty;
|
||||
|
||||
pub use crate::vcs::git;
|
||||
|
||||
@@ -24,10 +24,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use radicle_git_ext::Oid;
|
||||
|
||||
use crate::{
|
||||
git::{commit::ToCommit, BranchName, Glob, RepositoryRef},
|
||||
vcs::git::{self, error::Error, TagName},
|
||||
};
|
||||
use crate::git::{self, commit::ToCommit, error::Error, BranchName, Glob, RepositoryRef, TagName};
|
||||
|
||||
/// Types of a peer.
|
||||
pub enum Category<P, U> {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
// This file is part of radicle-surf
|
||||
// <https://github.com/radicle-dev/radicle-surf>
|
||||
//
|
||||
// Copyright (C) 2019-2020 The Radicle Team <dev@radicle.xyz>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 3 or
|
||||
// later as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! A model of a general VCS.
|
||||
|
||||
pub mod git;
|
||||
@@ -668,55 +668,10 @@ mod branch {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod ext {
|
||||
use radicle_surf::vcs::git::ext::*;
|
||||
|
||||
#[test]
|
||||
fn test_try_extract_refname() {
|
||||
assert_eq!(try_extract_refname("refs/heads/dev"), Ok("dev".to_string()));
|
||||
|
||||
assert_eq!(
|
||||
try_extract_refname("refs/heads/master"),
|
||||
Ok("master".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
try_extract_refname("refs/remotes/banana/pineapple"),
|
||||
Ok("banana/pineapple".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
try_extract_refname("refs/remotes/origin/master"),
|
||||
Ok("origin/master".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
try_extract_refname("refs/namespaces/golden/refs/heads/banana"),
|
||||
Ok("banana".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
try_extract_refname("refs/namespaces/golden/refs/tags/v0.1.0"),
|
||||
Ok("v0.1.0".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
try_extract_refname("refs/namespaces/golden/refs/namespaces/silver/refs/heads/master"),
|
||||
Ok("master".to_string())
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
try_extract_refname("refs/namespaces/golden/refs/remotes/kickflip/heads/heelflip"),
|
||||
Ok("kickflip/heelflip".to_string())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod reference {
|
||||
use super::*;
|
||||
use radicle_surf::vcs::git::{Glob, Tag};
|
||||
use radicle_surf::git::{Glob, Tag};
|
||||
|
||||
#[test]
|
||||
fn test_branches() {
|
||||
|
||||
Reference in New Issue
Block a user