mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 08:53:16 +00:00
repo_path: remove unused functions
This commit is contained in:
parent
c66990d3a3
commit
57d2bc4068
1 changed files with 0 additions and 31 deletions
|
@ -102,16 +102,6 @@ impl RepoPath {
|
||||||
self.dir.to_internal_dir_string() + self.basename.value()
|
self.dir.to_internal_dir_string() + self.basename.value()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_dir_repo_path(&self) -> DirRepoPath {
|
|
||||||
if self.is_root() {
|
|
||||||
DirRepoPath::root()
|
|
||||||
} else {
|
|
||||||
self.dir.join(&DirRepoPathComponent {
|
|
||||||
value: self.basename.value.clone(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn to_fs_path(&self, base: &Path) -> PathBuf {
|
pub fn to_fs_path(&self, base: &Path) -> PathBuf {
|
||||||
let mut result = base.to_owned();
|
let mut result = base.to_owned();
|
||||||
for dir in self.dir.components() {
|
for dir in self.dir.components() {
|
||||||
|
@ -189,14 +179,6 @@ impl DirRepoPath {
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn contains_dir(&self, other: &DirRepoPath) -> bool {
|
|
||||||
other.value.starts_with(&self.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn contains_file(&self, other: &RepoPath) -> bool {
|
|
||||||
other.dir.value.starts_with(&self.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: consider making this return a Option<DirRepoPathSlice> or similar,
|
// TODO: consider making this return a Option<DirRepoPathSlice> or similar,
|
||||||
// where the slice would borrow from this instance.
|
// where the slice would borrow from this instance.
|
||||||
pub fn parent(&self) -> Option<DirRepoPath> {
|
pub fn parent(&self) -> Option<DirRepoPath> {
|
||||||
|
@ -439,17 +421,4 @@ mod tests {
|
||||||
Path::new("dir/file")
|
Path::new("dir/file")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_convert() {
|
|
||||||
assert_eq!(RepoPath::root().to_dir_repo_path(), DirRepoPath::root());
|
|
||||||
assert_eq!(
|
|
||||||
RepoPath::from_internal_string("dir").to_dir_repo_path(),
|
|
||||||
DirRepoPath::from_internal_dir_string("dir/")
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
RepoPath::from_internal_string("dir/subdir").to_dir_repo_path(),
|
|
||||||
DirRepoPath::from_internal_dir_string("dir/subdir/")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue