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

everything: Rename branches to bookmarks #4341

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Conversation

PhilipMetzger
Copy link
Collaborator

Jujutsu's branches do not behave like Git branches, which is a major hurdle for people adopting it from Git. They rather behave like Mercurial's (hg) bookmarks.

We've had multiple discussions about it in the last ~1.5 years about this rename in the Discord, where multiple people agreed that this false familiarity does not help anyone. Initially we were reluctant to do it but overtime, more and more users agreed that bookmark was a better for name the current mechanism. This may be hard break for current jj branch users, but it will immensly help Jujutsu's future, by defining it as our first own term. The [experimental-moving-branches] config option is currently left alone, to force not another large config update for users, since the last time this happened was when jj log -T show was removed, which immediately resulted in breaking users and introduced soft deprecations.

This name change will also make it easier to introduce Topics (#3402) as topological branches with a easier model.

This is a pure mechanical change done via LSP, ripgrep and sed with some manual fixups.

cc @thoughtpolice for help writing the deprecation text in the CHANGELOG.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)

@martinvonz
Copy link
Owner

I think we need to keep jj branch as an alias for a while. Same with the branches() revset and the various templates. Otherwise we're going to break too many tools and user configs.

@PhilipMetzger
Copy link
Collaborator Author

Yes, I'll need to partially revert those changes.

cli/src/cli_util.rs Outdated Show resolved Hide resolved
cli/src/cli_util.rs Outdated Show resolved Hide resolved
cli/src/cli_util.rs Outdated Show resolved Hide resolved
@joyously
Copy link

Do the bookmarks actually differ from tags?

@istudyatuni
Copy link

Do the bookmarks actually differ from tags?

You can't move tags

@PhilipMetzger
Copy link
Collaborator Author

Do the bookmarks actually differ from tags?

Which tags are you talking about, as tags could mean Git tags which we partially support or a tag of our own? Mercurial bookmarks and our branches behave similar to Git tags, except when the [experimental-advance-branches] config is set.

@martinvonz
Copy link
Owner

To clarify, the main difference between bookmarks and tags is that bookmarks move when you rewrite a commit. So if you run jj describe -m "new description" my-bookmark, then the bookmark is going to be updated to point to the rewritten commit. That only applies to the local side of the bookmark, however - the command will not move my-bookmark@origin, since that is supposed to represent the state seen on the remote.

@joyously
Copy link

From a high level viewpoint, it seems like bookmark would not cause a change in the display of the graph, but a branch would. So if you rename the concept of branch to bookmark, the creation of a bookmark would leave the graph in a straight line.

@arxanas
Copy link
Collaborator

arxanas commented Aug 25, 2024

@joyously Just to be clear, do you mean "lightweight tags" (refs) or "annotated tags" (objects)? The former wouldn't change the graph structure, but the latter would. Branches/bookmarks in git/hg/jj are refs, and I don't think jj has direct support for objects. Since jj doesn't currently move branches automatically, they essentially function like tags, except for interop purposes.

If I understand your viewpoint, you're saying that "branches" sound like objects in the commit graph, so "bookmarks" are a better term for that concept?

@martinvonz
Copy link
Owner

Since jj doesn't currently move branches automatically

Expect, importantly, when you rewrite the commit they point to. (We also move branches when we propagate changes from remotes and when you abandon a commit)

@joyously
Copy link

@arxanas Since I've never seen much about tags in jj (or in Git actually) , I don't know what they are. From a user standpoint, tags look like a label on a state which is denoted by a commit hash. But that sounds the same as a branch or a bookmark to me. Having to distinguish between them by whether they move or not is not the best. I can move a bookmark in my book. I can move a tag that I put on any object. Branches in physical trees don't move (all the growth is at the tip).

If I understand your viewpoint, you're saying that "branches" sound like objects in the commit graph, so "bookmarks" are a better term for that concept?

No, I didn't say that. I was trying to make sure that the graph wasn't affected. I've just read jj help branch and what it describes does sound more like bookmarks, although it seems like delete would delete your work.
Do you plan to have a different sort of branch in the future?

@necauqua
Copy link
Collaborator

necauqua commented Aug 26, 2024

Both git (lightweight) tags and branches are refs - pointers to a commit, "labels" if you will.

The distinction between tags and branches bookmarks in jj is that the local bookmark gets moved to the rewritten commit once you rewrite a bookmarked commit, and the tag stays - and they get exported as git branches/tags respectively.

So semantically, tags are named commit-ids, and bookmarks are named change-ids.

Of course, you could forcibly (re)move both of those with crud commands if you so desire (in an ideal world, as currently there are no crud commands for tags, we just read them from git)

And the future topics are named infectious (expand automatically when you create child commits, for the analogue of advancing branches) sets of commits, and not sets as in revsets, but actual real commits - and hopefully are to be the main tool for working with "branches" (but not like in git since we minimize global state, and topics are incredibly more versatile) in jj.

@joyously
Copy link

@necauqua Thank you. Perhaps you should put that writeup in the intro doc. Include the commands to create/delete a branch in the graph while you are at it, for completeness.

@PhilipMetzger PhilipMetzger marked this pull request as ready for review August 28, 2024 18:25
@PhilipMetzger PhilipMetzger force-pushed the push-nkmunnyzrrln branch 4 times, most recently from 4c9b2d0 to 64e1a47 Compare August 28, 2024 18:50
Copy link
Owner

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a partial review for now

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
cli/src/cli_util.rs Outdated Show resolved Hide resolved
cli/src/cli_util.rs Outdated Show resolved Hide resolved
cli/src/cli_util.rs Outdated Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
@PhilipMetzger PhilipMetzger force-pushed the push-nkmunnyzrrln branch 2 times, most recently from 3c4c74e to 1bcd9d7 Compare August 30, 2024 17:12
cli/src/commit_templater.rs Outdated Show resolved Hide resolved
docs/bookmarks.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I like this PR, I cannot be confident that I've reviewed these changes thoroughly. It'll be nice if we can split this into smaller commits (something like UI changes + minimal test updates, other test changes such as renaming "branch1" to "bookmark1", internal API renames, ..), but I guess doing that would be tedious.

CHANGELOG.md Outdated Show resolved Hide resolved
cli/src/cli_util.rs Outdated Show resolved Hide resolved
cli/src/commands/bookmark/delete.rs Outdated Show resolved Hide resolved
cli/src/commands/bookmark/mod.rs Outdated Show resolved Hide resolved
cli/src/commands/mod.rs Show resolved Hide resolved
cli/src/config/templates.toml Show resolved Hide resolved
cli/tests/test_advance_bookmarks.rs Outdated Show resolved Hide resolved
docs/templates.md Outdated Show resolved Hide resolved
lib/src/git.rs Outdated Show resolved Hide resolved
lib/src/settings.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@ilyagr ilyagr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got through a bit of the new bookmarks.md.

A couple of my suggestions definitely need fixing.

The rest are dependent on the questions of how we'd like our terminology of branches on the Git remote to work. For me, the most natural option would be to talk about branches on the Git remote, local bookmarks, and (most controversially) remote-tracking bookmarks. We could later split this file and talk about different kinds of remotes (once we support remotes other than Git remotes).

So, I suggested a few edits that maybe should not be acted upon until people agree how we want to speak of this. I didn't do those for the entire file, just a few to give people a taste of one option.

docs/bookmarks.md Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
docs/bookmarks.md Show resolved Hide resolved
@PhilipMetzger
Copy link
Collaborator Author

The rest are dependent on the questions of how we'd like our terminology of branches on the Git remote to work. For me, the most natural option would be to talk about branches on the Git remote, local bookmarks, and (most controversially) remote-tracking bookmarks. We could later split this file and talk about different kinds of remotes (once we support remotes other than Git remotes).

I'd like to have "natural" option, but the whole bookmarks.md rework should be a follow-up. Since this already is dragging along for some time.

Copy link
Owner

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pure mechanical change done via LSP, ripgrep and sed with some manual fixups.

I think this is obsolete, right?

cli/src/cli_util.rs Outdated Show resolved Hide resolved
Copy link
Owner

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's just as easy for any reviewers to send followup PRs to fix anything they find as it is to comment on this PR, so I think it makes sense to just merge this as is.

Jujutsu's branches do not behave like Git branches, which is a major
hurdle for people adopting it from Git. They rather behave like
Mercurial's (hg) bookmarks. 

We've had multiple discussions about it in the last ~1.5 years about this rename in the Discord, 
where multiple people agreed that this _false_ familiarity does not help anyone. Initially we were 
reluctant to do it but overtime, more and more users agreed that `bookmark` was a better for name 
the current mechanism. This may be hard break for current `jj branch` users, but it will immensly 
help Jujutsu's future, by defining it as our first own term. The `[experimental-moving-branches]` 
config option is currently left alone, to force not another large config update for
users, since the last time this happened was when `jj log -T show` was removed, which immediately 
resulted in breaking users and introduced soft deprecations.

This name change will also make it easier to introduce Topics (#3402) as _topological branches_ 
with a easier model. 

This was mostly done via LSP, ripgrep and sed and a whole bunch of manual changes either from
me being lazy or thankfully pointed out by reviewers.
@PhilipMetzger PhilipMetzger enabled auto-merge (rebase) September 11, 2024 16:39
@PhilipMetzger PhilipMetzger merged commit d9c68e0 into main Sep 11, 2024
31 checks passed
@PhilipMetzger PhilipMetzger deleted the push-nkmunnyzrrln branch September 11, 2024 16:54
@dbarnett
Copy link
Collaborator

🚀

Looked like way more of a process getting this merged than I would have expected. Thanks!

PhilipMetzger added a commit that referenced this pull request Sep 17, 2024
This applies some suggestions from Ilya from #4341 and starts to differentiate in terminology.
@PhilipMetzger PhilipMetzger mentioned this pull request Sep 17, 2024
1 task
PhilipMetzger added a commit that referenced this pull request Sep 25, 2024
This applies some suggestions from Ilya from #4341 and starts to differentiate in terminology.
eopb added a commit to eopb/jj-gh-pr.nu that referenced this pull request Sep 28, 2024
Since martinvonz/jj#4341, `jj` has renamed branches to bookmarks.

Once the next `jj` is released, references to `-T branches` will be deprecated.

I should merge this PR when that release happens
eopb added a commit to eopb/jj-gh-pr.nu that referenced this pull request Sep 28, 2024
Since martinvonz/jj#4341, `jj` has renamed branches to bookmarks.

Once the next `jj` is released, references to `-T branches` will be deprecated.

I should merge this PR when that release happens
eopb added a commit to eopb/jj-gh-pr.nu that referenced this pull request Oct 6, 2024
Since martinvonz/jj#4341, `jj` has renamed branches to bookmarks.

Once the next `jj` is released, references to `-T branches` will be deprecated.

I should merge this PR when that release happens
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.