mirror of
https://github.com/WarrenHood/MCModpackManager.git
synced 2025-04-30 00:24:58 +01:00
Compare commits
No commits in common. "e6b4eff11e05f113410300c0f386fb76a5a78c09" and "24a34e49b5f6c98de664d82c5949af00d2e8fdc7" have entirely different histories.
e6b4eff11e
...
24a34e49b5
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -2078,7 +2078,6 @@ dependencies = [
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
"sha1",
|
"sha1",
|
||||||
"sha2",
|
"sha2",
|
||||||
"similar",
|
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"tokio",
|
"tokio",
|
||||||
"toml",
|
"toml",
|
||||||
|
@ -3295,12 +3294,6 @@ version = "0.3.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "similar"
|
|
||||||
version = "2.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "siphasher"
|
name = "siphasher"
|
||||||
version = "0.3.11"
|
version = "0.3.11"
|
||||||
|
|
3
TODO.md
3
TODO.md
|
@ -16,8 +16,7 @@ This is a rather unorganised list of TODOs just so I can somewhat keep track of
|
||||||
merge (with conflict overrides on a file content level) should result in an install dir with A and B, where a.json and b.json are in A, and a.json is the result of merging a.json into the installed a.json (overwriting any existing key's values with the modpack's values), and the original files in folder B untouched (x.json and y.json)
|
merge (with conflict overrides on a file content level) should result in an install dir with A and B, where a.json and b.json are in A, and a.json is the result of merging a.json into the installed a.json (overwriting any existing key's values with the modpack's values), and the original files in folder B untouched (x.json and y.json)
|
||||||
|
|
||||||
merge (retaining original/modified values) merge should result in an install dir with A and B, where a.json and b.json are in A, and a.json is the result of merging a.json into the installed a.json (retaining the existing values from the file in the install dir), and the original files in folder B untouched (x.json and y.json)
|
merge (retaining original/modified values) merge should result in an install dir with A and B, where a.json and b.json are in A, and a.json is the result of merging a.json into the installed a.json (retaining the existing values from the file in the install dir), and the original files in folder B untouched (x.json and y.json)
|
||||||
- [ ] Test the merge apply policies when I am not half asleep
|
- [ ] Test the merge apply policies when I am not half asleep.
|
||||||
- [ ] Show package version somewhere in `mmm`
|
|
||||||
|
|
||||||
### Nice to haves
|
### Nice to haves
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ serde_json = "1.0.128"
|
||||||
serde_yaml = "0.9.34"
|
serde_yaml = "0.9.34"
|
||||||
sha1 = "0.10.6"
|
sha1 = "0.10.6"
|
||||||
sha2 = "0.10.8"
|
sha2 = "0.10.8"
|
||||||
similar = "2.6.0"
|
|
||||||
tempfile = "3.12.0"
|
tempfile = "3.12.0"
|
||||||
tokio = { version = "1.39.2", features = ["full"] }
|
tokio = { version = "1.39.2", features = ["full"] }
|
||||||
toml = { version = "0.8.19", features = ["preserve_order"] }
|
toml = { version = "0.8.19", features = ["preserve_order"] }
|
||||||
|
|
|
@ -6,7 +6,6 @@ use crate::{
|
||||||
};
|
};
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use similar::{ChangeTag, TextDiff};
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::{BTreeMap, BTreeSet},
|
collections::{BTreeMap, BTreeSet},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
@ -299,20 +298,9 @@ impl ModpackMeta {
|
||||||
)
|
)
|
||||||
.with_context(|| format!("Failed to merge file {src:?} -> {dst:?}"))?;
|
.with_context(|| format!("Failed to merge file {src:?} -> {dst:?}"))?;
|
||||||
|
|
||||||
std::fs::write(dst, &merged_contents).with_context(|| {
|
std::fs::write(dst, merged_contents).with_context(|| {
|
||||||
format!("Failed to write merged contents of {src:?} -> {dst:?}")
|
format!("Failed to write merged contents of {src:?} -> {dst:?}")
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
println!("Successfully merged {src:?} -> {dst:?}. See diff below:");
|
|
||||||
let diff = TextDiff::from_lines(&dst_val, &merged_contents);
|
|
||||||
for change in diff.iter_all_changes() {
|
|
||||||
let sign = match change.tag() {
|
|
||||||
ChangeTag::Delete => "-",
|
|
||||||
ChangeTag::Insert => "+",
|
|
||||||
ChangeTag::Equal => " ",
|
|
||||||
};
|
|
||||||
print!("{}{}", sign, change);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
println!("Syncing file {} -> {}", src.display(), dst.display());
|
println!("Syncing file {} -> {}", src.display(), dst.display());
|
||||||
std::fs::copy(src, dst)?;
|
std::fs::copy(src, dst)?;
|
||||||
|
|
Loading…
Reference in a new issue