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

jj rebase and jj new: Allow revsets with multiple commits with new --allow-large-revsets argument #1189

Merged
merged 9 commits into from
Feb 6, 2023

Conversation

ilyagr
Copy link
Contributor

@ilyagr ilyagr commented Feb 4, 2023

Eventually, we should be able to rely on jj op restore and the --multi (Update: --allow-large-revsets)
argument should likely be removed. This is a temporary measure until we figure
out #922 and the like.

Fixes #571

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • (not planned) I have updated the documentation (README.md, docs/, demos/)
  • (N/A) I have updated the config schema (src/commands/config-schema.json)
  • I have added tests to cover my changes

src/cli_util.rs Outdated Show resolved Hide resolved
@ilyagr ilyagr changed the title Ig/multi jj rebase: Allow revsets with multiple commits with new --multi Feb 4, 2023
@ilyagr ilyagr marked this pull request as ready for review February 4, 2023 08:57
@ilyagr ilyagr changed the title jj rebase: Allow revsets with multiple commits with new --multi jj rebase: Allow revsets with multiple commits with new --multi argument Feb 4, 2023
@ilyagr ilyagr force-pushed the ig/multi branch 2 times, most recently from 30da17c to c767368 Compare February 4, 2023 09:02
@ilyagr ilyagr changed the title jj rebase: Allow revsets with multiple commits with new --multi argument jj rebase and jj new: Allow revsets with multiple commits with new --multi argument Feb 4, 2023
@avamsi
Copy link
Member

avamsi commented Feb 4, 2023

Thoughts on naming this --merge instead? Personally, I think it conveys the intent better and --multi could also be confused for other arguments (-r and -s) (it wasn't clear to me from the PR title, for example).

@ilyagr
Copy link
Contributor Author

ilyagr commented Feb 4, 2023

The confusion is somewhat intentional in this case. The idea is that --multi should also affect -s/-r/-b once #1158 is fixed. For those, --merge wouldn't work.

I agree this is not ideal, but I couldn't think of anything better. If you prefer to rely on jj undo for mistakes, we could add an option to assume --mutli or you could have an alias.

@avamsi
Copy link
Member

avamsi commented Feb 4, 2023

I guess I'm not sure that revsets to -r/-s/-b should require an explicit confirmation in the form of --multi since rebasing multiple revisions (onto origin/main) is probably one of the most common operations for me (till there's a jj sync anyway) vs merge commits, which I don't do very often.

(That said, you've obviously thought more about this than my pass-by comments and I'd appreciate #1158 being fixed more than not having to pass --multi, so feel free to ignore my anecdote.)

@ilyagr
Copy link
Contributor Author

ilyagr commented Feb 4, 2023

Yeah, I think that the name --multi is too confusing. I'm thinking of renaming it --allow-large-revsets (with short -L option).

@avamsi You'd still be able to rebase multiple revsets without this option with jj rebase -s A -s B -d C. It just tries to protect you from accidentally doing something like jj rebase -s A: -d C, where a typo or a misunderstanding causes a revset unexpectedly expands to many revisions (the command as written means rebase every single descendant of A to be a direct child of C). So, you'd need to use this option if you did jj rebase -s A+ -d C --allow-large-revsets.

src/cli_util.rs Outdated Show resolved Hide resolved
src/cli_util.rs Outdated Show resolved Hide resolved
src/cli_util.rs Outdated Show resolved Hide resolved
tests/test_rebase_command.rs Outdated Show resolved Hide resolved
src/cli_util.rs Outdated Show resolved Hide resolved
src/cli_util.rs Outdated Show resolved Hide resolved
src/cli_util.rs Outdated Show resolved Hide resolved
@ilyagr ilyagr changed the title jj rebase and jj new: Allow revsets with multiple commits with new --multi argument jj rebase and jj new: Allow revsets with multiple commits with new --allow-large-revsets argument Feb 4, 2023
@ilyagr ilyagr force-pushed the ig/multi branch 11 times, most recently from 412724f to 6b7a000 Compare February 5, 2023 00:47
… general

We'll soon need that functionality without the checking for rewriteable
part.
This will make deduplication easier in the next commit.
The error message becomes slightly less informative, unfortunately.
…`--allow-large-revsets`

Eventually, we should be able to rely on `jj op restore` and the `--allow-large-revsets`.
argument should likely be removed. This is a temporary measure until we figure
out #922 and the like.

Fixes #571
…ction

This extracts the more general `resolve_mutliple_nonempty_revsets_flag_guarded`
out of `resolve_base_revs`. This function should be useful for `rebase -s`,
etc.

`resolve_base_revs` is renamed to `resolve_destination_revs`; that's simply a
better name for it. It is also quite specific to the `new` and `rebase -d`
commands.  It will be moved out of general utilities in the next commit
src/commands/mod.rs Show resolved Hide resolved
src/cli_util.rs Outdated Show resolved Hide resolved
@ilyagr ilyagr enabled auto-merge (rebase) February 6, 2023 05:11
@ilyagr
Copy link
Contributor Author

ilyagr commented Feb 6, 2023

Thank you, Martin, for the review!

@ilyagr ilyagr merged commit 9cc536e into main Feb 6, 2023
@ilyagr ilyagr deleted the ig/multi branch February 6, 2023 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If X is a merge commit, jj rebase -s X -d X- -d another-revision should work
4 participants