1use crate::client::{Client, HglibError, Runner};
6use crate::{runcommand, MkArg};
7
8pub struct Arg<'a> {
9 pub rev: &'a str,
10 pub force: bool,
11 pub tool: &'a str,
12}
13
14impl<'a> Default for Arg<'a> {
15 fn default() -> Self {
16 Self {
17 rev: "",
18 force: false,
19 tool: "",
20 }
21 }
22}
23
24impl<'a> Arg<'a> {
25 fn run(&self, client: &mut Client) -> Result<(Vec<u8>, i32), HglibError> {
26 runcommand!(
27 client,
28 "merge",
29 &[""],
30 "-r",
31 self.rev,
32 "-f",
33 self.force,
34 "-t",
35 self.tool,
36 "-y",
37 true
38 )
39 }
40}
41
42impl Client {
43 pub fn merge(&mut self, x: Arg) -> Result<(), HglibError> {
44 x.run(self)?;
45 Ok(())
46 }
47}