F6YAQWVDXG6UZBJPJDTIJBQDBMXVMT7P6INK6GPJ5SR3BDDRX4EQC
337EO2TURD5ELICUPPC5ZX6ZEOQXT4PVWTE7WKI7VUQPPCUDLFAQC
SOTD66FO7FA67P4DEOYPKURE45J45PTFVT66OF54SUYJYUBAADJQC
G2CHQAOPRFFDCYVNDXMTB5Y5J2FBRREJPMUAJJTVQDSZE3VFLP3QC
XERTHGSY3OMO7CBVVHIXI7LH6JY4AOS7BA6WQP22JBO2NDWGBH4QC
NSE6BLWA372T3TYEVMOKWWD725NRYQNLJGWEVXAIQ3EP6R2YNQ7QC
HZV5P57YJPTWI34HC5KDGZNOREGME2PBKT3W24DSYFE72UAAYRJQC
PL4TK55O7SBKFBNDO3WIRYLU5LBHRJV7BCD7SMBIVKEP2SCJGFFAC
4RPYR65C4IEKV3INJ67NN4DOH37UDY45EE7VGF55ZKDFH75LXLJAC
IQY5LHEN34KNUOZ75S5V5LZDZQCZ65LV7YXXRYJMIE6WSXMKFMXAC
NCRTU7M46QRJ4VHTNJQ6OFHCGX5M2GGTUY2J5UW3RWEQSAYOGVPAC
6ECOC7L5ZARQZIDELJODXFZQK5JJKRS5C6IVC3S7V2WDBTOBX3ZAC
}
});
ui.on_request_change_delta({
let ui_handle = ui.as_weak();
move |change_hash: SharedString| {
let change_hash = change_hash.as_str();
let ui = ui_handle.unwrap();
let exe_path_string = ui.get_exe_path();
let exe_path = Path::new(exe_path_string.as_str());
let repo_path_string = ui.get_repo_path();
let repo_path = Path::new(repo_path_string.as_str());
let change_output = cmds::change(exe_path, repo_path, change_hash);
let delta = match change_output {
Ok(delta) => delta,
Err(e) => {
println!("{:?}", e);
return;
}
};
ui.set_delta((&String::from(delta)[..]).into());
}
pub fn change(exe: &std::path::Path, repo: &std::path::Path, hash: &str) -> Result<String, Error> {
let mut cmd = Command::new(exe);
let cmd = cmd
.arg("change")
.arg("--no-prompt")
.arg("--repository")
.arg(repo)
.arg(hash);
let output = cmd.output()?;
check_exit_status(cmd, output.status)?;
// TODO this will fail when diffing binary data
Ok(String::from_utf8(output.stdout)?)