feat: Implement jj-configured branch names#142
Open
ilyapoz wants to merge 2 commits into
Open
Conversation
Rationale: putting such functions into config is questionable in general. In particular, I would like to make them depend on Jujutsu and it feels weird to depend on this struct from config. I just make these free standing functions and put them into the only module that uses them.
I want to use the same branch names that would be created if I used `jj git push -c <>`. In this PR I introduce spr.useJjBookmarkNames config option that would allow to turn this behavior on. It works by running `jj log ... -T` and using the string as the branch name.
Owner
|
May I ask how this improves your workflow? If anything, I would think the readable branch names would be better. |
Author
|
@jennings I do have readable branch names configured in jj: [templates]
git_push_bookmark = "git_push_bookmark_template"
[template-aliases]
subject = 'description.first_line()'
ticket = 'subject.match(regex:"^[A-Z][A-Z0-9_]*-[0-9]+: ").remove_suffix(": ")'
'remove_ticket(subject)' = 'subject.replace(regex:"^[A-Z][A-Z0-9_]*-[0-9]+:\\s*", "")'
'slugify(str)' = 'str.lower().replace(regex:"[^a-z0-9]+", "-").remove_prefix("-").remove_suffix("-")'
git_push_bookmark_template= '''
committer.email().local() ++ "/" ++
if(description,
surround("", "/", ticket) ++
slugify(remove_ticket(subject))
)
'''posted about it on discord: https://discord.com/channels/968932220549103686/1503725496544792678/1504593218543681637 also, other people posted before. So this is a case for consistency. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I want to use the same branch names that would be created if I used
jj git push -c <>.In this PR I introduce spr.useJjBookmarkNames config option that would allow to turn this behavior on.
It works by running
jj log ... -Tand using the string as the branch name.