-
Notifications
You must be signed in to change notification settings - Fork 343
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
FR: Working copy stack #3713
Comments
This can also be solved with a history topic which represents your stack, see #3402. It'd be less invasive too. |
For the first use case mentioned above, you can do something like |
In Git, their stack-like data structure ( I think it doesn't currently, but if the operation log were to store the command/subcommand that was invoked for each operation, then you might be able to implement this yourself today without special jj integration. |
This popped out immediately for me:
Same as I think it would also behave differently depending on whether you reached your previous working copy by calling |
Is your feature request related to a problem? Please describe.
One thing that JJ makes really easy is going back in your history and editing previous changes. I often find myself doing something like this:
jj edit
orjj new <rev>
jj squash
.A frustration here is that in order to do step 2, I have to know the (short-form) change id, usually by searching in
jj log
.Describe the solution you'd like
I think that an elegant solution to this problem would be to have a "working copy stack," analogous to the directory stack in most shells. In particular,
jj new <rev>
,jj edit <rev>
, orjj split -r <rev>
- would push to the working copy stack.jj commit
,jj next
andjj prev
, orjj new
with no arguments - would instead just update the top of the working copy stack. (analogous tocd
instead ofpushd
)jj wc
with subcommandspop
andlist
.push
ornew
. This would duplicate the top of the stack, so that you can go back to it if your next command is about to overwrite the top of the stack.The workflow above would now look like...
jj edit
or etc. and make some changes.jj wc pop
and you're back where you were.Because it's a stack that updates every time you manually change your working copy, it could just be generally useful whenever you're working with multiple branches or lines of work (whether or not you are tracking them as branches in Git.) I can imagine lots of scenarios where
jj wc list
would be very helpful to have.Describe alternatives you've considered
This is related to #2871. It solves a lot of the same problems. However, the proposed solution is different in that it has a stack as opposed to just a history, and in that the user doesn't have to deal with revsets - which I think would make it more approachable to beginners or to people like me who are coming from Git. The two solutions could be compatible; one could implement a revset function that lists the working copy stack.
Additional context
How long to keep the stack around is an open question - do you want things in the stack from months ago? Certainly a
jj wc clear
would be a good thing to have.The text was updated successfully, but these errors were encountered: