-
Notifications
You must be signed in to change notification settings - Fork 382
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
rebase: add --insert-after
and --insert-before
options for --revisions
#3396
Conversation
--insert-after
and --insert-before
options
f999ee2
to
88a2bd7
Compare
5fe31d1
to
f59623b
Compare
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.
Thank you for working on this!
I'm digesting the PR a bit slowly, here are a couple of first comments.
Some notes about implementation and the Considering just the first step ("extracting" the commit from its current location): My initial approach was to mark the commit as abandoned, call There doesn't seem to be an easy way to mark a commit as "moved" out of its location in the graph, i.e. treat it as abandoned so that its children are automatically rebased onto its parents, whilst preserving its branches. This is why I presume the current behavior is to rebase its children first onto its parents, then rebase the commit itself to its new destination, to allow the children to be auto-rebased, whilst preserving the branch of the commit when it is rewritten. Considering the second step (shifting the commit to its new destination, and rebasing its new children on top of it): I'm also not too sure if it's better to perform the moving in a single step: the current |
f59623b
to
932e59d
Compare
I created a POC of handling "moved commits" into |
Just to set expectations: I haven't looked at this today, and it might take me a few days. Also, somebody else might burst in to review this, which is totally fine. |
I very recently finished unifying the different kinds of rewritten commits so they're all recorded in I'm hoping the interface I'm planning will be something like |
I've slightly modified that implementation to perform "extraction" instead, which rebases children onto its parents instead of trying to move them. I'm not tied very much to that implementation either, just a quick experiment to see how much it manages to simplify rebase. I am interested in figuring out the new API would work. Would the new API replace all the existing What would the best way to implement "extraction" in the new API be (i.e. |
932e59d
to
64b307b
Compare
No, those functions would still exist.
Yes.
Yes, I plan to keep the existing functionality. This would just add new functionality on top (or underneath, if you like).
Exactly. |
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.
Sorry it's taken me so long to get to this PR. It's partly that I'm wondering if there's a way we can generalize the feature so we don't have to add --insert-after/-before
to other places. But it's mostly just being busy and/or prioritizing poorly. I'll try to review this later today.
No worries, I would actually like to make |
9fbf09c
to
f33a369
Compare
I've updated this PR to stack the changes on top of those in #3564. |
e4c52a5
to
1481158
Compare
496b3e1
to
920d261
Compare
--insert-after
and --insert-before
options for --revision
--insert-after
and --insert-before
options for --revisions
920d261
to
100a8c5
Compare
Updated this; I think the biggest issue I'm not sure about is the message regarding commits displayed. It can be a bit ambiguous since the same commit might be moved multiple times during the whole rebase operation. |
100a8c5
to
987f396
Compare
987f396
to
289e029
Compare
289e029
to
7589a21
Compare
27bf1a4
to
1eeb7b8
Compare
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.
Thanks again! This was clearly a lot of work.
The `move_commits` function accepts a set of target commits to shift to a new location given by `new_parents` and `new_children`. The roots of the target set will be reparented onto `new_parents`. `new_children` will then be reparented onto the heads of the target set. The commits will be rebased in reverse topological order based on the new set of parents of each commit, which avoids the need for multiple sets of rebase operations.
…be used simultaneously
1eeb7b8
to
a173522
Compare
This adds the
--insert-after
and--insert-before
options tojj rebase
, which can only be used with-r
.This allows for commits to be moved before or after any given commits.
Closes #1188.
Checklist
If applicable:
CHANGELOG.md