-
Notifications
You must be signed in to change notification settings - Fork 751
tests: add additional coverage for metaedit and describe #7808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
higgsd
wants to merge
6
commits into
jj-vcs:main
Choose a base branch
from
higgsd:push-vlruqmqmyvrx
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
92b0f66
tests: exercise metaedit revset matching no commits
higgsd 7c0c8da
tests: exercise hidden metaedit -r option
higgsd 65890a7
tests: exercise metaedit --quiet
higgsd 3342ae7
tests: exercise metaedit more with empty author/email
higgsd b4e25ce
tests: exercise describe revset matching no commits
higgsd bd7ed0d
tests: exercise describe --stdin
higgsd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,14 +95,15 @@ fn test_metaedit() { | |
[EOF] | ||
"); | ||
|
||
// Update author | ||
// Update author, ensure the commit can be specified with -r too | ||
work_dir.run_jj(["op", "restore", &setup_opid]).success(); | ||
work_dir | ||
.run_jj([ | ||
"metaedit", | ||
"--config=user.name=Ove Ridder", | ||
"[email protected]", | ||
"--update-author", | ||
"-r", | ||
"kkmpptxzrspx", | ||
]) | ||
.success(); | ||
|
@@ -410,6 +411,19 @@ fn test_metaedit() { | |
"); | ||
} | ||
|
||
#[test] | ||
fn test_metaedit_no_matching_revisions() { | ||
let test_env = TestEnvironment::default(); | ||
test_env.run_jj_in(".", ["git", "init", "repo"]).success(); | ||
let work_dir = test_env.work_dir("repo"); | ||
let output = work_dir.run_jj(["metaedit", "--update-change-id", "none()"]); | ||
insta::assert_snapshot!(output, @r" | ||
------- stderr ------- | ||
No revisions to modify. | ||
[EOF] | ||
"); | ||
} | ||
|
||
#[test] | ||
fn test_metaedit_multiple_revisions() { | ||
let test_env = TestEnvironment::default(); | ||
|
@@ -645,7 +659,7 @@ fn test_metaedit_option_mutual_exclusion() { | |
} | ||
|
||
#[test] | ||
fn test_update_empty_author() { | ||
fn test_update_empty_author_or_email() { | ||
let mut test_env = TestEnvironment::default(); | ||
|
||
// get rid of test author config | ||
|
@@ -666,25 +680,70 @@ fn test_update_empty_author() { | |
[EOF] | ||
"); | ||
|
||
// restore test author config | ||
// restore test author config, exercise --quiet | ||
test_env.add_env_var("JJ_USER", "Test User"); | ||
test_env.add_env_var("JJ_EMAIL", "[email protected]"); | ||
let work_dir = test_env.work_dir("repo"); | ||
|
||
// update existing commit with restored test author config | ||
insta::assert_snapshot!(work_dir.run_jj(["metaedit", "--update-author"]), @r" | ||
insta::assert_snapshot!(work_dir.run_jj(["metaedit", "--update-author", "--quiet"]), @""); | ||
insta::assert_snapshot!(work_dir.run_jj(["show"]), @r" | ||
Commit ID: 0f13b5f2ea7fad147c133c81b87d31e7b1b8c564 | ||
Change ID: qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu | ||
Author : Test User <[email protected]> (2001-02-03 08:05:09) | ||
Committer: Test User <[email protected]> (2001-02-03 08:05:09) | ||
|
||
(no description set) | ||
|
||
[EOF] | ||
"); | ||
|
||
// confirm user / email can be cleared/restored separately | ||
// leave verbose to see no-email warning + hint | ||
test_env.add_env_var("JJ_EMAIL", ""); | ||
let work_dir = test_env.work_dir("repo"); | ||
insta::assert_snapshot!(work_dir.run_jj(["metaedit", "--update-author"]), @r#" | ||
------- stderr ------- | ||
Modified 1 commits: | ||
qpvuntsm 0f13b5f2 (empty) (no description set) | ||
Working copy (@) now at: qpvuntsm 0f13b5f2 (empty) (no description set) | ||
qpvuntsm 234908d4 (empty) (no description set) | ||
Working copy (@) now at: qpvuntsm 234908d4 (empty) (no description set) | ||
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. | ||
Hint: To configure, run: | ||
jj config set --user user.email "[email protected]" | ||
[EOF] | ||
"#); | ||
insta::assert_snapshot!(work_dir.run_jj(["show"]), @r" | ||
Commit ID: 234908d4748ff3224a87888d8b52a4923e1a89a5 | ||
Change ID: qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu | ||
Author : Test User <(no email set)> (2001-02-03 08:05:09) | ||
Committer: Test User <(no email set)> (2001-02-03 08:05:11) | ||
|
||
(no description set) | ||
|
||
[EOF] | ||
"); | ||
|
||
// confirm no-name warning + hint | ||
test_env.add_env_var("JJ_USER", ""); | ||
test_env.add_env_var("JJ_EMAIL", "[email protected]"); | ||
let work_dir = test_env.work_dir("repo"); | ||
insta::assert_snapshot!(work_dir.run_jj(["metaedit", "--update-author"]), @r#" | ||
------- stderr ------- | ||
Modified 1 commits: | ||
qpvuntsm ac5048cf (empty) (no description set) | ||
Working copy (@) now at: qpvuntsm ac5048cf (empty) (no description set) | ||
Parent commit (@-) : zzzzzzzz 00000000 (empty) (no description set) | ||
Warning: Name not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. | ||
Hint: To configure, run: | ||
jj config set --user user.name "Some One" | ||
[EOF] | ||
"#); | ||
insta::assert_snapshot!(work_dir.run_jj(["show"]), @r" | ||
Commit ID: 0f13b5f2ea7fad147c133c81b87d31e7b1b8c564 | ||
Commit ID: ac5048cf35372ddc30e2590271781a3eab0bcaf8 | ||
Change ID: qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu | ||
Author : Test User <[email protected]> (2001-02-03 08:05:09) | ||
Committer: Test User <[email protected]> (2001-02-03 08:05:09) | ||
Author : (no name set) <[email protected]> (2001-02-03 08:05:09) | ||
Committer: (no name set) <[email protected]> (2001-02-03 08:05:13) | ||
|
||
(no description set) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably a bug. A description set by CLI should be terminated by newline.