1use super::common;
6use crate::client::{Client, HglibError, Runner};
7use crate::{runcommand, MkArg};
8
9pub struct Arg {}
10
11impl Default for Arg {
12 fn default() -> Self {
13 Self {}
14 }
15}
16
17impl Arg {
18 fn run(&self, client: &mut Client) -> Result<(Vec<u8>, i32), HglibError> {
19 runcommand!(
20 client,
21 "tip",
22 &[""],
23 "--template",
24 common::CHANGESETS_TEMPLATE
25 )
26 }
27}
28
29impl Client {
30 pub fn tip(&mut self, x: Arg) -> Result<common::Revision, HglibError> {
31 let (data, _) = x.run(self)?;
32 let mut rev = common::parserevs(data)?;
33 let rev = rev.pop().unwrap();
34
35 Ok(rev)
36 }
37}