Compare commits

...

7 Commits

Author SHA1 Message Date
Ilya Grigoriev
0c934f463d
Merge 8c11a8ea3e into 2f9561a4b8 2024-10-03 09:17:15 +00:00
Samuel Tardieu
2f9561a4b8 CI: add a last name to the list of spelling exceptions 2024-10-03 00:21:56 +02:00
Samuel Tardieu
acdc42fd9f doc: add comment to explain the syntax of folded examples 2024-10-02 19:37:18 +02:00
Martin von Zweigbergk
67c2ae0a9e release: release version 0.22.0 2024-10-02 10:25:20 -07:00
dependabot[bot]
d1b2e7ea82 cargo: bump the cargo-dependencies group with 3 updates
Bumps the cargo-dependencies group with 3 updates: [clap](https://github.com/clap-rs/clap), [clap_complete](https://github.com/clap-rs/clap) and [indexmap](https://github.com/indexmap-rs/indexmap).


Updates `clap` from 4.5.18 to 4.5.19
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.18...clap_complete-v4.5.19)

Updates `clap_complete` from 4.5.29 to 4.5.30
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.29...clap_complete-v4.5.30)

Updates `indexmap` from 2.5.0 to 2.6.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.5.0...2.6.0)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-dependencies
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-02 16:17:46 +00:00
Lukas Wirth
72c5bbb4e6 Be more specific when warning the user about missing identity configs
Check if only the email or the name are missing in the config and specifically name the missing one, instead of always defaulting to potentially both missing.
2024-10-02 18:10:46 +02:00
Ilya Grigoriev
8c11a8ea3e cli new: Allow --before/--after without a value to default to @
Without this, I find it a bit jarring that `jj new` works but `jj new
--before` does not. By contrast, since `jj rebase` does not currently
work, I don't think `jj rebase --before` should either.

Note that `jj new --before @ another_revision` is invalid, so `jj new
--before another_revision` can only be parsed correctly in one way. I am
slightly concerned that `clap` might forbids this in the future even in
the cases where a human can tell there is no ambiguity, but I'm hoping
for the best.
2024-09-29 17:55:16 -07:00
10 changed files with 232 additions and 54 deletions

View File

@ -19,4 +19,4 @@ jobs:
check_filenames: true
check_hidden: true
skip: ./target,./.jj,*.lock
ignore_words_list: crate,NotIn
ignore_words_list: crate,NotIn,Wirth

View File

