Rename 'contributing paths' to 'relevant paths'

This commit is contained in:
Lucien Greathouse
2019-10-04 17:36:26 -07:00
parent 052ca52cc3
commit 530a7aa834
34 changed files with 73 additions and 73 deletions

View File

@@ -23,7 +23,7 @@ pub struct InstanceMetadata {
/// even if they don't exist, since the presence of a file can change the
/// outcome of a snapshot function.
///
/// For example, a file named foo.lua might have these contributing paths:
/// For example, a file named foo.lua might have these relevant paths:
/// - foo.lua
/// - foo.meta.json (even if this file doesn't exist!)
///
@@ -39,7 +39,7 @@ pub struct InstanceMetadata {
/// that may need updates.
// TODO: Change this to be a SmallVec for performance in common cases?
#[serde(serialize_with = "path_serializer::serialize_vec_absolute")]
pub contributing_paths: Vec<PathBuf>,
pub relevant_paths: Vec<PathBuf>,
}
impl Default for InstanceMetadata {
@@ -47,7 +47,7 @@ impl Default for InstanceMetadata {
InstanceMetadata {
ignore_unknown_instances: false,
instigating_source: None,
contributing_paths: Vec::new(),
relevant_paths: Vec::new(),
}
}
}

View File

@@ -11,5 +11,5 @@ properties:
Value: Value of Foo
metadata:
ignore_unknown_instances: false
contributing_paths: []
children: []
relevant_paths: []
children: []

View File

@@ -8,5 +8,5 @@ class_name: ROOT
properties: {}
metadata:
ignore_unknown_instances: false
contributing_paths: []
children: []
relevant_paths: []
children: []

View File

@@ -11,5 +11,5 @@ properties:
Value: Should be removed
metadata:
ignore_unknown_instances: false
contributing_paths: []
children: []
relevant_paths: []
children: []

View File

@@ -8,5 +8,5 @@ class_name: Folder
properties: {}
metadata:
ignore_unknown_instances: false
contributing_paths: []
children: []
relevant_paths: []
children: []

View File

@@ -9,9 +9,9 @@ added_instances:
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths: []
relevant_paths: []
name: New
class_name: Folder
properties: {}
children: []
updated_instances: []
updated_instances: []

View File

@@ -113,12 +113,12 @@ impl RojoTree {
// If this instance's source path changed, we need to update our
// path associations so that file changes will trigger updates
// to this instance correctly.
if existing_metadata.contributing_paths != metadata.contributing_paths {
for existing_path in &existing_metadata.contributing_paths {
if existing_metadata.relevant_paths != metadata.relevant_paths {
for existing_path in &existing_metadata.relevant_paths {
self.path_to_ids.remove(existing_path, id);
}
for new_path in &metadata.contributing_paths {
for new_path in &metadata.relevant_paths {
self.path_to_ids.insert(new_path.clone(), id);
}
}
@@ -147,7 +147,7 @@ impl RojoTree {
}
fn insert_metadata(&mut self, id: RbxId, metadata: InstanceMetadata) {
for path in &metadata.contributing_paths {
for path in &metadata.relevant_paths {
self.path_to_ids.insert(path.clone(), id);
}
@@ -164,7 +164,7 @@ impl RojoTree {
) {
let metadata = self.metadata_map.remove(&id).unwrap();
for path in &metadata.contributing_paths {
for path in &metadata.relevant_paths {
self.path_to_ids.remove(path, id);
path_to_ids.insert(path.clone(), id);
}

View File

@@ -40,7 +40,7 @@ impl SnapshotMiddleware for SnapshotCsv {
Ok(Some(InstanceSnapshot {
snapshot_id: None,
metadata: InstanceMetadata {
contributing_paths: vec![entry.path().to_path_buf()],
relevant_paths: vec![entry.path().to_path_buf()],
..Default::default()
},
name: Cow::Owned(instance_name),

View File

@@ -44,7 +44,7 @@ impl SnapshotMiddleware for SnapshotDir {
Ok(Some(InstanceSnapshot {
snapshot_id: None,
metadata: InstanceMetadata {
contributing_paths: vec![entry.path().to_path_buf()],
relevant_paths: vec![entry.path().to_path_buf()],
..Default::default()
},
name: Cow::Owned(instance_name),

View File

@@ -52,7 +52,7 @@ impl SnapshotMiddleware for SnapshotJsonModel {
let mut snapshot = instance.core.into_snapshot(instance_name);
snapshot.metadata.contributing_paths = vec![entry.path().to_path_buf()];
snapshot.metadata.relevant_paths = vec![entry.path().to_path_buf()];
Ok(Some(snapshot))
}

View File

@@ -91,7 +91,7 @@ fn snapshot_lua_file<F: ImfsFetcher>(
Ok(Some(InstanceSnapshot {
snapshot_id: None,
metadata: InstanceMetadata {
contributing_paths: vec![entry.path().to_path_buf()],
relevant_paths: vec![entry.path().to_path_buf()],
..Default::default()
},
name: Cow::Owned(instance_name.to_owned()),

View File

@@ -31,9 +31,9 @@ impl SnapshotMiddleware for SnapshotProject {
Err(ref err) if err.kind() == FsErrorKind::NotFound => {}
Err(err) => return Err(err),
// TODO: Do we need to muck with the contributing paths if we're
// a project file within a folder? Should the folder path be the
// contributing path instead of the project file path?
// TODO: Do we need to muck with the relevant paths if we're a
// project file within a folder? Should the folder path be the
// relevant path instead of the project file path?
Ok(entry) => return SnapshotProject::from_imfs(imfs, &entry),
}
}
@@ -57,12 +57,12 @@ impl SnapshotMiddleware for SnapshotProject {
// file and not the snapshot's original instigating path, or else we
// won't pick up new changes from the project file.
//
// We SHOULD NOT mark the project file as a contributing path for any
// We SHOULD NOT mark the project file as a relevant path for any
// nodes that aren't roots. They'll be updated as part of the project
// file being updated.
snapshot
.metadata
.contributing_paths
.relevant_paths
.push(entry.path().to_path_buf());
Ok(Some(snapshot))

View File

@@ -43,7 +43,7 @@ impl SnapshotMiddleware for SnapshotRbxlx {
let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, root_id);
snapshot.name = Cow::Owned(instance_name);
snapshot.metadata.contributing_paths = vec![entry.path().to_path_buf()];
snapshot.metadata.relevant_paths = vec![entry.path().to_path_buf()];
Ok(Some(snapshot))
}

View File

@@ -49,7 +49,7 @@ impl SnapshotMiddleware for SnapshotRbxm {
if children.len() == 1 {
let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0]);
snapshot.name = Cow::Owned(instance_name);
snapshot.metadata.contributing_paths = vec![entry.path().to_path_buf()];
snapshot.metadata.relevant_paths = vec![entry.path().to_path_buf()];
Ok(Some(snapshot))
} else {

View File

@@ -45,7 +45,7 @@ impl SnapshotMiddleware for SnapshotRbxmx {
if children.len() == 1 {
let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0]);
snapshot.name = Cow::Owned(instance_name);
snapshot.metadata.contributing_paths = vec![entry.path().to_path_buf()];
snapshot.metadata.relevant_paths = vec![entry.path().to_path_buf()];
Ok(Some(snapshot))
} else {

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo.client.lua
name: foo
class_name: LocalScript
@@ -13,4 +13,4 @@ properties:
Source:
Type: String
Value: Hello there!
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo.csv
name: foo
class_name: LocalizationTable
@@ -13,4 +13,4 @@ properties:
Contents:
Type: String
Value: "[{\"key\":\"Ack\",\"example\":\"An exclamation of despair\",\"source\":\"Ack!\",\"values\":{\"es\":\"¡Ay!\"}}]"
children: []
children: []

View File

@@ -5,9 +5,9 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo
name: foo
class_name: Folder
properties: {}
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo
name: foo
class_name: Folder
@@ -14,9 +14,9 @@ children:
- snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo/Child
name: Child
class_name: Folder
properties: {}
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo.txt
name: foo
class_name: StringValue
@@ -13,4 +13,4 @@ properties:
Value:
Type: String
Value: Hello there!
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo.model.json
name: foo
class_name: IntValue
@@ -17,8 +17,8 @@ children:
- snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths: []
relevant_paths: []
name: The Child
class_name: StringValue
properties: {}
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo.lua
name: foo
class_name: ModuleScript
@@ -13,4 +13,4 @@ properties:
Source:
Type: String
Value: Hello there!
children: []
children: []

View File

@@ -5,9 +5,9 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths:
relevant_paths:
- /foo/hello.project.json
name: direct-project
class_name: Model
properties: {}
children: []
children: []

View File

@@ -5,9 +5,9 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths:
relevant_paths:
- /foo/default.project.json
name: indirect-project
class_name: Folder
properties: {}
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths:
relevant_paths:
- /foo/other.project.json
- /foo/default.project.json
name: path-property-override
@@ -14,4 +14,4 @@ properties:
Value:
Type: String
Value: Changed
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths:
relevant_paths:
- /foo/default.project.json
name: children
class_name: Folder
@@ -14,8 +14,8 @@ children:
- snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths: []
relevant_paths: []
name: Child
class_name: Model
properties: {}
children: []
children: []

View File

@@ -5,10 +5,10 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths:
relevant_paths:
- /foo/other.project.json
- /foo/default.project.json
name: path-project
class_name: Model
properties: {}
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths:
relevant_paths:
- /foo/other.project.json
- /foo/default.project.json
name: path-child-project
@@ -15,8 +15,8 @@ children:
- snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths: []
relevant_paths: []
name: SomeChild
class_name: Model
properties: {}
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo/other.txt
- /foo/default.project.json
name: path-project
@@ -14,4 +14,4 @@ properties:
Value:
Type: String
Value: "Hello, world!"
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths:
relevant_paths:
- /foo/default.project.json
name: resolved-properties
class_name: StringValue
@@ -13,4 +13,4 @@ properties:
Value:
Type: String
Value: "Hello, world!"
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: true
contributing_paths:
relevant_paths:
- /foo/default.project.json
name: unresolved-properties
class_name: StringValue
@@ -13,4 +13,4 @@ properties:
Value:
Type: String
Value: Hi!
children: []
children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
contributing_paths:
relevant_paths:
- /foo.server.lua
name: foo
class_name: Script
@@ -13,4 +13,4 @@ properties:
Source:
Type: String
Value: Hello there!
children: []
children: []

View File

@@ -52,7 +52,7 @@ impl SnapshotMiddleware for SnapshotTxt {
Ok(Some(InstanceSnapshot {
snapshot_id: None,
metadata: InstanceMetadata {
contributing_paths: vec![entry.path().to_path_buf()],
relevant_paths: vec![entry.path().to_path_buf()],
..Default::default()
},
name: Cow::Owned(instance_name),

View File

@@ -248,17 +248,17 @@ impl<F: ImfsFetcher> UiService<F> {
let metadata_container = {
let metadata = instance.metadata();
let contributing_paths = if metadata.contributing_paths.is_empty() {
let relevant_paths = if metadata.relevant_paths.is_empty() {
HtmlContent::None
} else {
let list = metadata
.contributing_paths
.relevant_paths
.iter()
.map(|path| html! { <li>{ format!("{}", path.display()) }</li> });
html! {
<div>
"contributing_paths: "
"relevant_paths: "
<ul class="path-list">{ Fragment::new(list) }</ul>
</div>
}
@@ -268,7 +268,7 @@ impl<F: ImfsFetcher> UiService<F> {
<>
<div>"ignore_unknown_instances: " { metadata.ignore_unknown_instances.to_string() }</div>
<div>"instigating source: " { format!("{:?}", metadata.instigating_source) }</div>
{ contributing_paths }
{ relevant_paths }
</>
};