##// END OF EJS Templates
rhg: add a limited `rhg root` subcommand...
Antoine Cezar -
r45571:3707f6e7 default draft
parent child Browse files
Show More
@@ -0,0 +1,16 b''
1 $ rhg unimplemented-command
2 [252]
3 $ rhg root
4 abort: no repository found in '$TESTTMP' (.hg not found)!
5 [255]
6 $ hg init repository
7 $ cd repository
8 $ rhg root
9 $TESTTMP/repository
10 $ rhg root > /dev/full
11 abort: No space left on device (os error 28)
12 [255]
13 $ rm -rf $PWD
14 $ rhg root
15 abort: error getting current working directory: $ENOENT$
16 [255]
@@ -58,7 +58,7 b' dependencies = ['
58
58
59 [[package]]
59 [[package]]
60 name = "clap"
60 name = "clap"
61 version = "2.33.0"
61 version = "2.33.1"
62 source = "registry+https://github.com/rust-lang/crates.io-index"
62 source = "registry+https://github.com/rust-lang/crates.io-index"
63 dependencies = [
63 dependencies = [
64 "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
64 "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -203,7 +203,7 b' name = "hg-core"'
203 version = "0.1.0"
203 version = "0.1.0"
204 dependencies = [
204 dependencies = [
205 "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
205 "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
206 "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
206 "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)",
207 "crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
207 "crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
208 "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
208 "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
209 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
209 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -490,6 +490,7 b' dependencies = ['
490 name = "rhg"
490 name = "rhg"
491 version = "0.1.0"
491 version = "0.1.0"
492 dependencies = [
492 dependencies = [
493 "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)",
493 "hg-core 0.1.0",
494 "hg-core 0.1.0",
494 ]
495 ]
495
496
@@ -657,7 +658,7 b' source = "registry+https://github.com/ru'
657 "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
658 "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
658 "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
659 "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
659 "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2"
660 "checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2"
660 "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
661 "checksum clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129"
661 "checksum colored 1.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59"
662 "checksum colored 1.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59"
662 "checksum cpython 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaf3847ab963e40c4f6dd8d6be279bdf74007ae2413786a0dcbb28c52139a95"
663 "checksum cpython 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaf3847ab963e40c4f6dd8d6be279bdf74007ae2413786a0dcbb28c52139a95"
663 "checksum crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e"
664 "checksum crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e"
@@ -6,4 +6,5 b' edition = "2018"'
6
6
7 [dependencies]
7 [dependencies]
8 hg-core = { path = "../hg-core"}
8 hg-core = { path = "../hg-core"}
9 clap = "2.33.1"
9
10
@@ -1,8 +1,42 b''
1 use clap::App;
2 use clap::AppSettings;
3 use clap::SubCommand;
4
1 mod commands;
5 mod commands;
2 mod error;
6 mod error;
3 mod exitcode;
7 mod exitcode;
4 mod ui;
8 mod ui;
9 use commands::Command;
5
10
6 fn main() {
11 fn main() {
7 std::process::exit(exitcode::UNIMPLEMENTED_COMMAND)
12 let mut app = App::new("rhg")
13 .setting(AppSettings::AllowInvalidUtf8)
14 .setting(AppSettings::SubcommandRequired)
15 .setting(AppSettings::VersionlessSubcommands)
16 .version("0.0.1")
17 .subcommand(
18 SubCommand::with_name("root").about(commands::root::HELP_TEXT),
19 );
20
21 let matches = app.clone().get_matches_safe().unwrap_or_else(|_| {
22 std::process::exit(exitcode::UNIMPLEMENTED_COMMAND)
23 });
24
25 let command_result = match matches.subcommand_name() {
26 Some(name) => match name {
27 "root" => commands::root::RootCommand::new().run(),
28 _ => std::process::exit(exitcode::UNIMPLEMENTED_COMMAND),
29 },
30 _ => {
31 match app.print_help() {
32 Ok(_) => std::process::exit(exitcode::OK),
33 Err(_) => std::process::exit(exitcode::ABORT),
34 };
35 }
36 };
37
38 match command_result {
39 Ok(_) => std::process::exit(exitcode::OK),
40 Err(e) => e.exit(),
41 }
8 }
42 }
@@ -927,6 +927,7 b' class Test(unittest.TestCase):'
927 extraconfigopts=None,
927 extraconfigopts=None,
928 shell=None,
928 shell=None,
929 hgcommand=None,
929 hgcommand=None,
930 rhgcommand=None,
930 slowtimeout=None,
931 slowtimeout=None,
931 usechg=False,
932 usechg=False,
932 chgdebug=False,
933 chgdebug=False,
@@ -984,6 +985,9 b' class Test(unittest.TestCase):'
984 self._extraconfigopts = extraconfigopts or []
985 self._extraconfigopts = extraconfigopts or []
985 self._shell = _sys2bytes(shell)
986 self._shell = _sys2bytes(shell)
986 self._hgcommand = hgcommand or b'hg'
987 self._hgcommand = hgcommand or b'hg'
988 self._rhgcommand = rhgcommand or _sys2bytes(
989 os.path.abspath('./rust/target/release/rhg')
990 )
987 self._usechg = usechg
991 self._usechg = usechg
988 self._chgdebug = chgdebug
992 self._chgdebug = chgdebug
989 self._useipv6 = useipv6
993 self._useipv6 = useipv6
@@ -1754,6 +1758,8 b' class TTest(Test):'
1754 script.append(b'set -x\n')
1758 script.append(b'set -x\n')
1755 if self._hgcommand != b'hg':
1759 if self._hgcommand != b'hg':
1756 script.append(b'alias hg="%s"\n' % self._hgcommand)
1760 script.append(b'alias hg="%s"\n' % self._hgcommand)
1761 if self._rhgcommand != b'rhg':
1762 script.append(b'alias rhg="%s"\n' % self._rhgcommand)
1757 if os.getenv('MSYSTEM'):
1763 if os.getenv('MSYSTEM'):
1758 script.append(b'alias pwd="pwd -W"\n')
1764 script.append(b'alias pwd="pwd -W"\n')
1759
1765
@@ -2950,6 +2956,7 b' class TestRunner(object):'
2950 self._coveragefile = None
2956 self._coveragefile = None
2951 self._createdfiles = []
2957 self._createdfiles = []
2952 self._hgcommand = None
2958 self._hgcommand = None
2959 self._rhgcommand = None
2953 self._hgpath = None
2960 self._hgpath = None
2954 self._portoffset = 0
2961 self._portoffset = 0
2955 self._ports = {}
2962 self._ports = {}
General Comments 0
You need to be logged in to leave comments. Login now