mirror of
https://github.com/martinvonz/jj.git
synced 2025-05-30 19:32:39 +00:00
store: delete read_file(), update callers to use async version
This commit is contained in:
parent
84f188b91e
commit
12bcd04459
@ -190,7 +190,9 @@ fn fix_one_file(
|
||||
// subsequent matching tool gets its input from the previous matching tool's
|
||||
// output.
|
||||
let mut old_content = vec![];
|
||||
let mut read = store.read_file(&file_to_fix.repo_path, &file_to_fix.file_id)?;
|
||||
let mut read = store
|
||||
.read_file_async(&file_to_fix.repo_path, &file_to_fix.file_id)
|
||||
.block_on()?;
|
||||
read.read_to_end(&mut old_content)?;
|
||||
let new_content = matching_tools.fold(old_content.clone(), |prev_content, tool_config| {
|
||||
match run_tool(
|
||||
|
@ -234,10 +234,6 @@ impl Store {
|
||||
Ok(Tree::new(self.clone(), path.to_owned(), tree_id, data))
|
||||
}
|
||||
|
||||
pub fn read_file(&self, path: &RepoPath, id: &FileId) -> BackendResult<Box<dyn Read>> {
|
||||
self.read_file_async(path, id).block_on()
|
||||
}
|
||||
|
||||
pub async fn read_file_async(
|
||||
&self,
|
||||
path: &RepoPath,
|
||||
|
@ -370,7 +370,7 @@ pub fn repo_path_buf(value: impl Into<String>) -> RepoPathBuf {
|
||||
}
|
||||
|
||||
pub fn read_file(store: &Store, path: &RepoPath, id: &FileId) -> Vec<u8> {
|
||||
let mut reader = store.read_file(path, id).unwrap();
|
||||
let mut reader = store.read_file_async(path, id).block_on().unwrap();
|
||||
let mut content = vec![];
|
||||
reader.read_to_end(&mut content).unwrap();
|
||||
content
|
||||
|
Loading…
x
Reference in New Issue
Block a user