forked from mirrors/jj
repo_path: remove RepoPathJoin trait, just implement join() on the type
I don't think we'll add join() that takes different types.
This commit is contained in:
parent
d7df2516c5
commit
6344cd56b3
6 changed files with 6 additions and 16 deletions
|
@ -57,7 +57,7 @@ use crate::matchers::{
|
|||
use crate::merge::{Merge, MergeBuilder, MergedTreeValue};
|
||||
use crate::merged_tree::{MergedTree, MergedTreeBuilder};
|
||||
use crate::op_store::{OperationId, WorkspaceId};
|
||||
use crate::repo_path::{RepoPath, RepoPathComponent, RepoPathJoin};
|
||||
use crate::repo_path::{RepoPath, RepoPathComponent};
|
||||
use crate::settings::HumanByteSize;
|
||||
use crate::store::Store;
|
||||
use crate::tree::Tree;
|
||||
|
|
|
@ -30,7 +30,7 @@ use pollster::FutureExt;
|
|||
use crate::backend::{BackendError, BackendResult, ConflictId, MergedTreeId, TreeId, TreeValue};
|
||||
use crate::matchers::{EverythingMatcher, Matcher};
|
||||
use crate::merge::{Merge, MergeBuilder, MergedTreeValue};
|
||||
use crate::repo_path::{RepoPath, RepoPathComponent, RepoPathJoin};
|
||||
use crate::repo_path::{RepoPath, RepoPathComponent};
|
||||
use crate::store::Store;
|
||||
use crate::tree::{try_resolve_file_conflict, Tree, TreeMergeError};
|
||||
use crate::tree_builder::TreeBuilder;
|
||||
|
|
|
@ -180,18 +180,8 @@ impl RepoPath {
|
|||
pub fn components(&self) -> &Vec<RepoPathComponent> {
|
||||
&self.components
|
||||
}
|
||||
}
|
||||
|
||||
pub trait RepoPathJoin<T> {
|
||||
type Result;
|
||||
|
||||
fn join(&self, entry: &T) -> Self::Result;
|
||||
}
|
||||
|
||||
impl RepoPathJoin<RepoPathComponent> for RepoPath {
|
||||
type Result = RepoPath;
|
||||
|
||||
fn join(&self, entry: &RepoPathComponent) -> RepoPath {
|
||||
pub fn join(&self, entry: &RepoPathComponent) -> RepoPath {
|
||||
let components = self.components.iter().chain([entry]).cloned().collect();
|
||||
RepoPath { components }
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ use crate::backend::{
|
|||
use crate::files::MergeResult;
|
||||
use crate::matchers::{EverythingMatcher, Matcher};
|
||||
use crate::merge::{trivial_merge, Merge, MergedTreeValue};
|
||||
use crate::repo_path::{RepoPath, RepoPathComponent, RepoPathJoin};
|
||||
use crate::repo_path::{RepoPath, RepoPathComponent};
|
||||
use crate::store::Store;
|
||||
use crate::{backend, files};
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ use jj_lib::merge::Merge;
|
|||
use jj_lib::merged_tree::MergedTreeBuilder;
|
||||
use jj_lib::op_store::{OperationId, WorkspaceId};
|
||||
use jj_lib::repo::{ReadonlyRepo, Repo};
|
||||
use jj_lib::repo_path::{RepoPath, RepoPathComponent, RepoPathJoin};
|
||||
use jj_lib::repo_path::{RepoPath, RepoPathComponent};
|
||||
use jj_lib::settings::UserSettings;
|
||||
use jj_lib::working_copy::{CheckoutStats, SnapshotError, SnapshotOptions};
|
||||
use jj_lib::workspace::LockedWorkspace;
|
||||
|
|
|
@ -23,7 +23,7 @@ use jj_lib::merged_tree::{
|
|||
MergedTree, MergedTreeBuilder, MergedTreeVal, TreeDiffIterator, TreeDiffStreamImpl,
|
||||
};
|
||||
use jj_lib::repo::Repo;
|
||||
use jj_lib::repo_path::{RepoPath, RepoPathComponent, RepoPathJoin};
|
||||
use jj_lib::repo_path::{RepoPath, RepoPathComponent};
|
||||
use jj_lib::tree::merge_trees;
|
||||
use pretty_assertions::assert_eq;
|
||||
use testutils::{create_single_tree, write_file, TestRepo};
|
||||
|
|
Loading…
Reference in a new issue