Skip to content
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

feat(rebase): Rename --skip-empty to --skip-emptied. #4014

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
move` to ensure that the target branch already exists.
[#3584](https://github.com/martinvonz/jj/issues/3584)

* `jj rebase --skip-empty` has been renamed to `jj rebase --skip-emptied`

### Deprecations

* Replacing `-l` shorthand for `--limit` with `-n` in `jj log`, `jj op log`
Expand Down
16 changes: 13 additions & 3 deletions cli/src/commands/rebase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::cli_util::{
short_commit_hash, CommandHelper, RevisionArg, WorkspaceCommandHelper,
WorkspaceCommandTransaction,
};
use crate::command_error::{user_error, CommandError};
use crate::command_error::{cli_error, user_error, CommandError};
use crate::ui::Ui;

/// Move revisions to different parent(s)
Expand Down Expand Up @@ -188,12 +188,16 @@ pub(crate) struct RebaseArgs {
)]
insert_before: Vec<RevisionArg>,

/// Deprecated. Use --skip-emptied instead.
#[arg(long, conflicts_with = "revisions", hide = true)]
skip_empty: bool,
matts1 marked this conversation as resolved.
Show resolved Hide resolved

/// If true, when rebasing would produce an empty commit, the commit is
/// abandoned. It will not be abandoned if it was already empty before the
/// rebase. Will never skip merge commits with multiple non-empty
/// parents.
#[arg(long, conflicts_with = "revisions")]
skip_empty: bool,
skip_emptied: bool,
}

#[instrument(skip_all)]
Expand All @@ -202,8 +206,14 @@ pub(crate) fn cmd_rebase(
command: &CommandHelper,
args: &RebaseArgs,
) -> Result<(), CommandError> {
if args.skip_empty {
return Err(cli_error(
"--skip-empty is deprecated, and has been renamed to --skip-emptied.",
));
}

let rebase_options = RebaseOptions {
empty: match args.skip_empty {
empty: match args.skip_emptied {
true => EmptyBehaviour::AbandonNewlyEmpty,
false => EmptyBehaviour::Keep,
},
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ commit. This is true in general; it is not specific to this command.
* `-B`, `--insert-before <INSERT_BEFORE>` — The revision(s) to insert before (can be repeated to create a merge commit)

Only works with `-r`.
* `--skip-empty` — If true, when rebasing would produce an empty commit, the commit is abandoned. It will not be abandoned if it was already empty before the rebase. Will never skip merge commits with multiple non-empty parents
* `--skip-emptied` — If true, when rebasing would produce an empty commit, the commit is abandoned. It will not be abandoned if it was already empty before the rebase. Will never skip merge commits with multiple non-empty parents



Expand Down
4 changes: 2 additions & 2 deletions cli/tests/test_rebase_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2236,7 +2236,7 @@ fn test_rebase_revisions_after_before() {
}

#[test]
fn test_rebase_skip_empty() {
fn test_rebase_skip_emptied() {
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");
Expand All @@ -2259,7 +2259,7 @@ fn test_rebase_skip_empty() {
"###);

let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-d=b", "--skip-empty"]);
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-d=b", "--skip-emptied"]);
insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###"
Rebased 3 commits
Expand Down