pijul_org / pijul

Normalize "about" capitalization

By remexre on August 14, 2018
This patch is not signed.
6C8o2Q3KaC8LwCtotyqh4w5Fcds7vGGBVYcq4pF214MAL6NQAv6qzgkC3Yd5Bqxdnzow4qVXyJPfmRv83Sfowmwo
This patch is in the following branches:
latest
master
testing
18
19

20
21
pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("pull")
        .about("pull from a remote repository")
        .about("Pull from a remote repository")
        .arg(
70
71

72
73
    return record_args(
        SubCommand::with_name("record")
            .about("record changes in the repository")
            .about("Record changes in the repository")
            .arg(
7
8

9
10
11
pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("generate-completions")
        .about("generate shell completions for pijul to stdout")
        .setting(AppSettings::Hidden)
        .about("Generate shell completions for pijul to stdout")
        .group(
7
8

9
10
pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("remove")
        .about("remove file from the repository")
        .about("Remove file from the repository")
        .arg(

1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
20
21
        .about("Create a patch (a \"tag\") with no changes, and all currently applied patches as dependencies"))
use super::default_explain;
use super::record;
use chrono;
use clap::{ArgMatches, SubCommand};
use commands::hooks::run_hook;
use commands::record::{decide_authors, decide_patch_message, record_args};
use commands::{BasicOptions, StaticSubcommand};
use libpijul::Hash;
use error::Error;
use libpijul::patch::PatchFlags;
use libpijul::Hash;
use meta::{load_signing_key, Global, Meta};
use std::collections::HashSet;
use std::mem::drop;

pub fn invocation() -> StaticSubcommand {
    record_args(
        SubCommand::with_name("tag").about(
            "Create a tag, i.e. an empty patch with all patches on the branch as dependencies",
        ),
    )
}

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86


89


92
93

95
96
97
98
99
100
101
102
103
104
105
106
107
108
use libpijul::DEFAULT_BRANCH;
use clap::{Arg, ArgMatches, SubCommand};

use super::ask;
use commands::{default_explain, BasicOptions, StaticSubcommand};
use error::Error;
use libpijul::RepoPath;
use meta::{Meta, Repository, DEFAULT_REMOTE};
use std::env::current_dir;
use std::path::Path;

pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("push")
        .about("push to a remote repository")
        .about("Push to a remote repository")
        .arg(
            Arg::with_name("repository")
                .long("repository")
                .help("Repository to list.")
                .takes_value(true),
        )
        .arg(Arg::with_name("remote").help("Repository to push to."))
        .arg(
            Arg::with_name("local_branch")
                .long("from-branch")
                .help("The branch to push from")
                .takes_value(true),
        )
        .arg(
            Arg::with_name("remote_branch")
                .long("to-branch")
                .help("The branch to push into. Defaults to the current branch.")
                .takes_value(true),
        )
        .arg(
            Arg::with_name("all")
                .short("a")
                .long("all")
                .help("Answer 'y' to all questions.")
                .takes_value(false),
        )
        .arg(
            Arg::with_name("force")
                .long("force")
                .help("Force the push even if non fast-forward."),
        )
        .arg(
            Arg::with_name("set-default")
                .long("set-default")
                .help("Used with --set-remote, sets this remote as the default push target."),
        )
        .arg(
            Arg::with_name("set-remote")
                .long("set-remote")
                .help("Set the name of this remote")
                .takes_value(true),
        )
        .arg(
            Arg::with_name("remote_path")
                .long("path")
                .help("Only pull patches relative to that patch.")
                .takes_value(true)
                .multiple(true),
        )
        .arg(
            Arg::with_name("port")
                .short("p")
                .long("port")
                .help("Port of the remote ssh server.")
                .takes_value(true)
                .validator(|val| {
                    let x: Result<u16, _> = val.parse();
                    match x {
                        Ok(_) => Ok(()),
                        Err(_) => Err(val),
                    }
                }),
        );
}

#[derive(Debug)]
pub struct Params<'a> {
    pub remote_id: Option<&'a str>,
    pub set_remote: Option<&'a str>,
    pub yes_to_all: bool,
    pub set_default: bool,
    pub port: Option<u16>,
    pub local_branch: Option<&'a str>,

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    pub remote_path: Vec<&'a str>,

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

================================
    pub remote_path: Vec<RepoPath<&'a Path>>,
    pub remote_branch: Option<&'a str>,

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    pub force: bool,
}

pub fn parse_args<'a>(args: &'a ArgMatches) -> Params<'a> {
    Params {
        remote_id: args.value_of("remote"),
        set_remote: args.value_of("set-remote"),
        yes_to_all: args.is_present("all"),
        set_default: args.is_present("set-default"),
        port: args.value_of("port").and_then(|x| Some(x.parse().unwrap())),
        local_branch: args.value_of("local_branch"),
        remote_branch: args.value_of("remote_branch"),
        remote_path: args
            .values_of("remote_path")
7
8

9
10
pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("add")
        .about("add a file to the repository")
        .about("Add a file to the repository")
        .arg(
11
12

13
14
pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("sign")
        .about("add patch signatures")
        .about("Add patch signatures")
        .arg(
5
6

7
8
pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("ls")
        .about("list tracked files")
        .about("List tracked files")
        .arg(
11
12

13
14
pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("diff")
        .about("show what would be recorded if record were called")
        .about("Show what would be recorded if record were called")
        .arg(

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
                return Err(ErrorKind::FileNotInRepository(rec.to_string()).into());
use super::{validate_base58, BasicOptions};
use clap::{Arg, ArgMatches, SubCommand};
use commands::{default_explain, StaticSubcommand};
use error::Error;
use libpijul::patch::Patch;
use libpijul::{apply_resize, apply_resize_no_output, Hash, RepoPath};
use std::collections::HashSet;
use std::fs::File;
use std::io::{stdin, Read, Write};
use std::path::Path;

pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("apply")
        .about("apply a patch")
        .about("Apply a patch")
        .arg(

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

101
102
use libpijul::DEFAULT_BRANCH;
use clap::{Arg, ArgMatches, SubCommand};
use commands::remote::{parse_remote, Remote};
use commands::{assert_no_containing_repo, create_repo, default_explain, StaticSubcommand};
use error::Error;
use libpijul::fs_representation::{RepoPath, RepoRoot};
use libpijul::{Hash, DEFAULT_BRANCH};
use regex::Regex;
use std::io::{stderr, Write};
use std::path::Path;
use std::process::exit;
use tempfile::tempdir_in;

pub fn invocation() -> StaticSubcommand {
    return SubCommand::with_name("clone")
        .about("clone a remote branch")
        .about("Clone a remote branch")
        .arg(
            Arg::with_name("from")
                .help("Repository to clone.")
                .required(true),
        )
        .arg(
            Arg::with_name("from_branch")
                .long("from-branch")
                .help("The branch to pull from")
                .takes_value(true),
        )
        .arg(
            Arg::with_name("to_branch")
                .long("to-branch")
                .help("The branch to pull into")
                .takes_value(true),
        )
        .arg(Arg::with_name("to").help("Target."))
        .arg(
            Arg::with_name("from_path")
                .long("path")
                .help("Only pull patches relative to that path.")
                .takes_value(true),
        )
        .arg(
            Arg::with_name("patch")
                .long("patch")
                .help("Pull a patch and its dependencies.")
                .takes_value(true)
                .multiple(true),
        )
        .arg(
            Arg::with_name("port")
                .short("p")
                .long("port")
                .help("Port of the remote ssh server.")
                .takes_value(true)
                .validator(|val| {
                    let x: Result<u16, _> = val.parse();
                    match x {
                        Ok(_) => Ok(()),
                        Err(_) => Err(val),
                    }
                }),
        );
}
#[derive(Debug)]
pub struct Params<'a> {
    pub from: Remote<'a>,
    pub from_branch: &'a str,
    pub from_path: Vec<RepoPath<&'a Path>>,
    pub to: Remote<'a>,
    pub to_branch: &'a str,
}

pub fn parse_args<'a>(args: &'a ArgMatches) -> Params<'a> {
    // At least one must not use its "port" argument
    let from = parse_remote(
        args.value_of("from").unwrap(),
        args.value_of("port").and_then(|x| Some(x.parse().unwrap())),
        None,
        None,
    );
    let to = if let Some(to) = args.value_of("to") {
        parse_remote(
            to,
            args.value_of("port").and_then(|x| Some(x.parse().unwrap())),
            None,
            None,
        )
    } else {
        let basename = Regex::new(r"([^/:]+)").unwrap();
        let from = args.value_of("from").unwrap();
        if let Some(to) = basename.captures_iter(from).last().and_then(|to| to.get(1)) {
            parse_remote(
                to.as_str(),
                args.value_of("port").and_then(|x| Some(x.parse().unwrap())),
                None,
                None,
            )
        } else {
            panic!("Could not parse target")
        }
    };
    let from_branch = args.value_of("from_branch").unwrap_or(DEFAULT_BRANCH);
    let from_path = args.values_of("from_path")
    let from_path = args
        .values_of("from_path")