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

Use closest branches if none specified for jj branch set #3770

Closed
wants to merge 2 commits into from

Conversation

martindisch
Copy link

Some users find themselves frequently re-setting the branch they're working on to point to the most recent commit in order to push new work they've added on top. This requires remembering and typing or pasting potentially long branch names such as jj branch set feature/what-ever-this-is.

Maybe we could make this easier by picking the closest branch pointing to an ancestor of the target, if no branch names are explicitly specified.

Some questions that come to mind:

  1. Does this make sense within the branch set subcommand or should it be its own, such as branch advance?
  2. Is there a better way to search the commit graph for the closest branch(es), such as a revset expression, or should we keep this rather simple implementation for walking the ancestors?
  3. Is it necessary to implement some sort of limit to prevent Jujutsu potentially traversing all the way back to the root if there are no local branches, or would searching until found (or not found in that case) be the expected behavior?

@martindisch martindisch changed the title Advance branch Use closest branches if none specified for jj branch set May 27, 2024
@martinvonz
Copy link
Member

Thanks! This is very closely related to the experimental advance-branches feature (see #3549 if you haven't).

  • Does this make sense within the branch set subcommand or should it be its own, such as branch advance?

Good question. I'm not sure what I think.

  • Is there a better way to search the commit graph for the closest branch(es), such as a revset expression, or should we keep this rather simple implementation for walking the ancestors?

Yes, using revsets should be better. That could be much faster for custom revset engines (like at Google). I think the equivalent of heads(::@ & branches()) should work.

@martindisch
Copy link
Author

Glad to hear that's already being talked about! In that case I'll abandon this and continue using it for myself until the proper implementation lands. Thanks for the pointer!

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.

2 participants