mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-05 11:05:46 +00:00
git: move RefName enum from view module
It's no longer used by View API.
This commit is contained in:
parent
95919699d4
commit
a756333216
3 changed files with 22 additions and 25 deletions
|
@ -17,8 +17,8 @@
|
|||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
use std::default::Default;
|
||||
use std::io::Read;
|
||||
use std::iter;
|
||||
use std::path::PathBuf;
|
||||
use std::{fmt, iter};
|
||||
|
||||
use git2::Oid;
|
||||
use itertools::Itertools;
|
||||
|
@ -33,13 +33,32 @@ use crate::refs::BranchPushUpdate;
|
|||
use crate::repo::{MutableRepo, Repo};
|
||||
use crate::revset::{self, RevsetExpression};
|
||||
use crate::settings::GitSettings;
|
||||
use crate::view::{RefName, View};
|
||||
use crate::view::View;
|
||||
|
||||
/// Reserved remote name for the backing Git repo.
|
||||
pub const REMOTE_NAME_FOR_LOCAL_GIT_REPO: &str = "git";
|
||||
/// Ref name used as a placeholder to unset HEAD without a commit.
|
||||
const UNBORN_ROOT_REF_NAME: &str = "refs/jj/root";
|
||||
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug)]
|
||||
pub enum RefName {
|
||||
LocalBranch(String),
|
||||
RemoteBranch { branch: String, remote: String },
|
||||
Tag(String),
|
||||
GitRef(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for RefName {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
RefName::LocalBranch(name) => write!(f, "{name}"),
|
||||
RefName::RemoteBranch { branch, remote } => write!(f, "{branch}@{remote}"),
|
||||
RefName::Tag(name) => write!(f, "{name}"),
|
||||
RefName::GitRef(name) => write!(f, "{name}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum GitImportError {
|
||||
#[error("Failed to read Git HEAD target commit {id}: {err}", id=id.hex())]
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#![allow(missing_docs)]
|
||||
|
||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
use std::fmt;
|
||||
|
||||
use itertools::Itertools;
|
||||
|
||||
|
@ -25,26 +24,6 @@ use crate::refs::TrackingRefPair;
|
|||
use crate::str_util::StringPattern;
|
||||
use crate::{op_store, refs};
|
||||
|
||||
// TODO: move to git module?
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug)]
|
||||
pub enum RefName {
|
||||
LocalBranch(String),
|
||||
RemoteBranch { branch: String, remote: String },
|
||||
Tag(String),
|
||||
GitRef(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for RefName {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
RefName::LocalBranch(name) => write!(f, "{name}"),
|
||||
RefName::RemoteBranch { branch, remote } => write!(f, "{branch}@{remote}"),
|
||||
RefName::Tag(name) => write!(f, "{name}"),
|
||||
RefName::GitRef(name) => write!(f, "{name}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||
pub struct View {
|
||||
data: op_store::View,
|
||||
|
|
|
@ -28,14 +28,13 @@ use jj_lib::commit_builder::CommitBuilder;
|
|||
use jj_lib::git;
|
||||
use jj_lib::git::{
|
||||
FailedRefExport, FailedRefExportReason, GitBranchPushTargets, GitFetchError, GitImportError,
|
||||
GitPushError, GitRefUpdate, SubmoduleConfig,
|
||||
GitPushError, GitRefUpdate, RefName, SubmoduleConfig,
|
||||
};
|
||||
use jj_lib::git_backend::GitBackend;
|
||||
use jj_lib::op_store::{BranchTarget, RefTarget, RemoteRef, RemoteRefState};
|
||||
use jj_lib::refs::BranchPushUpdate;
|
||||
use jj_lib::repo::{MutableRepo, ReadonlyRepo, Repo};
|
||||
use jj_lib::settings::{GitSettings, UserSettings};
|
||||
use jj_lib::view::RefName;
|
||||
use jj_lib::workspace::Workspace;
|
||||
use maplit::{btreemap, hashset};
|
||||
use tempfile::TempDir;
|
||||
|
|
Loading…
Reference in a new issue