forked from mirrors/jj
working_copy: pass Merge
, not ConflictId
, to write_conflict()
This is another small step towards making this code work with tree-level conflicts.
This commit is contained in:
parent
1571541214
commit
7ad2270c05
1 changed files with 7 additions and 5 deletions
|
@ -40,7 +40,7 @@ use thiserror::Error;
|
||||||
use tracing::{instrument, trace_span};
|
use tracing::{instrument, trace_span};
|
||||||
|
|
||||||
use crate::backend::{
|
use crate::backend::{
|
||||||
BackendError, ConflictId, FileId, MillisSinceEpoch, ObjectId, SymlinkId, TreeId, TreeValue,
|
BackendError, FileId, MillisSinceEpoch, ObjectId, SymlinkId, TreeId, TreeValue,
|
||||||
};
|
};
|
||||||
use crate::conflicts;
|
use crate::conflicts;
|
||||||
#[cfg(feature = "watchman")]
|
#[cfg(feature = "watchman")]
|
||||||
|
@ -1109,10 +1109,9 @@ impl TreeState {
|
||||||
&self,
|
&self,
|
||||||
disk_path: &Path,
|
disk_path: &Path,
|
||||||
path: &RepoPath,
|
path: &RepoPath,
|
||||||
id: &ConflictId,
|
conflict: &Merge<Option<TreeValue>>,
|
||||||
) -> Result<FileState, CheckoutError> {
|
) -> Result<FileState, CheckoutError> {
|
||||||
create_parent_dirs(&self.working_copy_path, path)?;
|
create_parent_dirs(&self.working_copy_path, path)?;
|
||||||
let conflict = self.store.read_conflict(path, id)?;
|
|
||||||
let mut file = OpenOptions::new()
|
let mut file = OpenOptions::new()
|
||||||
.write(true)
|
.write(true)
|
||||||
.create_new(true) // Don't overwrite un-ignored file. Don't follow symlink.
|
.create_new(true) // Don't overwrite un-ignored file. Don't follow symlink.
|
||||||
|
@ -1122,7 +1121,7 @@ impl TreeState {
|
||||||
err,
|
err,
|
||||||
})?;
|
})?;
|
||||||
let mut conflict_data = vec![];
|
let mut conflict_data = vec![];
|
||||||
conflicts::materialize(&conflict, self.store.as_ref(), path, &mut conflict_data)
|
conflicts::materialize(conflict, self.store.as_ref(), path, &mut conflict_data)
|
||||||
.expect("Failed to materialize conflict to in-memory buffer");
|
.expect("Failed to materialize conflict to in-memory buffer");
|
||||||
file.write_all(&conflict_data)
|
file.write_all(&conflict_data)
|
||||||
.map_err(|err| CheckoutError::IoError {
|
.map_err(|err| CheckoutError::IoError {
|
||||||
|
@ -1250,7 +1249,10 @@ impl TreeState {
|
||||||
self.write_file(&disk_path, &path, &id, executable)?
|
self.write_file(&disk_path, &path, &id, executable)?
|
||||||
}
|
}
|
||||||
TreeValue::Symlink(id) => self.write_symlink(&disk_path, &path, &id)?,
|
TreeValue::Symlink(id) => self.write_symlink(&disk_path, &path, &id)?,
|
||||||
TreeValue::Conflict(id) => self.write_conflict(&disk_path, &path, &id)?,
|
TreeValue::Conflict(id) => {
|
||||||
|
let conflict = self.store.read_conflict(&path, &id)?;
|
||||||
|
self.write_conflict(&disk_path, &path, &conflict)?
|
||||||
|
}
|
||||||
TreeValue::GitSubmodule(_id) => {
|
TreeValue::GitSubmodule(_id) => {
|
||||||
println!("ignoring git submodule at {path:?}");
|
println!("ignoring git submodule at {path:?}");
|
||||||
FileState::for_gitsubmodule()
|
FileState::for_gitsubmodule()
|
||||||
|
|
Loading…
Reference in a new issue