Skip to content

Commit 3c70b94

Browse files
authored
feat: deno upgrade --rc (denoland#24905)
This commit adds the "--rc" flag to "deno upgrade" subcommand. This flag allows to upgrade to the latest "release candidate" release. The update checker was also updated to take this into account.
1 parent 76f4f20 commit 3c70b94

File tree

4 files changed

+508
-118
lines changed

4 files changed

+508
-118
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "deno"
5-
version = "1.45.5"
5+
version = "1.46.0-rc.0"
66
authors.workspace = true
77
default-run = "deno"
88
edition.workspace = true

cli/args/flags.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ pub struct TestFlags {
398398
pub struct UpgradeFlags {
399399
pub dry_run: bool,
400400
pub force: bool,
401+
pub release_candidate: bool,
401402
pub canary: bool,
402403
pub version: Option<String>,
403404
pub output: Option<String>,
@@ -2908,6 +2909,13 @@ update to a different location, use the --output flag:
29082909
.help("Upgrade to canary builds")
29092910
.action(ArgAction::SetTrue),
29102911
)
2912+
.arg(
2913+
Arg::new("release-candidate")
2914+
.long("rc")
2915+
.help("Upgrade to a release candidate")
2916+
.conflicts_with_all(["canary", "version"])
2917+
.action(ArgAction::SetTrue),
2918+
)
29112919
.arg(ca_file_arg())
29122920
})
29132921
}
@@ -4568,11 +4576,13 @@ fn upgrade_parse(flags: &mut Flags, matches: &mut ArgMatches) {
45684576
let dry_run = matches.get_flag("dry-run");
45694577
let force = matches.get_flag("force");
45704578
let canary = matches.get_flag("canary");
4579+
let release_candidate = matches.get_flag("release-candidate");
45714580
let version = matches.remove_one::<String>("version");
45724581
let output = matches.remove_one::<String>("output");
45734582
flags.subcommand = DenoSubcommand::Upgrade(UpgradeFlags {
45744583
dry_run,
45754584
force,
4585+
release_candidate,
45764586
canary,
45774587
version,
45784588
output,
@@ -5057,6 +5067,7 @@ mod tests {
50575067
force: true,
50585068
dry_run: true,
50595069
canary: false,
5070+
release_candidate: false,
50605071
version: None,
50615072
output: None,
50625073
}),
@@ -5075,6 +5086,7 @@ mod tests {
50755086
force: false,
50765087
dry_run: false,
50775088
canary: false,
5089+
release_candidate: false,
50785090
version: None,
50795091
output: Some(String::from("example.txt")),
50805092
}),
@@ -9039,6 +9051,7 @@ mod tests {
90399051
force: false,
90409052
dry_run: false,
90419053
canary: false,
9054+
release_candidate: false,
90429055
version: None,
90439056
output: None,
90449057
}),
@@ -9048,6 +9061,31 @@ mod tests {
90489061
);
90499062
}
90509063

9064+
#[test]
9065+
fn upgrade_release_candidate() {
9066+
let r = flags_from_vec(svec!["deno", "upgrade", "--rc"]);
9067+
assert_eq!(
9068+
r.unwrap(),
9069+
Flags {
9070+
subcommand: DenoSubcommand::Upgrade(UpgradeFlags {
9071+
force: false,
9072+
dry_run: false,
9073+
canary: false,
9074+
release_candidate: true,
9075+
version: None,
9076+
output: None,
9077+
}),
9078+
..Flags::default()
9079+
}
9080+
);
9081+
9082+
let r = flags_from_vec(svec!["deno", "upgrade", "--rc", "--canary"]);
9083+
assert!(r.is_err());
9084+
9085+
let r = flags_from_vec(svec!["deno", "upgrade", "--rc", "--version"]);
9086+
assert!(r.is_err());
9087+
}
9088+
90519089
#[test]
90529090
fn cache_with_cafile() {
90539091
let r = flags_from_vec(svec![

0 commit comments

Comments
 (0)