-
Notifications
You must be signed in to change notification settings - Fork 390
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 --untrack
option to bookmark forget
#5546
base: main
Are you sure you want to change the base?
Conversation
When untracking a remote bookmark, I usually also want to forget the local bookmark associated with it, and there is no way to do this in a single command currently. Instead, it's necessary to either untrack the remote bookmark first and then delete the local bookmark, or forget the bookmark first and then run `jj git fetch` to correct the remote bookmark which is now missing. Instead of adding `--untrack` to `jj bookmark forget`, we could add a `--delete-local` option to `jj bookmark untrack`. This might be more unintuitive in cases where there are multiple tracked remote bookmarks though, since a user might forget to stop tracking one remote bookmark, and then the deleted local bookmark might accidentally be pushed to that remote. Therefore, it seems safer to add the flag here, since it's clear that it untracks all of the remote bookmarks.
iirc, @ilyagr had some idea about My feeling is that |
Thank you for working on this! I have thought of this operation as (BTW, I'm aware that #5524 exists, but I haven't read it carefully at this point, sorry if I'm repeating things already discussed there) The reason I prefer We don't have to implement it in this PR, but this UI with
The confusion is that "forget the local branch and untrack all the remote-tracking branches" doesn't fit into this pattern quite as well, but the fact that it's equivalent to 3. as I described above is good enough for me. |
@@ -33,6 +33,10 @@ use crate::ui::Ui; | |||
/// recreated on future pulls if it still exists in the remote. | |||
#[derive(clap::Args, Clone, Debug)] | |||
pub struct BookmarkForgetArgs { | |||
/// Untrack remote bookmarks instead of forgetting them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whether this is called "--untrack" or "--local", here's an idea for the help text:
/// Forget chosen local bookmarks. Untrack (but do not forget) the corresponding remote bookmarks.
@@ -26,6 +26,9 @@ use crate::ui::Ui; | |||
/// | |||
/// A non-tracking remote bookmark is just a pointer to the last-fetched remote | |||
/// bookmark. It won't be imported as a local bookmark on future pulls. | |||
/// | |||
/// If you want to forget a local bookmark while also untracking the | |||
/// corresponding remote bookmarks, use `jj bookmark forget --untrack` instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea to mention it here! (No action needed, beyond updating the name if we change it)
(Perhaps, If I redesign
I think the tricky part of |
Yeah
I like this a lot better than the current behavior. It's always felt strange to me that if I pass the name of a local bookmark, it forgets the remote bookmarks too. I would be in favor of changing it to this or something like this.
Yeah, I think that's what made me want to go with |
Yuya's proposal makes sense to me too. I'm not at all attached to how it currently behaves. |
I also like Yuya's proposal. I think the state the repo is in after My only nit (that I'm sure we can figure out) is that I don't like the Footnotes
|
There's also the question of how to make this transition. Do you think it's OK to make this breaking change directly? At some point, I had the plan to require at least one of At that point, I was thinking of the syntax as being I think we could still have an intermediate period where we'd require an argument when specifying the local branch, either Or we can just make the breaking change directly, I'm not sure how confusing this would be. I imagine it'd have the most impact on GUIs, since I'm guessing not many people use |
Maybe another option would be to just say that if someone wants to forget the remote bookmark, they have to do so explicitly. Like |
I was just going to ask for all the scenarios this is trying to cover, so I could get a better feel for the option that would make sense. |
Agreed. It could also mean How about |
I like it! I can take a shot at implementing it sometime this week, but if someone else would like to do it instead that's fine with me too. |
Fixes #5524. I went with
--untrack
for the naming because it seemed easier to explain in the help text than--local
.Checklist
If applicable:
CHANGELOG.md