-
Notifications
You must be signed in to change notification settings - Fork 385
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: Allow templating the output branche(s) of jj branch create
#3253
Comments
Perhaps, it shouldn't be This feature will also apply to |
I like that ergo much better than what I suggested. Regarding the following, it seems like a useful flag that the jj team may want to discuss within the context of all possible applications in the cli and then decide the best way forward.
|
jj branch create -T
jj branch create
Ok, so I updated my PR. But it raises a question. Current UseOne Rev -> Many string branch names Desired UseMany Revs -> Many branch names derived from single template The rub is, how to reconcile the cli use in the unexpected ways: Case 1Many Revs -> Many string branch names Case 2Many Revs -> Many templates My current implementation which is just emergent from the refactor is as follows.
Also, I feel I should also add a dry-run option wdyt? |
Out of curiosity, what's the purpose of bulk branch creation? Is it a pre step of some other review tooling?
Error makes sense if there are any branch names to be assigned to different revisions. (And I have no idea about the command line flag. This feature is similar to #3120, and it will probably be implemented as
Maybe no? It's local operation and can be easily undone. (fwiw, there's a plan of adding global dry-run flag #2562 (comment)) |
The question in my mind is "do you have to write this in each command handler that might use it, or is the "template" parsing done before the command handler is invoked?" I had a thought that |
Interesting! I like that idea. If we revive the templater support for string interpolation that @yuja had in a draft PR once, we could implement this feature without an extra flag. Maybe it would look like this:
|
It's a bit scary to apply to |
If there is concern about accidental templating, would jj describe -m t'..' work? |
|
True, it is a bit scary in that case. We can have different defaults for different commands and let you override with |
The problem here is that |
Could we use flag modifier options that precede the value arguments? jj branch -t '"r-" ++ change_id'
jj describe -m 'move change_id field'
jj describe --template --message '"fix bug present in" ++ commit_id(main)'
jj describe -t -m '"fix bug present in" ++ commit_id(main)'
jj describe -tm '"fix bug present in" ++ commit_id(main)' |
We don't do any unusual flag handling like that yet and I don't want us to start doing it. I don't even know if clap supports that. |
Ya I totally understand, I think the name is "position-sensitive flags". See: Edit: |
I would like to be able to create a branch with a name generated from its revset. Basically like jj git push -c but more general and without the push. The idea would be to be able to create topic specific "push" branches.
Solution considered
Add a template argument to jj branch create.
Describe alternatives you've considered
I suppose branch could have a dedicated option but templates seem like the direction the project is headed.
Edits:
Title and arguments as suggested by yuja
The text was updated successfully, but these errors were encountered: