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

cli: add --create to branch set to upsert branches #3585

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Cretezy
Copy link
Collaborator

@Cretezy Cretezy commented Apr 28, 2024

Fixes #3584. Awaiting final decision on approach in the issue to remove draft status.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have added tests to cover my changes

@Cretezy Cretezy marked this pull request as ready for review April 28, 2024 19:05
@khionu
Copy link
Collaborator

khionu commented Apr 29, 2024

What's the purpose of this? branch create can already take -r

Found #3584, advocated for --allow-new over --create for mindset reasons.

@jonathantanmy
Copy link
Collaborator

Looks good to me - the diff is shorter than I expected, but that's because set_local_branch_target already performs an upsert. I haven't contributed to jj in a while so I'll let someone else approve (in particular, I can't tell if this particular --create argument is the way the project wants to go, or if we should use another name).

@Cretezy Cretezy force-pushed the push-lumxulyzkzwz branch from 9ee42ae to fcabdb1 Compare April 29, 2024 22:44
@Cretezy Cretezy force-pushed the push-lumxulyzkzwz branch from fcabdb1 to 0c0fddd Compare April 29, 2024 22:45
@yuja
Copy link
Collaborator

yuja commented Apr 30, 2024

Found #3584, advocated for --allow-new over --create for mindset reasons.

I also like --allow-new or --allow-create because this option is noop if the branch already exists.

It might be also good to rename the current typo-safe version and add new create-or-update "set", but I'm not sure.
#3584 (comment)

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.

FR: Upsert branch (update branch or create if it does not exist)
5 participants