@ -11,7 +11,19 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Breaking changes
* Fixing #4239 means the ordering of some messages have changed.
### Deprecations
### New features
### Fixed bugs
## [0.22.0] - 2024-10-02
### Breaking changes
* Fixing [#4239](https://github.com/martinvonz/jj/issues/4239) means the
ordering of some messages have changed.
* Invalid `ui.graph.style` configuration is now an error.
@ -20,9 +32,6 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Deprecations
* `jj obslog` is now called `jj evolution-log`/`jj evolog`. `jj obslog` remains
as an alias.
* `jj branch` has been deprecated in favor of `jj bookmark`.
**Rationale:** Jujutsu's branches don't behave like Git branches, which a
@ -31,6 +40,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
that describes them better, and they also behave similar to Mercurial's
bookmarks.
* `jj obslog` is now called `jj evolution-log`/`jj evolog`. `jj obslog` remains
as an alias.
* `jj unsquash` has been deprecated in favor of `jj squash` and
`jj diffedit --restore-descendants`.
@ -95,7 +107,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
to keeping all changes into the first commit while keeping the current commit
description for the second commit (the newly created empty one).
* Color author and committer names yellow
* Author and committer names are now yellow by default.
* Without a specified revision, `jj new --insert-before` is now equivalent to
`jj new --insert-before @`; same for `--insert-after`.
### Fixed bugs
@ -111,6 +126,28 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
`present(@)` evaluates to `none()` if the current workspace has no
working-copy commit.
### Contributors
Thanks to the people who made this release happen!
* Austin Seipp (@thoughtpolice)
* Danny Hooper (@hooper)
* Emily Shaffer (@nasamuffin)
* Essien Ita Essien (@essiene)
* Ethan Brierley (@eopb)
* Ilya Grigoriev (@ilyagr)
* Kevin Liao (@kevincliao)
* Lukas Wirth (@Veykril)
* Martin von Zweigbergk (@martinvonz)
* Mateusz Mikuła (@mati865)
* mlcui (@mlcui-corp)
* Philip Metzger (@PhilipMetzger)
* Samuel Tardieu (@samueltardieu)
* Stephen Jennings (@jennings)
* Tyler Goffinet (@qubitz)
* Vamsi Avula (@avamsi)
* Yuya Nishihara (@yuja)
## [0.21.0] - 2024-09-04
### Breaking changes

50
Cargo.lock generated
View File

@ -357,9 +357,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.18"
version = "4.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3"
checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615"
dependencies = [
"clap_builder",
"clap_derive",
@ -376,9 +376,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.18"
version = "4.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b"
checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b"
dependencies = [
"anstream",
"anstyle",
@ -389,9 +389,9 @@ dependencies = [
[[package]]
name = "clap_complete"
version = "4.5.29"
version = "4.5.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8937760c3f4c60871870b8c3ee5f9b30771f792a7045c48bcbba999d7d6b3b8e"
checksum = "bb31f1f3041ef3636e425b09e588911b72fc5513b2428b5b7df130f497e6a728"
dependencies = [
"clap",
]
@ -628,7 +628,7 @@ checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
dependencies = [
"cfg-if",
"crossbeam-utils",
"hashbrown",
"hashbrown 0.14.5",
"lock_api",
"once_cell",
"parking_lot_core",
@ -890,7 +890,7 @@ dependencies = [
[[package]]
name = "gen-protos"
version = "0.21.0"
version = "0.22.0"
dependencies = [
"prost-build",
]
@ -1222,7 +1222,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ddf80e16f3c19ac06ce415a38b8591993d3f73aede049cb561becb5b3a8e242"
dependencies = [
"gix-hash",
"hashbrown",
"hashbrown 0.14.5",
"parking_lot",
]
@ -1258,7 +1258,7 @@ dependencies = [
"gix-traverse",
"gix-utils",
"gix-validate",
"hashbrown",
"hashbrown 0.14.5",
"itoa",
"libc",
"memmap2",
@ -1607,6 +1607,12 @@ dependencies = [
"allocator-api2",
]
[[package]]
name = "hashbrown"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
[[package]]
name = "heck"
version = "0.5.0"
@ -1696,17 +1702,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc9da1a252bd44cd341657203722352efc9bc0c847d06ea6d2dc1cd1135e0a01"
dependencies = [
"ahash",
"hashbrown",
"hashbrown 0.14.5",
]
[[package]]
name = "indexmap"
version = "2.5.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
dependencies = [
"equivalent",
"hashbrown",
"hashbrown 0.15.0",
]
[[package]]
@ -1814,7 +1820,7 @@ dependencies = [
[[package]]
name = "jj-cli"
version = "0.21.0"
version = "0.22.0"
dependencies = [
"anyhow",
"assert_cmd",
@ -1871,7 +1877,7 @@ dependencies = [
[[package]]
name = "jj-lib"
version = "0.21.0"
version = "0.22.0"
dependencies = [
"assert_matches",
"async-trait",
@ -1931,7 +1937,7 @@ dependencies = [
[[package]]
name = "jj-lib-proc-macros"
version = "0.21.0"
version = "0.22.0"
dependencies = [
"proc-macro2",
"quote",
@ -2062,7 +2068,7 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904"
dependencies = [
"hashbrown",
"hashbrown 0.14.5",
]
[[package]]
@ -3050,12 +3056,12 @@ dependencies = [
[[package]]
name = "terminal_size"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7"
checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef"
dependencies = [
"rustix",
"windows-sys 0.48.0",
"windows-sys 0.59.0",
]
[[package]]
@ -3099,7 +3105,7 @@ dependencies = [
[[package]]
name = "testutils"
version = "0.21.0"
version = "0.22.0"
dependencies = [
"async-trait",
"config",

View File

@ -5,7 +5,7 @@ resolver = "2"
members = ["cli", "lib", "lib/gen-protos", "lib/proc-macros", "lib/testutils"]
[workspace.package]
version = "0.21.0"
version = "0.22.0"
license = "Apache-2.0"
rust-version = "1.76" # NOTE: remember to update CI, contributing.md, changelog.md, and flake.nix
edition = "2021"
@ -24,13 +24,13 @@ async-trait = "0.1.83"
backoff = "0.4.0"
blake2 = "0.10.6"
bstr = "1.10.0"
clap = { version = "4.5.18", features = [
clap = { version = "4.5.19", features = [
"derive",
"deprecated",
"wrap_help",
"string",
] }
clap_complete = "4.5.29"
clap_complete = "4.5.30"
clap_complete_nushell = "4.5.3"
clap-markdown = "0.1.4"
clap_mangen = "0.2.10"
@ -68,7 +68,7 @@ gix-filter = "0.13.0"
glob = "0.3.1"
hex = "0.4.3"
ignore = "0.4.23"
indexmap = "2.5.0"
indexmap = "2.6.0"
indoc = "2.0.4"
insta = { version = "1.40.0", features = ["filters"] }
itertools = "0.13.0"
@ -128,8 +128,8 @@ zstd = "0.12.4"
# put all inter-workspace libraries, i.e. those that use 'path = ...' here in
# their own (alphabetically sorted) block
jj-lib = { path = "lib", version = "0.21.0" }
jj-lib-proc-macros = { path = "lib/proc-macros", version = "0.21.0" }
jj-lib = { path = "lib", version = "0.22.0" }
jj-lib-proc-macros = { path = "lib/proc-macros", version = "0.22.0" }
testutils = { path = "lib/testutils" }
# Insta suggests compiling these packages in opt mode for faster testing.

View File

@ -1771,13 +1771,31 @@ See https://martinvonz.github.io/jj/latest/working-copy/#stale-working-copy \
self.report_repo_changes(ui, &old_repo)?;
let settings = self.settings();
if settings.user_name().is_empty() || settings.user_email().is_empty() {
let missing_user_name = settings.user_name().is_empty();
let missing_user_mail = settings.user_email().is_empty();
if missing_user_name || missing_user_mail {
let mut writer = ui.warning_default();
let not_configured_msg = match (missing_user_name, missing_user_mail) {
(true, true) => "Name and email not configured.",
(true, false) => "Name not configured.",
(false, true) => "Email not configured.",
_ => unreachable!(),
};
write!(writer, "{not_configured_msg} ")?;
writeln!(
ui.warning_default(),
r#"Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run:
jj config set --user user.name "Some One"
jj config set --user user.email "someone@example.com""#
writer,
"Until configured, your commits will be created with the empty identity, and \
can't be pushed to remotes. To configure, run:",
)?;
if missing_user_name {
writeln!(writer, r#" jj config set --user user.name "Some One""#)?;
}
if missing_user_mail {
writeln!(
writer,
r#" jj config set --user user.email "someone@example.com""#
)?;
}
}
Ok(())
}

View File

@ -63,20 +63,28 @@ pub(crate) struct NewArgs {
/// No-op flag to pair with --no-edit
#[arg(long, hide = true)]
_edit: bool,
/// Insert the new change after the given commit(s)
/// Insert the new change after the given commit(s), or after `@` if no
/// commit is specified
#[arg(
long,
short = 'A',
visible_alias = "after",
conflicts_with = "revisions"
conflicts_with = "revisions",
default_missing_value = "@",
// At most one argument per --after, does not restrict repeating --after
num_args=0..=1,
)]
insert_after: Vec<RevisionArg>,
/// Insert the new change before the given commit(s)
/// Insert the new change before the given commit(s), or before `@` if no
/// commit is specified
#[arg(
long,
short = 'B',
visible_alias = "before",
conflicts_with = "revisions"
conflicts_with = "revisions",
default_missing_value = "@",
// At most one argument per --before, does not restrict repeating --before
num_args=0..=1,
)]
insert_before: Vec<RevisionArg>,
}

View File

@ -1270,8 +1270,8 @@ For more information, see https://martinvonz.github.io/jj/latest/working-copy/.
* `-m`, `--message <MESSAGE>` — The change description to use
* `--no-edit` — Do not edit the newly created change
* `-A`, `--insert-after <INSERT_AFTER>` — Insert the new change after the given commit(s)
* `-B`, `--insert-before <INSERT_BEFORE>` — Insert the new change before the given commit(s)
* `-A`, `--insert-after <INSERT_AFTER>` — Insert the new change after the given commit(s), or after `@` if no commit is specified
* `-B`, `--insert-before <INSERT_BEFORE>` — Insert the new change before the given commit(s), or before `@` if no commit is specified

View File

@ -568,9 +568,8 @@ fn test_no_user_configured() {
insta::assert_snapshot!(get_stderr_string(&assert), @r###"
Working copy now at: qpvuntsm 7a7d6016 (empty) without name
Parent commit : zzzzzzzz 00000000 (empty) (no description set)
Warning: Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run:
Warning: Name not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run:
jj config set --user user.name "Some One"
jj config set --user user.email "someone@example.com"
"###);
let assert = test_env
.jj_cmd(&repo_path, &["describe", "-m", "without email"])
@ -580,6 +579,18 @@ fn test_no_user_configured() {
insta::assert_snapshot!(get_stderr_string(&assert), @r###"
Working copy now at: qpvuntsm 906f8b89 (empty) without email
Parent commit : zzzzzzzz 00000000 (empty) (no description set)
Warning: Email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run:
jj config set --user user.email "someone@example.com"
"###);
let assert = test_env
.jj_cmd(&repo_path, &["describe", "-m", "without name and email"])
.env_remove("JJ_USER")
.env_remove("JJ_EMAIL")
.assert()
.success();
insta::assert_snapshot!(get_stderr_string(&assert), @r###"
Working copy now at: qpvuntsm 57d3a489 (empty) without name and email
Parent commit : zzzzzzzz 00000000 (empty) (no description set)
Warning: Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run:
jj config set --user user.name "Some One"
jj config set --user user.email "someone@example.com"

View File

@ -224,13 +224,108 @@ fn test_new_insert_after() {
// --after cannot be used with revisions
let stderr = test_env.jj_cmd_cli_error(&repo_path, &["new", "--after", "B", "D"]);
insta::assert_snapshot!(stderr, @r###"
error: the argument '--insert-after <INSERT_AFTER>' cannot be used with '[REVISIONS]...'
insta::assert_snapshot!(stderr, @r#"
error: the argument '--insert-after [<INSERT_AFTER>]' cannot be used with '[REVISIONS]...'
Usage: jj new --insert-after <INSERT_AFTER> [REVISIONS]...
Usage: jj new --insert-after [<INSERT_AFTER>] [REVISIONS]...
For more information, try '--help'.
"#);
}
#[test]
fn test_new_insert_before_after_no_arg() {
let test_env = TestEnvironment::default();
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path);
test_env.jj_cmd_ok(&repo_path, &["edit", "-r", "B"]);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r###"
F
E
D
C
@ B
A
root
"###);
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["new", "--after", "-m", "G"]);
insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r#"
Rebased 1 descendant commits
Working copy now at: nkmrtpmo cf1ca757 (empty) G
Parent commit : kkmpptxz bfd4157e B | (empty) B
"#);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r#"
C
@ G
B
A
F
E
D
root
"#);
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["new", "-m", "H", "--before"]);
insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r#"
Rebased 2 descendant commits
Working copy now at: xznxytkn f9f74f27 (empty) H
Parent commit : kkmpptxz bfd4157e B | (empty) B
"#);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r#"
C
G
@ H
B
A
F
E
D
root
"#);
let (stdout, stderr) = test_env.jj_cmd_ok(
&repo_path,
&["new", "-m", "I", "--after", "--after", "D", "--no-edit"],
);
insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r#"
Created new commit nmzmmopx 56056dac (empty) I
Rebased 3 descendant commits
"#);
insta::assert_snapshot!(get_short_log_output(&test_env, &repo_path), @r#"
C
G
F
I
D
@ H
B
A
E
root
"#);
let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "--before", "--after"]);
insta::assert_snapshot!(stderr, @r#"
Error: Refusing to create a loop: commit f9f74f27408e would be both an ancestor and a descendant of the new commit
"#);
}
#[test]
@ -346,13 +441,13 @@ fn test_new_insert_before() {
// --before cannot be used with revisions
let stderr = test_env.jj_cmd_cli_error(&repo_path, &["new", "--before", "B", "D"]);
insta::assert_snapshot!(stderr, @r###"
error: the argument '--insert-before <INSERT_BEFORE>' cannot be used with '[REVISIONS]...'
insta::assert_snapshot!(stderr, @r#"
error: the argument '--insert-before [<INSERT_BEFORE>]' cannot be used with '[REVISIONS]...'
Usage: jj new --insert-before <INSERT_BEFORE> [REVISIONS]...
Usage: jj new --insert-before [<INSERT_BEFORE>] [REVISIONS]...
For more information, try '--help'.
"###);
"#);
}
#[test]

View File

@ -78,6 +78,9 @@ only symbols.
You can use parentheses to control evaluation order, such as `(x & y) | z` or
`x & (y | z)`.
<!-- The following format will be understood by the web site generator, and will
generate a folded section that can be unfolded at will. -->
??? examples
Given this history: