-
Notifications
You must be signed in to change notification settings - Fork 349
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
bookmark: Make bookmark {create, set, move}
unhide hidden commits
#5050
base: main
Are you sure you want to change the base?
Conversation
IMHO, adding a tag or a bookmark to a hidden commit should make it visible. |
Have a reference for that, beside you?
While it works, it shouldn't really be a option since those commits should be addressable in the perfect model anyway. It is a mistake to address a predecessor as existing in the repo.
|
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.
adding a tag or a bookmark to a hidden commit should make it visible.
That's a good point. I'm not sure it's useful in practice, but the behavior is consistent.
(Un-hidden commits can be warned, but that would also apply to jj new
.)
You might find some if you look for "branch" and "hidden" on discord.
I know the current state of affairs. |
I'm unsure what makes a commit hidden, and if there could be confusion between "commit" and "change" in this context.
Would this apply to the use case of taking the current |
The set of visible commits is defined by a set of visible heads. Some pretty low-level library code adds new commits to that set because we generally want new commits to be visible. Until #4427, |
The only conversation which talks about this behavior is already mentioned, so this clearly doesn't qualify for a "reference beside you".
That also works for me, I actually made this patchset explicitly a warning to see how many complaints it will receive when it lands, since we don't know how many people actually use the workflow @tim-janik argues for. |
There are several discussions if you bother searching for "hidden branch" or "branch hidden" on the jj discord server, but AFAIK there is no way to link to searches on discord. You could also search on GH and might find #4537, etc, but really, this point is nothing more than a distraction. |
You can link the individual messages, so provide them if you care so much instead calling my argument a shallow dismissal. |
To be used in the next diff. Also simplify the `hidden()` revset with it.
83208e0
to
a4802a6
Compare
bookmark {create, set, move}
unhide hidden commits
a4802a6
to
85b98e9
Compare
This was discussed in the Discord a while ago, and this is the logical and consistent conclusion. Implementing it as such makes it consistent with both `jj edit` and `jj new` which unhide any predecessor.
85b98e9
to
e08a04e
Compare
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.
I wonder if we should make the commit at a lower level so we don't risk missing it. Like this: main...push-uulxprvmmtsw
The drawback is that if some caller really wants to point a bookmark to a hidden commit, then they'll have to set the bookmark and then make the commit hidden afterwards (and be careful to only do that if it was already hidden).
let value = commit.is_hidden(repo); | ||
value.unwrap_or_default() |
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.
nit: inline value
? It's so short now that I think it's easier to read as one expression
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.
Implementing it as such makes it consistent with both
jj edit
andjj new
which unhide any predecessor.
I find "predecessor" a bit confusing the unhidden commit doesn't need to be a predecessor of the current commit, or a predecessor of any commit at all for that matter (maybe it was just abandoned).
@@ -53,7 +53,9 @@ pub fn cmd_bookmark_create( | |||
let mut workspace_command = command.workspace_helper(ui)?; | |||
let target_commit = workspace_command | |||
.resolve_single_rev(ui, args.revision.as_ref().unwrap_or(&RevisionArg::AT))?; | |||
let repo = workspace_command.repo(); | |||
let view = workspace_command.repo().view(); |
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.
nit: use repo
here
It might be good to add repo method that updates bookmark refs and makes targets visible, but I would expect there's an escape hatch to do low-level thing. |
let view = workspace_command.repo().view(); | ||
let is_hidden = target_commit.is_hidden(repo.as_ref())?; |
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.
nit: I think is_hidden()
test is redundant (in all commands.) iirc, these commands check if bookmarks are moved/created, so we can just do .add_head()
if there are any bookmark changes.
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.
True, the repo seems like a better level to do it. I've updated my branch. I should also add tests for it in jj-lib. Or do you want to take my commit and add tests, @PhilipMetzger?
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.
I think
is_hidden()
test is redundant (in all commands.) iirc, these commands check if bookmarks are moved/created, so we can just do.add_head()
if there are any bookmark changes.
I agree, but it was the simplest way to implement it.
True, the repo seems like a better level to do it. I've updated my branch. I should also add tests for it in jj-lib. Or do you want to take my commit and add tests, @PhilipMetzger?
I in general agree with the direction we take here, so I probably should take over Martin's branch and drop the first commit, if it otherwise doesn't provide value.
Is that a thing we actually want? As it doesn't make sense from the viewpoint of the CLI, like we can provide a API for that but it should be a error otherwise. |
Callers might depends on property that |
This was discussed in Discord a while ago, and this is the logical and consistent
conclusion. Implementing it as such makes it consistent with both
jj edit
andjj new
which unhide any predecessor.
Checklist
If applicable:
CHANGELOG.md