mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
CODEMOD: rename mercurial_types::EntryId to DEntryId
Summary: mercurial_types::DEntryId should be replaced by types from mononoke_types or mercurial in most cases. This rename should help with tracking this Reviewed By: sid0 Differential Revision: D7619571 fbshipit-source-id: bf8d81ec9ffe6a5525d923d7ee67d8e92498aa4d
This commit is contained in:
parent
73034a99b2
commit
c35a537aaa
@ -16,7 +16,7 @@ use mercurial::file;
|
||||
use mercurial_types::{BlobNode, DManifestId, DNodeHash, FileType, HgBlob, MPath, MPathElement,
|
||||
Parents};
|
||||
use mercurial_types::manifest::{Content, Entry, Manifest, Type};
|
||||
use mercurial_types::nodehash::EntryId;
|
||||
use mercurial_types::nodehash::DEntryId;
|
||||
|
||||
use blobstore::Blobstore;
|
||||
|
||||
@ -30,7 +30,7 @@ use utils::{get_node, RawNodeBlob};
|
||||
pub struct BlobEntry {
|
||||
blobstore: Arc<Blobstore>,
|
||||
name: Option<MPathElement>,
|
||||
id: EntryId,
|
||||
id: DEntryId,
|
||||
ty: Type,
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ impl BlobEntry {
|
||||
Ok(Self {
|
||||
blobstore,
|
||||
name,
|
||||
id: EntryId::new(nodeid),
|
||||
id: DEntryId::new(nodeid),
|
||||
ty,
|
||||
})
|
||||
}
|
||||
@ -86,7 +86,7 @@ impl BlobEntry {
|
||||
Self {
|
||||
blobstore,
|
||||
name: None,
|
||||
id: EntryId::new(manifestid.into_nodehash()),
|
||||
id: DEntryId::new(manifestid.into_nodehash()),
|
||||
ty: Type::Tree,
|
||||
}
|
||||
}
|
||||
@ -166,7 +166,7 @@ impl Entry for BlobEntry {
|
||||
.boxify()
|
||||
}
|
||||
|
||||
fn get_hash(&self) -> &EntryId {
|
||||
fn get_hash(&self) -> &DEntryId {
|
||||
&self.id
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ use futures::stream::{self, Stream};
|
||||
use futures_ext::{BoxFuture, BoxStream, FutureExt, StreamExt};
|
||||
|
||||
use mercurial_types::{Entry, FileType, MPathElement, Manifest, Type};
|
||||
use mercurial_types::nodehash::{DManifestId, DNodeHash, EntryId, D_NULL_HASH};
|
||||
use mercurial_types::nodehash::{DEntryId, DManifestId, DNodeHash, D_NULL_HASH};
|
||||
|
||||
use blobstore::Blobstore;
|
||||
|
||||
@ -25,7 +25,7 @@ use utils::get_node;
|
||||
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
pub struct Details {
|
||||
entryid: EntryId,
|
||||
entryid: DEntryId,
|
||||
flag: Type,
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ impl Details {
|
||||
.map_err(|err| Error::from(err))
|
||||
.and_then(|hash| hash.parse::<DNodeHash>())
|
||||
.with_context(|_| format!("malformed hash: {:?}", hash))?;
|
||||
let entryid = EntryId::new(hash);
|
||||
let entryid = DEntryId::new(hash);
|
||||
|
||||
ensure_msg!(flags.len() <= 1, "More than 1 flag: {:?}", flags);
|
||||
|
||||
@ -204,7 +204,7 @@ impl Details {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn entryid(&self) -> &EntryId {
|
||||
pub fn entryid(&self) -> &DEntryId {
|
||||
&self.entryid
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ use uuid::Uuid;
|
||||
use blobstore::Blobstore;
|
||||
use filenodes::{FilenodeInfo, Filenodes};
|
||||
use mercurial::file;
|
||||
use mercurial_types::{BlobNode, Changeset, DChangesetId, DNodeHash, Entry, EntryId, MPath,
|
||||
use mercurial_types::{BlobNode, Changeset, DChangesetId, DEntryId, DNodeHash, Entry, MPath,
|
||||
Manifest, Parents, RepoPath, RepositoryId, Time};
|
||||
use mercurial_types::manifest::{self, Content};
|
||||
use mercurial_types::manifest_utils::{changed_entry_stream, EntryStatus};
|
||||
@ -81,7 +81,7 @@ impl From<BlobChangeset> for ChangesetHandle {
|
||||
struct UploadEntriesState {
|
||||
/// Listing of blobs that we need, based on parsing the root manifest and all the newly
|
||||
/// uploaded child manifests
|
||||
required_entries: HashMap<RepoPath, EntryId>,
|
||||
required_entries: HashMap<RepoPath, DEntryId>,
|
||||
/// All the blobs that have been uploaded in this changeset
|
||||
uploaded_entries: HashMap<RepoPath, BlobEntry>,
|
||||
/// Parent hashes (if any) of the blobs that have been uploaded in this changeset. Used for
|
||||
|
@ -29,7 +29,7 @@ use bytes::Bytes;
|
||||
use futures::Future;
|
||||
|
||||
use blobrepo::{compute_changed_files, BlobRepo};
|
||||
use mercurial_types::{manifest, Changeset, DChangesetId, DManifestId, Entry, EntryId, FileType,
|
||||
use mercurial_types::{manifest, Changeset, DChangesetId, DEntryId, DManifestId, Entry, FileType,
|
||||
HgBlob, MPath, MPathElement, RepoPath};
|
||||
|
||||
mod stats_units;
|
||||
@ -54,7 +54,7 @@ fn upload_blob_no_parents(repo: BlobRepo) {
|
||||
// The entry we're given is correct...
|
||||
let (entry, path) = run_future(future).unwrap();
|
||||
assert!(path == fake_path);
|
||||
assert!(entry.get_hash() == &EntryId::new(expected_hash));
|
||||
assert!(entry.get_hash() == &DEntryId::new(expected_hash));
|
||||
assert!(entry.get_type() == manifest::Type::File(FileType::Regular));
|
||||
assert!(
|
||||
entry.get_name() == Some(&MPathElement::new("file".into()).expect("valid MPathElement"))
|
||||
@ -94,7 +94,7 @@ fn upload_blob_one_parent(repo: BlobRepo) {
|
||||
let (entry, path) = run_future(future2.join(future).map(|(item, _)| item)).unwrap();
|
||||
|
||||
assert!(path == fake_path);
|
||||
assert!(entry.get_hash() == &EntryId::new(expected_hash));
|
||||
assert!(entry.get_hash() == &DEntryId::new(expected_hash));
|
||||
assert!(entry.get_type() == manifest::Type::File(FileType::Regular));
|
||||
assert!(
|
||||
entry.get_name() == Some(&MPathElement::new("file".into()).expect("valid MPathElement"))
|
||||
|
@ -18,7 +18,7 @@ use futures_ext::{BoxFuture, BoxStream, FutureExt, StreamExt};
|
||||
use mercurial_types::{Entry, FileType, HgBlob, MPath, MPathElement, Manifest, RepoPath, Type};
|
||||
use mercurial_types::blobnode::Parents;
|
||||
use mercurial_types::manifest::Content;
|
||||
use mercurial_types::nodehash::EntryId;
|
||||
use mercurial_types::nodehash::DEntryId;
|
||||
|
||||
use errors::*;
|
||||
|
||||
@ -58,7 +58,7 @@ impl MockManifest {
|
||||
|
||||
/// Build a root tree manifest from a map of paths to file types and contents.
|
||||
pub fn from_path_map(
|
||||
path_map: BTreeMap<MPath, (FileType, Bytes, Option<EntryId>)>,
|
||||
path_map: BTreeMap<MPath, (FileType, Bytes, Option<DEntryId>)>,
|
||||
) -> Result<Self> {
|
||||
// Stack of directory names and entry lists currently being built
|
||||
let mut wip: Vec<(Option<MPath>, _)> = vec![(None, BTreeMap::new())];
|
||||
@ -118,7 +118,7 @@ impl MockManifest {
|
||||
/// A generic version of `from_path_map`.
|
||||
pub fn from_path_hashes<I, P, B>(paths: I) -> Result<Self>
|
||||
where
|
||||
I: IntoIterator<Item = (P, (FileType, B, EntryId))>,
|
||||
I: IntoIterator<Item = (P, (FileType, B, DEntryId))>,
|
||||
P: AsRef<[u8]>,
|
||||
B: Into<Bytes>,
|
||||
{
|
||||
@ -218,7 +218,7 @@ pub struct MockEntry {
|
||||
name: Option<MPathElement>,
|
||||
content_factory: ContentFactory,
|
||||
ty: Option<Type>,
|
||||
hash: Option<EntryId>,
|
||||
hash: Option<DEntryId>,
|
||||
}
|
||||
|
||||
impl Clone for MockEntry {
|
||||
@ -254,7 +254,7 @@ impl MockEntry {
|
||||
self.ty = Some(ty);
|
||||
}
|
||||
|
||||
pub fn set_hash(&mut self, hash: EntryId) {
|
||||
pub fn set_hash(&mut self, hash: DEntryId) {
|
||||
self.hash = Some(hash);
|
||||
}
|
||||
}
|
||||
@ -275,7 +275,7 @@ impl Entry for MockEntry {
|
||||
fn get_size(&self) -> BoxFuture<Option<usize>, Error> {
|
||||
unimplemented!();
|
||||
}
|
||||
fn get_hash(&self) -> &EntryId {
|
||||
fn get_hash(&self) -> &DEntryId {
|
||||
match self.hash {
|
||||
Some(ref hash) => hash,
|
||||
None => panic!("hash is not set!"),
|
||||
|
@ -101,7 +101,7 @@ pub use delta::Delta;
|
||||
pub use fsencode::{fncache_fsencode, simple_fsencode};
|
||||
pub use manifest::{Entry, Manifest, Type};
|
||||
pub use node::Node;
|
||||
pub use nodehash::{DChangesetId, DFileNodeId, DManifestId, DNodeHash, EntryId, D_NULL_HASH};
|
||||
pub use nodehash::{DChangesetId, DEntryId, DFileNodeId, DManifestId, DNodeHash, D_NULL_HASH};
|
||||
pub use repo::RepositoryId;
|
||||
pub use utils::percent_encode;
|
||||
|
||||
|
@ -15,7 +15,7 @@ use mononoke_types::{FileType, MPathElement};
|
||||
use blob::HgBlob;
|
||||
use blobnode::Parents;
|
||||
use futures_ext::{BoxFuture, BoxStream, FutureExt, StreamExt};
|
||||
use nodehash::EntryId;
|
||||
use nodehash::DEntryId;
|
||||
|
||||
/// Interface for a manifest
|
||||
///
|
||||
@ -203,7 +203,7 @@ pub trait Entry: Send + 'static {
|
||||
fn get_size(&self) -> BoxFuture<Option<usize>, Error>;
|
||||
|
||||
/// Get the identity of the object this entry refers to.
|
||||
fn get_hash(&self) -> &EntryId;
|
||||
fn get_hash(&self) -> &DEntryId;
|
||||
|
||||
/// Get the name of the entry. None means that this is a root entry
|
||||
fn get_name(&self) -> Option<&MPathElement>;
|
||||
@ -261,7 +261,7 @@ where
|
||||
self.entry.get_size().boxify()
|
||||
}
|
||||
|
||||
fn get_hash(&self) -> &EntryId {
|
||||
fn get_hash(&self) -> &DEntryId {
|
||||
self.entry.get_hash()
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ impl Entry for Box<Entry + Sync> {
|
||||
(**self).get_size()
|
||||
}
|
||||
|
||||
fn get_hash(&self) -> &EntryId {
|
||||
fn get_hash(&self) -> &DEntryId {
|
||||
(**self).get_hash()
|
||||
}
|
||||
|
||||
|
@ -263,22 +263,22 @@ impl Display for DFileNodeId {
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: (jsgf) T25576292 EntryId should be a (Type, NodeId) tuple
|
||||
/// TODO: (jsgf) T25576292 DEntryId should be a (Type, NodeId) tuple
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct EntryId(DNodeHash);
|
||||
pub struct DEntryId(DNodeHash);
|
||||
|
||||
impl EntryId {
|
||||
impl DEntryId {
|
||||
pub fn into_nodehash(self) -> DNodeHash {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub fn new(hash: DNodeHash) -> Self {
|
||||
EntryId(hash)
|
||||
DEntryId(hash)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for EntryId {
|
||||
impl Display for DEntryId {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.0.fmt(fmt)
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ use mercurial_types::{Changeset, Entry, FileType, MPath, Manifest, RepoPath, Typ
|
||||
use mercurial_types::manifest::Content;
|
||||
use mercurial_types::manifest_utils::{changed_entry_stream, diff_sorted_vecs, ChangedEntry,
|
||||
EntryStatus};
|
||||
use mercurial_types::nodehash::{DChangesetId, DNodeHash, EntryId};
|
||||
use mercurial_types::nodehash::{DChangesetId, DEntryId, DNodeHash};
|
||||
use mercurial_types_mocks::manifest::{ContentFactory, MockEntry};
|
||||
use mercurial_types_mocks::nodehash;
|
||||
|
||||
@ -41,12 +41,12 @@ fn get_root_manifest(repo: Arc<BlobRepo>, changesetid: &DChangesetId) -> Box<Man
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn get_hash(c: char) -> EntryId {
|
||||
fn get_hash(c: char) -> DEntryId {
|
||||
let hash: String = repeat(c).take(40).collect();
|
||||
EntryId::new(DNodeHash::from_str(&hash).unwrap())
|
||||
DEntryId::new(DNodeHash::from_str(&hash).unwrap())
|
||||
}
|
||||
|
||||
fn get_entry(ty: Type, hash: EntryId, path: RepoPath) -> Box<Entry + Sync> {
|
||||
fn get_entry(ty: Type, hash: DEntryId, path: RepoPath) -> Box<Entry + Sync> {
|
||||
let content_factory: ContentFactory = Arc::new(|| -> Content {
|
||||
panic!("should not be called");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user