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
103
104
105
use std::path::PathBuf;
use structopt::{self, StructOpt};
#[derive(Debug, StructOpt)]
pub enum Cli {
/// Exports single Mercurial repository to Git fast-import compatible format
#[structopt(name = "single")]
Single {
/// The Mercurial repo for import to git
#[structopt(parse(from_os_str))]
hg_repo: PathBuf,
/// The Git repo to import to. Creates repo if it does not exist. Otherwise saved state must exist.
#[structopt(parse(from_os_str))]
git_repo: Option<PathBuf>,
/// Repository configuration in toml format.
#[structopt(parse(from_os_str), long, short)]
config: Option<PathBuf>,
/// Limit high revision to import.
#[structopt(name = "limit-high", long)]
limit_high: Option<usize>,
#[structopt(flatten)]
common: Common,
},
/// Exports multiple Mercurial repositories to single Git repo in fast-import compatible format
#[structopt(name = "multi")]
Multi {
/// Repositories configuration in toml format.
#[structopt(parse(from_os_str), long, short)]
config: PathBuf,
#[structopt(flatten)]
common: Common,
},
/// Rebuilds saved state of repo
#[structopt(name = "build-marks")]
BuildMarks {
#[structopt(flatten)]
args: BuildMarksArgs,
},
/// Generates completion scripts for your shell
#[structopt(
name = "completions",
setting = structopt::clap::AppSettings::Hidden
)]
Completions {
/// The shell to generate the script for
#[structopt(possible_values = &["bash", "fish", "zsh"])]
shell: structopt::clap::Shell,
},
}
#[derive(Debug, StructOpt)]
pub struct BuildMarksArgs {
/// Authors remapping in toml format.
#[structopt(parse(from_os_str), long, short)]
pub authors: Option<PathBuf>,
/// The Mercurial repo which was imported to git.
#[structopt(parse(from_os_str))]
pub hg_repo: PathBuf,
/// The Git repo to save state to. Existing saved state would be updated with actual state.
#[structopt(parse(from_os_str))]
pub git_repo: PathBuf,
/// Offset for git fast-import marks in Git repository. Optional, default is 0.
#[structopt(long, short)]
pub offset: Option<usize>,
/// Do not backup old marks.
#[structopt(name = "no-backup", long)]
pub no_backup: bool,
}
#[derive(Debug, StructOpt)]
pub struct Common {
/// Authors remapping in toml format.
#[structopt(parse(from_os_str), long, short)]
pub authors: Option<PathBuf>,
/// Do not clean closed Mercurial branches.
#[structopt(name = "no-clean-closed-branches", long)]
pub no_clean_closed_branches: bool,
/// Compares resulting Git repo with Mercurial.
#[structopt(long)]
pub verify: bool,
/// Git maximum number of branches to maintain active at once.
#[structopt(name = "git-active-branches", long)]
pub git_active_branches: Option<usize>,
/// Log file. If present - additional log info would be printed to this file.
#[structopt(parse(from_os_str), long)]
pub log: Option<PathBuf>,
/// Recreate Git repo before import if it exists.
#[structopt(long)]
pub clean: bool,
/// Produce minimal output only if new revisions loaded or error happened.
#[structopt(long)]
pub cron: bool,
/// Push target Git repository after successful import.
#[structopt(name = "target-push", long)]
pub target_push: bool,
/// Pull target Git repository before push.
#[structopt(name = "target-pull", long)]
pub target_pull: bool,
/// Pull source Mercurial repository before import.
#[structopt(name = "source-pull", long)]
pub source_pull: bool,
/// Fix wrong Mercurial branch names (not compatible with git ref format).
#[structopt(name = "fix-wrong-branch-names", long)]
pub fix_wrong_branchname: bool,
}