From 1aa2aec1417c60e179c8088b3f45b153e540a214 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Wed, 11 Sep 2024 09:11:50 -0700 Subject: [PATCH] bookmarks: update some leftover uses of the word "branch" --- .github/PULL_REQUEST_TEMPLATE.md | 6 +- README.md | 2 +- cli/src/cli_util.rs | 2 +- cli/src/commands/bookmark/forget.rs | 4 +- cli/src/commands/bookmark/track.rs | 2 +- cli/src/commands/bookmark/untrack.rs | 2 +- cli/src/commands/commit.rs | 6 +- cli/src/commands/diff.rs | 2 +- cli/src/commands/git/clone.rs | 2 +- cli/src/commands/git/export.rs | 4 +- cli/src/commands/git/init.rs | 6 +- cli/src/commands/git/push.rs | 78 ++++++++++++------------ cli/src/commands/git/remote/remove.rs | 2 +- cli/src/commands/new.rs | 20 +++--- cli/src/commands/operation/diff.rs | 10 +-- cli/src/commands/operation/mod.rs | 6 +- cli/src/commands/split.rs | 2 +- cli/src/commit_templater.rs | 2 +- cli/src/config-schema.json | 10 +-- cli/src/config/revsets.toml | 14 ++--- cli/src/git_util.rs | 20 +++--- cli/src/revset_util.rs | 8 +-- cli/testing/bench-revsets-git.txt | 6 +- cli/tests/cli-reference@.md.snap | 28 ++++----- cli/tests/test_bookmark_command.rs | 36 +++++------ cli/tests/test_git_clone.rs | 22 +++---- cli/tests/test_git_colocated.rs | 16 ++--- cli/tests/test_git_fetch.rs | 66 ++++++++++---------- cli/tests/test_git_import_export.rs | 14 ++--- cli/tests/test_git_private_commits.rs | 16 ++--- cli/tests/test_git_push.rs | 88 +++++++++++++-------------- cli/tests/test_new_command.rs | 4 +- cli/tests/test_operations.rs | 88 +++++++++++++-------------- docs/FAQ.md | 4 +- docs/design/run.md | 2 +- docs/glossary.md | 21 +++---- docs/operation-log.md | 2 +- docs/revsets.md | 75 ++++++++++++----------- docs/technical/concurrency.md | 16 ++--- docs/technical/conflicts.md | 2 +- docs/templates.md | 6 +- docs/tutorial.md | 10 +-- lib/src/git.rs | 6 +- lib/src/op_store.rs | 14 ++--- lib/src/refs.rs | 34 +++++------ lib/src/repo.rs | 6 +- lib/src/revset.rs | 6 +- lib/src/revset_parser.rs | 26 ++++---- lib/src/str_util.rs | 2 +- lib/src/view.rs | 4 +- lib/tests/test_git.rs | 20 +++--- lib/tests/test_index.rs | 8 +-- lib/tests/test_revset.rs | 4 +- lib/tests/test_rewrite.rs | 26 ++++---- lib/tests/test_view.rs | 6 +- 55 files changed, 448 insertions(+), 446 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7a0bd95ec4..da7c95318b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,9 +2,9 @@ There's no need to add anything here, but feel free to add a personal message. Please describe the changes in this PR in the commit message(s) instead, with each commit representing one logical change. Address code review comments by -rewriting the branch rather than adding commits on top. Use force-push when -pushing the updated branch (`jj git push` does that automatically when you -rewrite a branch). Merge the PR at will once it's been approved. See +rewriting the commits rather than adding commits on top. Use force-push when +pushing the updated commits (`jj git push` does that automatically when you +rewrite commits). Merge the PR at will once it's been approved. See https://github.com/martinvonz/jj/blob/main/docs/contributing.md for details. Note that you need to sign Google's CLA to contribute. --> diff --git a/README.md b/README.md index 69597acf33..367b96b1fa 100644 --- a/README.md +++ b/README.md @@ -276,7 +276,7 @@ Juggling conflicts: Whenever you modify a commit, any descendants of the old commit will be rebased onto the new commit. Thanks to the conflict design described above, that can be -done even if there are conflicts. Branches pointing to rebased commits will be +done even if there are conflicts. Bookmarks pointing to rebased commits will be updated. So will the working copy if it points to a rebased commit. ### Comprehensive support for rewriting history diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index 237ae1f36d..9e10424d5c 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -1796,7 +1796,7 @@ Then run `jj squash` to move the resolution into the conflicted commit."#, /// commits and that are eligible to advance. The `from` commits are /// typically the parents of the target commit of `jj commit` or `jj new`. /// - /// Branches are not moved until + /// Bookmarks are not moved until /// `WorkspaceCommandTransaction::advance_bookmarks()` is called with the /// `AdvanceableBookmark`s returned by this function. /// diff --git a/cli/src/commands/bookmark/forget.rs b/cli/src/commands/bookmark/forget.rs index 0c2ca46e15..3a7e699383 100644 --- a/cli/src/commands/bookmark/forget.rs +++ b/cli/src/commands/bookmark/forget.rs @@ -13,7 +13,7 @@ // limitations under the License. use itertools::Itertools as _; -use jj_lib::op_store::BranchTarget; +use jj_lib::op_store::BookmarkTarget; use jj_lib::op_store::RefTarget; use jj_lib::op_store::RemoteRef; use jj_lib::str_util::StringPattern; @@ -71,7 +71,7 @@ pub fn cmd_bookmark_forget( fn find_forgettable_bookmarks<'a>( view: &'a View, name_patterns: &[StringPattern], -) -> Result)>, CommandError> { +) -> Result)>, CommandError> { find_bookmarks_with(name_patterns, |pattern| { view.bookmarks().filter(|(name, _)| pattern.matches(name)) }) diff --git a/cli/src/commands/bookmark/track.rs b/cli/src/commands/bookmark/track.rs index 93fed92363..c8849c28a9 100644 --- a/cli/src/commands/bookmark/track.rs +++ b/cli/src/commands/bookmark/track.rs @@ -38,7 +38,7 @@ pub struct BookmarkTrackArgs { /// https://martinvonz.github.io/jj/latest/revsets/#string-patterns. /// /// Examples: bookmark@remote, glob:main@*, glob:jjfan-*@upstream - #[arg(required = true, value_name = "BRANCH@REMOTE")] + #[arg(required = true, value_name = "BOOKMARK@REMOTE")] names: Vec, } diff --git a/cli/src/commands/bookmark/untrack.rs b/cli/src/commands/bookmark/untrack.rs index 4ca79f812b..244b907e25 100644 --- a/cli/src/commands/bookmark/untrack.rs +++ b/cli/src/commands/bookmark/untrack.rs @@ -34,7 +34,7 @@ pub struct BookmarkUntrackArgs { /// https://martinvonz.github.io/jj/latest/revsets/#string-patterns. /// /// Examples: bookmark@remote, glob:main@*, glob:jjfan-*@upstream - #[arg(required = true, value_name = "BRANCH@REMOTE")] + #[arg(required = true, value_name = "BOOKMARK@REMOTE")] names: Vec, } diff --git a/cli/src/commands/commit.rs b/cli/src/commands/commit.rs index 804e458407..978a0c4ae4 100644 --- a/cli/src/commands/commit.rs +++ b/cli/src/commands/commit.rs @@ -67,7 +67,7 @@ pub(crate) fn cmd_commit( let matcher = workspace_command .parse_file_patterns(&args.paths)? .to_matcher(); - let advanceable_branches = workspace_command.get_advanceable_bookmarks(commit.parent_ids())?; + let advanceable_bookmarks = workspace_command.get_advanceable_bookmarks(commit.parent_ids())?; let diff_selector = workspace_command.diff_selector(ui, args.tool.as_deref(), args.interactive)?; let mut tx = workspace_command.start_transaction(); @@ -131,8 +131,8 @@ new working-copy commit. ) .write()?; - // Does nothing if there's no branches to advance. - tx.advance_bookmarks(advanceable_branches, new_commit.id()); + // Does nothing if there's no bookmarks to advance. + tx.advance_bookmarks(advanceable_bookmarks, new_commit.id()); for workspace_id in workspace_ids { tx.repo_mut().edit(workspace_id, &new_wc_commit).unwrap(); diff --git a/cli/src/commands/diff.rs b/cli/src/commands/diff.rs index bac1a8cf3d..ad82048118 100644 --- a/cli/src/commands/diff.rs +++ b/cli/src/commands/diff.rs @@ -36,7 +36,7 @@ use crate::ui::Ui; /// With the `--from` and/or `--to` options, shows the difference from/to the /// given revisions. If either is left out, it defaults to the working-copy /// commit. For example, `jj diff --from main` shows the changes from "main" -/// (perhaps a branch name) to the working-copy commit. +/// (perhaps a bookmark name) to the working-copy commit. #[derive(clap::Args, Clone, Debug)] pub(crate) struct DiffArgs { /// Show changes in this revision, compared to its parent(s) diff --git a/cli/src/commands/git/clone.rs b/cli/src/commands/git/clone.rs index 8c01432615..311f62bdcd 100644 --- a/cli/src/commands/git/clone.rs +++ b/cli/src/commands/git/clone.rs @@ -175,7 +175,7 @@ pub fn cmd_git_clone( .get_remote_bookmark(default_branch, remote_name); if let Some(commit_id) = default_branch_remote_ref.target.as_normal().cloned() { let mut checkout_tx = workspace_command.start_transaction(); - // For convenience, create local branch as Git would do. + // For convenience, create local bookmark as Git would do. checkout_tx .repo_mut() .track_remote_bookmark(default_branch, remote_name); diff --git a/cli/src/commands/git/export.rs b/cli/src/commands/git/export.rs index 5b85f13562..10e47e1620 100644 --- a/cli/src/commands/git/export.rs +++ b/cli/src/commands/git/export.rs @@ -30,8 +30,8 @@ pub fn cmd_git_export( ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; let mut tx = workspace_command.start_transaction(); - let failed_branches = git::export_refs(tx.repo_mut())?; + let failed_refs = git::export_refs(tx.repo_mut())?; tx.finish(ui, "export git refs")?; - print_failed_git_export(ui, &failed_branches)?; + print_failed_git_export(ui, &failed_refs)?; Ok(()) } diff --git a/cli/src/commands/git/init.rs b/cli/src/commands/git/init.rs index 328b4072a8..1d57357523 100644 --- a/cli/src/commands/git/init.rs +++ b/cli/src/commands/git/init.rs @@ -219,10 +219,10 @@ fn init_git_refs( } print_git_import_stats(ui, tx.repo(), &stats, false)?; if colocated { - // If git.auto-local-branch = true, local branches could be created for + // If git.auto-local-branch = true, local bookmarks could be created for // the imported remote branches. - let failed_branches = git::export_refs(tx.repo_mut())?; - print_failed_git_export(ui, &failed_branches)?; + let failed_refs = git::export_refs(tx.repo_mut())?; + print_failed_git_export(ui, &failed_refs)?; } let repo = tx.commit("import git refs"); writeln!( diff --git a/cli/src/commands/git/push.rs b/cli/src/commands/git/push.rs index dd7179cb9e..834f0dc7fb 100644 --- a/cli/src/commands/git/push.rs +++ b/cli/src/commands/git/push.rs @@ -27,8 +27,8 @@ use jj_lib::git::GitPushError; use jj_lib::object_id::ObjectId; use jj_lib::op_store::RefTarget; use jj_lib::refs::classify_bookmark_push_action; -use jj_lib::refs::BranchPushAction; -use jj_lib::refs::BranchPushUpdate; +use jj_lib::refs::BookmarkPushAction; +use jj_lib::refs::BookmarkPushUpdate; use jj_lib::refs::LocalAndRemoteRef; use jj_lib::repo::Repo; use jj_lib::revset::RevsetExpression; @@ -132,7 +132,7 @@ fn make_bookmark_term(bookmark_names: &[impl fmt::Display]) -> String { const DEFAULT_REMOTE: &str = "origin"; #[derive(Clone, Copy, Debug, Eq, PartialEq)] -enum BranchMoveDirection { +enum BookmarkMoveDirection { Forward, Backward, Sideways, @@ -155,11 +155,11 @@ pub fn cmd_git_push( let repo = workspace_command.repo().clone(); let mut tx = workspace_command.start_transaction(); let tx_description; - let mut branch_updates = vec![]; + let mut bookmark_updates = vec![]; if args.all { for (bookmark_name, targets) in repo.view().local_remote_bookmarks(&remote) { match classify_bookmark_update(bookmark_name, &remote, targets) { - Ok(Some(update)) => branch_updates.push((bookmark_name.to_owned(), update)), + Ok(Some(update)) => bookmark_updates.push((bookmark_name.to_owned(), update)), Ok(None) => {} Err(reason) => reason.print(ui)?, } @@ -171,7 +171,7 @@ pub fn cmd_git_push( continue; } match classify_bookmark_update(bookmark_name, &remote, targets) { - Ok(Some(update)) => branch_updates.push((bookmark_name.to_owned(), update)), + Ok(Some(update)) => bookmark_updates.push((bookmark_name.to_owned(), update)), Ok(None) => {} Err(reason) => reason.print(ui)?, } @@ -183,7 +183,7 @@ pub fn cmd_git_push( continue; } match classify_bookmark_update(bookmark_name, &remote, targets) { - Ok(Some(update)) => branch_updates.push((bookmark_name.to_owned(), update)), + Ok(Some(update)) => bookmark_updates.push((bookmark_name.to_owned(), update)), Ok(None) => {} Err(reason) => reason.print(ui)?, } @@ -212,10 +212,10 @@ pub fn cmd_git_push( continue; } match classify_bookmark_update(bookmark_name, &remote, targets) { - Ok(Some(update)) => branch_updates.push((bookmark_name.to_owned(), update)), + Ok(Some(update)) => bookmark_updates.push((bookmark_name.to_owned(), update)), Ok(None) => writeln!( ui.status(), - "Branch {bookmark_name}@{remote} already matches {bookmark_name}", + "Bookmark {bookmark_name}@{remote} already matches {bookmark_name}", )?, Err(reason) => return Err(reason.into()), } @@ -235,7 +235,7 @@ pub fn cmd_git_push( continue; } match classify_bookmark_update(bookmark_name, &remote, targets) { - Ok(Some(update)) => branch_updates.push((bookmark_name.to_owned(), update)), + Ok(Some(update)) => bookmark_updates.push((bookmark_name.to_owned(), update)), Ok(None) => {} Err(reason) => reason.print(ui)?, } @@ -244,7 +244,7 @@ pub fn cmd_git_push( tx_description = format!( "push {} to git remote {}", make_bookmark_term( - &branch_updates + &bookmark_updates .iter() .map(|(bookmark, _)| bookmark.as_str()) .collect_vec() @@ -252,14 +252,14 @@ pub fn cmd_git_push( &remote ); } - if branch_updates.is_empty() { + if bookmark_updates.is_empty() { writeln!(ui.status(), "Nothing changed.")?; return Ok(()); } let mut bookmark_push_direction = HashMap::new(); - for (bookmark_name, update) in &branch_updates { - let BranchPushUpdate { + for (bookmark_name, update) in &bookmark_updates { + let BookmarkPushUpdate { old_target: Some(old_target), new_target: Some(new_target), } = update @@ -270,19 +270,19 @@ pub fn cmd_git_push( bookmark_push_direction.insert( bookmark_name.to_string(), if repo.index().is_ancestor(old_target, new_target) { - BranchMoveDirection::Forward + BookmarkMoveDirection::Forward } else if repo.index().is_ancestor(new_target, old_target) { - BranchMoveDirection::Backward + BookmarkMoveDirection::Backward } else { - BranchMoveDirection::Sideways + BookmarkMoveDirection::Sideways }, ); } - validate_commits_ready_to_push(&branch_updates, &remote, &tx, command, args)?; + validate_commits_ready_to_push(&bookmark_updates, &remote, &tx, command, args)?; - writeln!(ui.status(), "Branch changes to push to {}:", &remote)?; - for (bookmark_name, update) in &branch_updates { + writeln!(ui.status(), "Bookmark changes to push to {}:", &remote)?; + for (bookmark_name, update) in &bookmark_updates { match (&update.old_target, &update.new_target) { (Some(old_target), Some(new_target)) => { let old = short_commit_hash(old_target); @@ -294,13 +294,13 @@ pub fn cmd_git_push( // suggest "Move bookmark ... forward by n commits", // possibly "Move bookmark ... sideways (X forward, Y back)". let msg = match bookmark_push_direction.get(bookmark_name).unwrap() { - BranchMoveDirection::Forward => { + BookmarkMoveDirection::Forward => { format!("Move forward bookmark {bookmark_name} from {old} to {new}") } - BranchMoveDirection::Backward => { + BookmarkMoveDirection::Backward => { format!("Move backward bookmark {bookmark_name} from {old} to {new}") } - BranchMoveDirection::Sideways => { + BookmarkMoveDirection::Sideways => { format!("Move sideways bookmark {bookmark_name} from {old} to {new}") } }; @@ -331,7 +331,9 @@ pub fn cmd_git_push( return Ok(()); } - let targets = GitBranchPushTargets { branch_updates }; + let targets = GitBranchPushTargets { + branch_updates: bookmark_updates, + }; let mut writer = GitSidebandProgressMessageWriter::new(ui); let mut sideband_progress_callback = |progress_message: &[u8]| { _ = writer.write(ui, progress_message); @@ -360,7 +362,7 @@ pub fn cmd_git_push( /// Validates that the commits that will be pushed are ready (have authorship /// information, are not conflicted, etc.) fn validate_commits_ready_to_push( - bookmark_updates: &[(String, BranchPushUpdate)], + bookmark_updates: &[(String, BookmarkPushUpdate)], remote: &str, tx: &WorkspaceCommandTransaction, command: &CommandHelper, @@ -454,12 +456,12 @@ fn get_default_push_remote( } #[derive(Clone, Debug)] -struct RejectedBranchUpdateReason { +struct RejectedBookmarkUpdateReason { message: String, hint: Option, } -impl RejectedBranchUpdateReason { +impl RejectedBookmarkUpdateReason { fn print(&self, ui: &Ui) -> io::Result<()> { writeln!(ui.warning_default(), "{}", self.message)?; if let Some(hint) = &self.hint { @@ -469,9 +471,9 @@ impl RejectedBranchUpdateReason { } } -impl From for CommandError { - fn from(reason: RejectedBranchUpdateReason) -> Self { - let RejectedBranchUpdateReason { message, hint } = reason; +impl From for CommandError { + fn from(reason: RejectedBookmarkUpdateReason) -> Self { + let RejectedBookmarkUpdateReason { message, hint } = reason; let mut cmd_err = user_error(message); cmd_err.extend_hints(hint); cmd_err @@ -482,29 +484,29 @@ fn classify_bookmark_update( bookmark_name: &str, remote_name: &str, targets: LocalAndRemoteRef, -) -> Result, RejectedBranchUpdateReason> { +) -> Result, RejectedBookmarkUpdateReason> { let push_action = classify_bookmark_push_action(targets); match push_action { - BranchPushAction::AlreadyMatches => Ok(None), - BranchPushAction::LocalConflicted => Err(RejectedBranchUpdateReason { - message: format!("Branch {bookmark_name} is conflicted"), + BookmarkPushAction::AlreadyMatches => Ok(None), + BookmarkPushAction::LocalConflicted => Err(RejectedBookmarkUpdateReason { + message: format!("Bookmark {bookmark_name} is conflicted"), hint: Some( "Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up." .to_owned(), ), }), - BranchPushAction::RemoteConflicted => Err(RejectedBranchUpdateReason { - message: format!("Branch {bookmark_name}@{remote_name} is conflicted"), + BookmarkPushAction::RemoteConflicted => Err(RejectedBookmarkUpdateReason { + message: format!("Bookmark {bookmark_name}@{remote_name} is conflicted"), hint: Some("Run `jj git fetch` to update the conflicted remote bookmark.".to_owned()), }), - BranchPushAction::RemoteUntracked => Err(RejectedBranchUpdateReason { + BookmarkPushAction::RemoteUntracked => Err(RejectedBookmarkUpdateReason { message: format!("Non-tracking remote bookmark {bookmark_name}@{remote_name} exists"), hint: Some(format!( "Run `jj bookmark track {bookmark_name}@{remote_name}` to import the remote \ bookmark." )), }), - BranchPushAction::Update(update) => Ok(Some(update)), + BookmarkPushAction::Update(update) => Ok(Some(update)), } } diff --git a/cli/src/commands/git/remote/remove.rs b/cli/src/commands/git/remote/remove.rs index 84940dcda1..f2dca800db 100644 --- a/cli/src/commands/git/remote/remove.rs +++ b/cli/src/commands/git/remote/remove.rs @@ -20,7 +20,7 @@ use crate::command_error::CommandError; use crate::git_util::get_git_repo; use crate::ui::Ui; -/// Remove a Git remote and forget its branches +/// Remove a Git remote and forget its bookmarks #[derive(clap::Args, Clone, Debug)] pub struct GitRemoteRemoveArgs { /// The remote's name diff --git a/cli/src/commands/new.rs b/cli/src/commands/new.rs index 7c087e3a11..5eb4592b2a 100644 --- a/cli/src/commands/new.rs +++ b/cli/src/commands/new.rs @@ -42,7 +42,7 @@ use crate::ui::Ui; /// /// Note that you can create a merge commit by specifying multiple revisions as /// argument. For example, `jj new main @` will create a new commit with the -/// `main` branch and the working copy as parents. +/// `main` bookmark and the working copy as parents. /// /// For more information, see /// https://martinvonz.github.io/jj/latest/working-copy/. @@ -92,8 +92,8 @@ pub(crate) fn cmd_new( let parent_commits; let parent_commit_ids: Vec; let children_commits; - let mut advance_branches_target = None; - let mut advanceable_branches = vec![]; + let mut advance_bookmarks_target = None; + let mut advanceable_bookmarks = vec![]; if !args.insert_before.is_empty() && !args.insert_after.is_empty() { parent_commits = workspace_command @@ -168,10 +168,10 @@ pub(crate) fn cmd_new( parent_commit_ids = parent_commits.iter().ids().cloned().collect(); children_commits = vec![]; - let should_advance_branches = parent_commits.len() == 1; - if should_advance_branches { - advance_branches_target = Some(parent_commit_ids[0].clone()); - advanceable_branches = + let should_advance_bookmarks = parent_commits.len() == 1; + if should_advance_bookmarks { + advance_bookmarks_target = Some(parent_commit_ids[0].clone()); + advanceable_bookmarks = workspace_command.get_advanceable_bookmarks(parent_commits[0].parent_ids())?; } }; @@ -220,9 +220,9 @@ pub(crate) fn cmd_new( writeln!(ui.status(), "Rebased {num_rebased} descendant commits")?; } - // Does nothing if there's no branches to advance. - if let Some(target) = advance_branches_target { - tx.advance_bookmarks(advanceable_branches, &target); + // Does nothing if there's no bookmarks to advance. + if let Some(target) = advance_bookmarks_target { + tx.advance_bookmarks(advanceable_bookmarks, &target); } tx.finish(ui, "new empty commit")?; diff --git a/cli/src/commands/operation/diff.rs b/cli/src/commands/operation/diff.rs index 7ec110bfae..53dbff724d 100644 --- a/cli/src/commands/operation/diff.rs +++ b/cli/src/commands/operation/diff.rs @@ -307,7 +307,7 @@ pub fn show_op_diff( if !changed_local_bookmarks.is_empty() { writeln!(formatter)?; with_content_format.write(formatter, |formatter| { - writeln!(formatter, "Changed local branches:") + writeln!(formatter, "Changed local bookmarks:") })?; for (name, (from_target, to_target)) in changed_local_bookmarks { with_content_format.write(formatter, |formatter| { @@ -361,7 +361,7 @@ pub fn show_op_diff( writeln!(formatter)?; } - let changed_remote_branches = diff_named_remote_refs( + let changed_remote_bookmarks = diff_named_remote_refs( from_repo.view().all_remote_bookmarks(), to_repo.view().all_remote_bookmarks(), ) @@ -369,16 +369,16 @@ pub fn show_op_diff( // local branches. .filter(|((_, remote_name), _)| *remote_name != REMOTE_NAME_FOR_LOCAL_GIT_REPO) .collect_vec(); - if !changed_remote_branches.is_empty() { + if !changed_remote_bookmarks.is_empty() { writeln!(formatter)?; with_content_format.write(formatter, |formatter| { - writeln!(formatter, "Changed remote branches:") + writeln!(formatter, "Changed remote bookmarks:") })?; let get_remote_ref_prefix = |remote_ref: &RemoteRef| match remote_ref.state { RemoteRefState::New => "untracked", RemoteRefState::Tracking => "tracked", }; - for ((name, remote_name), (from_ref, to_ref)) in changed_remote_branches { + for ((name, remote_name), (from_ref, to_ref)) in changed_remote_bookmarks { with_content_format.write(formatter, |formatter| { writeln!(formatter, "{}@{}:", name, remote_name)?; write_ref_target_summary( diff --git a/cli/src/commands/operation/mod.rs b/cli/src/commands/operation/mod.rs index aecb1199c9..5df6151ff2 100644 --- a/cli/src/commands/operation/mod.rs +++ b/cli/src/commands/operation/mod.rs @@ -68,10 +68,10 @@ pub fn cmd_operation( #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)] enum UndoWhatToRestore { - /// The jj repo state and local branches + /// The jj repo state and local bookmarks Repo, - /// The remote-tracking branches. Do not restore these if you'd like to push - /// after the undo + /// The remote-tracking bookmarks. Do not restore these if you'd like to + /// push after the undo RemoteTracking, } diff --git a/cli/src/commands/split.rs b/cli/src/commands/split.rs index e758646d73..514757071b 100644 --- a/cli/src/commands/split.rs +++ b/cli/src/commands/split.rs @@ -192,7 +192,7 @@ the operation will be aborted. // Mark the commit being split as rewritten to the second commit. As a // result, if @ points to the commit being split, it will point to the // second commit after the command finishes. This also means that any - // branches pointing to the commit being split are moved to the second + // bookmarks pointing to the commit being split are moved to the second // commit. tx.repo_mut() .set_rewritten_commit(commit.id().clone(), second_commit.id().clone()); diff --git a/cli/src/commit_templater.rs b/cli/src/commit_templater.rs index 0de27daf88..acf9d580a6 100644 --- a/cli/src/commit_templater.rs +++ b/cli/src/commit_templater.rs @@ -814,7 +814,7 @@ fn evaluate_user_revset<'repo>( evaluate_revset_expression(language, span, expression) } -/// Branch or tag name with metadata. +/// Bookmark or tag name with metadata. #[derive(Debug)] pub struct RefName { /// Local name. diff --git a/cli/src/config-schema.json b/cli/src/config-schema.json index 2b599a6c12..8ad1b33964 100644 --- a/cli/src/config-schema.json +++ b/cli/src/config-schema.json @@ -229,7 +229,7 @@ "committer", "working_copies", "current_working_copy", - "branches", + "bookmarks", "tags", "git_refs", "is_git_head", @@ -299,7 +299,7 @@ "properties": { "auto-local-branch": { "type": "boolean", - "description": "Whether jj creates a local branch with the same name when it imports a remote-tracking branch from git. See https://martinvonz.github.io/jj/latest/config/#automatic-local-branch-creation", + "description": "Whether jj creates a local bookmark with the same name when it imports a remote-tracking branch from git. See https://martinvonz.github.io/jj/latest/config/#automatic-local-bookmark-creation", "default": false }, "abandon-unreachable-commits": { @@ -448,18 +448,18 @@ }, "experimental-advance-branches": { "type": "object", - "description": "Settings controlling the 'advance-branches' feature which moves branches forward when new commits are created.", + "description": "Settings controlling the 'advance-branches' feature which moves bookmarks forward when new commits are created.", "properties": { "enabled-branches": { "type": "array", - "description": "Patterns used to identify branches which may be advanced.", + "description": "Patterns used to identify bookmarks which may be advanced.", "items": { "type": "string" } }, "disabled-branches": { "type": "array", - "description": "Patterns used to identify branches which are not advanced. Takes precedence over 'enabled-branches'.", + "description": "Patterns used to identify bookmarks which are not advanced. Takes precedence over 'enabled-branches'.", "items": { "type": "string" } diff --git a/cli/src/config/revsets.toml b/cli/src/config/revsets.toml index 253e16778b..5a840a5dbf 100644 --- a/cli/src/config/revsets.toml +++ b/cli/src/config/revsets.toml @@ -8,17 +8,17 @@ log = "@ | ancestors(immutable_heads().., 2) | trunk()" [revset-aliases] 'trunk()' = ''' latest( - remote_branches(exact:"main", exact:"origin") | - remote_branches(exact:"master", exact:"origin") | - remote_branches(exact:"trunk", exact:"origin") | - remote_branches(exact:"main", exact:"upstream") | - remote_branches(exact:"master", exact:"upstream") | - remote_branches(exact:"trunk", exact:"upstream") | + remote_bookmarks(exact:"main", exact:"origin") | + remote_bookmarks(exact:"master", exact:"origin") | + remote_bookmarks(exact:"trunk", exact:"origin") | + remote_bookmarks(exact:"main", exact:"upstream") | + remote_bookmarks(exact:"master", exact:"upstream") | + remote_bookmarks(exact:"trunk", exact:"upstream") | root() ) ''' -'builtin_immutable_heads()' = 'trunk() | tags() | untracked_remote_branches()' +'builtin_immutable_heads()' = 'trunk() | tags() | untracked_remote_bookmarks()' 'immutable_heads()' = 'builtin_immutable_heads()' 'immutable()' = '::(immutable_heads() | root())' 'mutable()' = '~immutable()' diff --git a/cli/src/git_util.rs b/cli/src/git_util.rs index 8e2e803e8d..1c98c6f5d8 100644 --- a/cli/src/git_util.rs +++ b/cli/src/git_util.rs @@ -375,13 +375,13 @@ impl RefStatus { let padded_ref_name = format!("{}{:>pad_width$}", self.ref_name, "", pad_width = pad_width); let ref_kind = match self.ref_kind { - RefKind::Branch => "branch: ", + RefKind::Branch => "bookmark: ", RefKind::Tag if !has_both_ref_kinds => "tag: ", RefKind::Tag => "tag: ", }; write!(out, "{ref_kind}")?; - write!(out.labeled("branch"), "{padded_ref_name}")?; + write!(out.labeled("bookmark"), "{padded_ref_name}")?; writeln!(out, " [{import_status}] {tracking_status}") } } @@ -405,29 +405,29 @@ enum ImportStatus { pub fn print_failed_git_export( ui: &Ui, - failed_branches: &[FailedRefExport], + failed_refs: &[FailedRefExport], ) -> Result<(), std::io::Error> { - if !failed_branches.is_empty() { - writeln!(ui.warning_default(), "Failed to export some branches:")?; + if !failed_refs.is_empty() { + writeln!(ui.warning_default(), "Failed to export some bookmarks:")?; let mut formatter = ui.stderr_formatter(); - for FailedRefExport { name, reason } in failed_branches { + for FailedRefExport { name, reason } in failed_refs { write!(formatter, " ")?; - write!(formatter.labeled("branch"), "{name}")?; + write!(formatter.labeled("bookmark"), "{name}")?; for err in iter::successors(Some(reason as &dyn error::Error), |err| err.source()) { write!(formatter, ": {err}")?; } writeln!(formatter)?; } drop(formatter); - if failed_branches + if failed_refs .iter() .any(|failed| matches!(failed.reason, FailedRefExportReason::FailedToSet(_))) { writeln!( ui.hint_default(), r#"Git doesn't allow a branch name that looks like a parent directory of -another (e.g. `foo` and `foo/bar`). Try to rename the branches that failed to -export or their "parent" branches."#, +another (e.g. `foo` and `foo/bar`). Try to rename the bookmarks that failed to +export or their "parent" bookmarks."#, )?; } } diff --git a/cli/src/revset_util.rs b/cli/src/revset_util.rs index 6d3eb93b92..0809a8808e 100644 --- a/cli/src/revset_util.rs +++ b/cli/src/revset_util.rs @@ -284,18 +284,18 @@ fn format_multiple_revisions_error( "Some of these commits have the same change id. Abandon one of them with `jj abandon \ -r `.", ); - } else if let RevsetExpression::CommitRef(RevsetCommitRef::Symbol(branch_name)) = expression { - // Separate hint if there's a conflicted branch + } else if let RevsetExpression::CommitRef(RevsetCommitRef::Symbol(bookmark_name)) = expression { + // Separate hint if there's a conflicted bookmark cmd_err.add_formatted_hint_with(|formatter| { writeln!( formatter, - "Branch {branch_name} resolved to multiple revisions because it's conflicted." + "Bookmark {bookmark_name} resolved to multiple revisions because it's conflicted." )?; writeln!(formatter, "It resolved to these revisions:")?; write_commits_summary(formatter) }); cmd_err.add_hint(format!( - "Set which revision the branch points to with `jj branch set {branch_name} -r \ + "Set which revision the bookmark points to with `jj bookmark set {bookmark_name} -r \ `.", )); } else { diff --git a/cli/testing/bench-revsets-git.txt b/cli/testing/bench-revsets-git.txt index 45d308f561..77d8c8d091 100644 --- a/cli/testing/bench-revsets-git.txt +++ b/cli/testing/bench-revsets-git.txt @@ -16,11 +16,11 @@ v2.39.0::v2.40.0 # Mostly recent history v2.40.0-.. ~(::v2.40.0) -# Tags and branches +# Tags and bookmarks tags() -branches() +bookmarks() # Local changes -(tags() | remote_branches()).. +(tags() | remote_bookmarks()).. # Intersection of range with a small subset tags() & ::v2.40.0 v2.39.0 & ::v2.40.0 diff --git a/cli/tests/cli-reference@.md.snap b/cli/tests/cli-reference@.md.snap index 080444e9e9..f8ef40f15d 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -394,11 +394,11 @@ Start tracking given remote bookmarks A tracking remote bookmark will be imported as a local bookmark of the same name. Changes to it will propagate to the existing local bookmark on future pulls. -**Usage:** `jj bookmark track ...` +**Usage:** `jj bookmark track ...` ###### **Arguments:** -* `` — Remote bookmarks to track +* `` — Remote bookmarks to track By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns. @@ -412,11 +412,11 @@ Stop tracking given remote bookmarks 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. -**Usage:** `jj bookmark untrack ...` +**Usage:** `jj bookmark untrack ...` ###### **Arguments:** -* `` — Remote bookmarks to untrack +* `` — Remote bookmarks to untrack By default, the specified name matches exactly. Use `glob:` prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns. @@ -608,7 +608,7 @@ Compare file contents between two revisions With the `-r` option, which is the default, shows the changes compared to the parent revision. If there are several parent revisions (i.e., the given revision is a merge), then they will be merged and the changes from the result to the given revision will be shown. -With the `--from` and/or `--to` options, shows the difference from/to the given revisions. If either is left out, it defaults to the working-copy commit. For example, `jj diff --from main` shows the changes from "main" (perhaps a branch name) to the working-copy commit. +With the `--from` and/or `--to` options, shows the difference from/to the given revisions. If either is left out, it defaults to the working-copy commit. For example, `jj diff --from main` shows the changes from "main" (perhaps a bookmark name) to the working-copy commit. **Usage:** `jj diff [OPTIONS] [PATHS]...` @@ -1075,7 +1075,7 @@ The Git repo will be a bare git repo stored inside the `.jj/` directory. * `add` — Add a Git remote * `list` — List Git remotes -* `remove` — Remove a Git remote and forget its branches +* `remove` — Remove a Git remote and forget its bookmarks * `rename` — Rename a Git remote * `set-url` — Set the URL of a Git remote @@ -1104,7 +1104,7 @@ List Git remotes ## `jj git remote remove` -Remove a Git remote and forget its branches +Remove a Git remote and forget its bookmarks **Usage:** `jj git remote remove ` @@ -1234,7 +1234,7 @@ Create a new, empty change and (by default) edit it in the working copy By default, `jj` will edit the new change, making the working copy represent the new commit. This can be avoided with `--no-edit`. -Note that you can create a merge commit by specifying multiple revisions as argument. For example, `jj new main @` will create a new commit with the `main` branch and the working copy as parents. +Note that you can create a merge commit by specifying multiple revisions as argument. For example, `jj new main @` will create a new commit with the `main` bookmark and the working copy as parents. For more information, see https://martinvonz.github.io/jj/latest/working-copy/. @@ -1433,9 +1433,9 @@ This restores the repo to the state at the specified operation, effectively undo Possible values: - `repo`: - The jj repo state and local branches + The jj repo state and local bookmarks - `remote-tracking`: - The remote-tracking branches. Do not restore these if you'd like to push after the undo + The remote-tracking bookmarks. Do not restore these if you'd like to push after the undo @@ -1499,9 +1499,9 @@ This undoes an individual operation by applying the inverse of the operation. Possible values: - `repo`: - The jj repo state and local branches + The jj repo state and local bookmarks - `remote-tracking`: - The remote-tracking branches. Do not restore these if you'd like to push after the undo + The remote-tracking bookmarks. Do not restore these if you'd like to push after the undo @@ -2087,9 +2087,9 @@ Undo an operation (shortcut for `jj op undo`) Possible values: - `repo`: - The jj repo state and local branches + The jj repo state and local bookmarks - `remote-tracking`: - The remote-tracking branches. Do not restore these if you'd like to push after the undo + The remote-tracking bookmarks. Do not restore these if you'd like to push after the undo diff --git a/cli/tests/test_bookmark_command.rs b/cli/tests/test_bookmark_command.rs index cfa29731cb..e9462315ba 100644 --- a/cli/tests/test_bookmark_command.rs +++ b/cli/tests/test_bookmark_command.rs @@ -98,7 +98,7 @@ fn test_bookmark_at_root() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Nothing changed. - Warning: Failed to export some branches: + Warning: Failed to export some bookmarks: fred: Ref cannot point to the root commit in Git "###); } @@ -773,7 +773,7 @@ fn test_bookmark_forget_fetched_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: feature1@origin [new] tracked + bookmark: feature1@origin [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" feature1: mzyxwzks 9f01a0e0 message @@ -787,7 +787,7 @@ fn test_bookmark_forget_fetched_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: feature1@origin [new] tracked + bookmark: feature1@origin [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" feature1: mzyxwzks 9f01a0e0 message @@ -817,7 +817,7 @@ fn test_bookmark_forget_fetched_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: feature1@origin [new] tracked + bookmark: feature1@origin [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" feature1: ooosovrs 38aefb17 (empty) another message @@ -931,9 +931,9 @@ fn test_bookmark_track_untrack() { test_env.add_config("git.auto-local-branch = false"); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::assert_snapshot!(stderr, @r###" - branch: feature1@origin [new] untracked - branch: feature2@origin [new] untracked - branch: main@origin [new] untracked + bookmark: feature1@origin [new] untracked + bookmark: feature2@origin [new] untracked + bookmark: main@origin [new] untracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" feature1@origin: sptzoqmo 7b33f629 commit 1 @@ -974,7 +974,7 @@ fn test_bookmark_track_untrack() { @origin: sptzoqmo 7b33f629 commit 1 "###); - // Untrack existing and locally-deleted bookmarks. Branch targets should be + // Untrack existing and locally-deleted bookmarks. Bookmark targets should be // unchanged test_env.jj_cmd_ok(&repo_path, &["bookmark", "delete", "feature2"]); test_env.jj_cmd_ok( @@ -1007,9 +1007,9 @@ fn test_bookmark_track_untrack() { ); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::assert_snapshot!(stderr, @r###" - branch: feature1@origin [updated] untracked - branch: feature2@origin [updated] untracked - branch: main@origin [updated] tracked + bookmark: feature1@origin [updated] untracked + bookmark: feature2@origin [updated] untracked + bookmark: main@origin [updated] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" feature1: sptzoqmo 7b33f629 commit 1 @@ -1042,10 +1042,10 @@ fn test_bookmark_track_untrack() { test_env.add_config("git.auto-local-branch = true"); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::assert_snapshot!(stderr, @r###" - branch: feature1@origin [updated] untracked - branch: feature2@origin [updated] untracked - branch: feature3@origin [new] tracked - branch: main@origin [updated] tracked + bookmark: feature1@origin [updated] untracked + bookmark: feature2@origin [updated] untracked + bookmark: feature3@origin [new] tracked + bookmark: main@origin [updated] tracked Abandoned 1 commits that are no longer reachable. "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" @@ -1133,15 +1133,15 @@ fn test_bookmark_track_untrack_patterns() { test_env.add_config("git.auto-local-branch = false"); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::assert_snapshot!(stderr, @r###" - branch: feature1@origin [new] untracked - branch: feature2@origin [new] untracked + bookmark: feature1@origin [new] untracked + bookmark: feature2@origin [new] untracked "###); // Track local bookmark test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "main"]); insta::assert_snapshot!( test_env.jj_cmd_cli_error(&repo_path, &["bookmark", "track", "main"]), @r###" - error: invalid value 'main' for '...': remote bookmark must be specified in bookmark@remote form + error: invalid value 'main' for '...': remote bookmark must be specified in bookmark@remote form For more information, try '--help'. "###); diff --git a/cli/tests/test_git_clone.rs b/cli/tests/test_git_clone.rs index c6178d4dc8..462b18a83a 100644 --- a/cli/tests/test_git_clone.rs +++ b/cli/tests/test_git_clone.rs @@ -67,7 +67,7 @@ fn test_git_clone() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Fetching into new repo in "$TEST_ENV/clone" - branch: main@origin [new] tracked + bookmark: main@origin [new] tracked Setting the revset alias "trunk()" to "main@origin" Working copy now at: uuqppmxq 1f0b881a (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message @@ -149,7 +149,7 @@ fn test_git_clone() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Fetching into new repo in "$TEST_ENV/nested/path/to/repo" - branch: main@origin [new] tracked + bookmark: main@origin [new] tracked Setting the revset alias "trunk()" to "main@origin" Working copy now at: uuzqqzqu df8acbac (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message @@ -194,7 +194,7 @@ fn test_git_clone_colocate() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Fetching into new repo in "$TEST_ENV/clone" - branch: main@origin [new] tracked + bookmark: main@origin [new] tracked Setting the revset alias "trunk()" to "main@origin" Working copy now at: uuqppmxq 1f0b881a (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message @@ -342,7 +342,7 @@ fn test_git_clone_colocate() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Fetching into new repo in "$TEST_ENV/nested/path/to/repo" - branch: main@origin [new] tracked + bookmark: main@origin [new] tracked Setting the revset alias "trunk()" to "main@origin" Working copy now at: vzqnnsmr 9407107f (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message @@ -372,8 +372,8 @@ fn test_git_clone_remote_default_bookmark() { test_env.jj_cmd_ok(test_env.env_root(), &["git", "clone", "source", "clone1"]); insta::assert_snapshot!(stderr, @r###" Fetching into new repo in "$TEST_ENV/clone1" - branch: feature1@origin [new] tracked - branch: main@origin [new] tracked + bookmark: feature1@origin [new] tracked + bookmark: main@origin [new] tracked Setting the revset alias "trunk()" to "main@origin" Working copy now at: sqpuoqvx cad212e1 (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 feature1 main | message @@ -402,8 +402,8 @@ fn test_git_clone_remote_default_bookmark() { test_env.jj_cmd_ok(test_env.env_root(), &["git", "clone", "source", "clone2"]); insta::assert_snapshot!(stderr, @r###" Fetching into new repo in "$TEST_ENV/clone2" - branch: feature1@origin [new] untracked - branch: main@origin [new] untracked + bookmark: feature1@origin [new] untracked + bookmark: main@origin [new] untracked Setting the revset alias "trunk()" to "main@origin" Working copy now at: rzvqmyuk cc8a5041 (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 feature1@origin main | message @@ -422,8 +422,8 @@ fn test_git_clone_remote_default_bookmark() { test_env.jj_cmd_ok(test_env.env_root(), &["git", "clone", "source", "clone3"]); insta::assert_snapshot!(stderr, @r###" Fetching into new repo in "$TEST_ENV/clone3" - branch: feature1@origin [new] untracked - branch: main@origin [new] untracked + bookmark: feature1@origin [new] untracked + bookmark: main@origin [new] untracked Setting the revset alias "trunk()" to "feature1@origin" Working copy now at: nppvrztz b8a8a17b (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 feature1 main@origin | message @@ -460,7 +460,7 @@ fn test_git_clone_ignore_working_copy() { ); insta::assert_snapshot!(stderr, @r###" Fetching into new repo in "$TEST_ENV/clone" - branch: main@origin [new] untracked + bookmark: main@origin [new] untracked Setting the revset alias "trunk()" to "main@origin" "###); let clone_path = test_env.env_root().join("clone"); diff --git a/cli/tests/test_git_colocated.rs b/cli/tests/test_git_colocated.rs index e75e26d007..37885ad39e 100644 --- a/cli/tests/test_git_colocated.rs +++ b/cli/tests/test_git_colocated.rs @@ -404,7 +404,7 @@ fn test_git_colocated_bookmark_at_root() { test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "foo", "-r=root()"]); insta::assert_snapshot!(stderr, @r###" Created 1 bookmarks pointing to zzzzzzzz 00000000 foo | (empty) (no description set) - Warning: Failed to export some branches: + Warning: Failed to export some bookmarks: foo: Ref cannot point to the root commit in Git "###); @@ -425,7 +425,7 @@ fn test_git_colocated_bookmark_at_root() { ); insta::assert_snapshot!(stderr, @r###" Moved 1 bookmarks to zzzzzzzz 00000000 foo* | (empty) (no description set) - Warning: Failed to export some branches: + Warning: Failed to export some bookmarks: foo: Ref cannot point to the root commit in Git "###); } @@ -442,11 +442,11 @@ fn test_git_colocated_conflicting_git_refs() { insta::with_settings!({filters => vec![("Failed to set: .*", "Failed to set: ...")]}, { insta::assert_snapshot!(stderr, @r###" Created 1 bookmarks pointing to qpvuntsm 230dd059 main main/sub | (empty) (no description set) - Warning: Failed to export some branches: + Warning: Failed to export some bookmarks: main/sub: Failed to set: ... Hint: Git doesn't allow a branch name that looks like a parent directory of - another (e.g. `foo` and `foo/bar`). Try to rename the branches that failed to - export or their "parent" branches. + another (e.g. `foo` and `foo/bar`). Try to rename the bookmarks that failed to + export or their "parent" bookmarks. "###); }); } @@ -547,8 +547,8 @@ fn test_git_colocated_fetch_deleted_or_moved_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&clone_path, &["git", "fetch"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: B_to_delete@origin [deleted] untracked - branch: C_to_move@origin [updated] tracked + bookmark: B_to_delete@origin [deleted] untracked + bookmark: C_to_move@origin [updated] tracked Abandoned 2 commits that are no longer reachable. "###); // "original C" and "B_to_delete" are abandoned, as the corresponding bookmarks @@ -595,7 +595,7 @@ fn test_git_colocated_rebase_dirty_working_copy() { Use `jj bookmark list` to see details. Use `jj bookmark set -r ` to resolve. "###); insta::assert_snapshot!(stderr, @r###" - Warning: Failed to export some branches: + Warning: Failed to export some bookmarks: feature: Modified ref had been deleted in Git Done importing changes from the underlying Git repo. "###); diff --git a/cli/tests/test_git_fetch.rs b/cli/tests/test_git_fetch.rs index 17922e4b76..977ee63ea7 100644 --- a/cli/tests/test_git_fetch.rs +++ b/cli/tests/test_git_fetch.rs @@ -111,7 +111,7 @@ fn test_git_fetch_single_remote() { let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::assert_snapshot!(stderr, @r###" Hint: Fetching from the only existing remote: rem1 - branch: rem1@rem1 [new] tracked + bookmark: rem1@rem1 [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" rem1: qxosxrvv 6a211027 message @@ -238,7 +238,7 @@ fn test_git_fetch_nonexistent_remote() { &["git", "fetch", "--remote", "rem1", "--remote", "rem2"], ); insta::assert_snapshot!(stderr, @r###" - branch: rem1@rem1 [new] untracked + bookmark: rem1@rem1 [new] untracked Error: No git remote named 'rem2' "###); // No remote should have been fetched as part of the failing transaction @@ -255,7 +255,7 @@ fn test_git_fetch_nonexistent_remote_from_config() { let stderr = &test_env.jj_cmd_failure(&repo_path, &["git", "fetch"]); insta::assert_snapshot!(stderr, @r###" - branch: rem1@rem1 [new] untracked + bookmark: rem1@rem1 [new] untracked Error: No git remote named 'rem2' "###); // No remote should have been fetched as part of the failing transaction @@ -467,10 +467,10 @@ fn test_git_fetch_all() { let (stdout, stderr) = test_env.jj_cmd_ok(&target_jj_repo_path, &["git", "fetch"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a1@origin [new] tracked - branch: a2@origin [new] tracked - branch: b@origin [new] tracked - branch: trunk1@origin [new] tracked + bookmark: a1@origin [new] tracked + bookmark: a2@origin [new] tracked + bookmark: b@origin [new] tracked + bookmark: trunk1@origin [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" a1: nknoxmzm 359a9a02 descr_for_a1 @@ -539,10 +539,10 @@ fn test_git_fetch_all() { let (stdout, stderr) = test_env.jj_cmd_ok(&target_jj_repo_path, &["git", "fetch"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a1@origin [updated] tracked - branch: a2@origin [updated] tracked - branch: b@origin [updated] tracked - branch: trunk2@origin [new] tracked + bookmark: a1@origin [updated] tracked + bookmark: a2@origin [updated] tracked + bookmark: b@origin [updated] tracked + bookmark: trunk2@origin [new] tracked Abandoned 2 commits that are no longer reachable. "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" @@ -631,7 +631,7 @@ fn test_git_fetch_some_of_many_bookmarks() { test_env.jj_cmd_ok(&target_jj_repo_path, &["git", "fetch", "--branch", "b"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: b@origin [new] tracked + bookmark: b@origin [new] tracked "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" ○ c7d4bdcbc215 descr_for_b b @@ -652,8 +652,8 @@ fn test_git_fetch_some_of_many_bookmarks() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a1@origin [new] tracked - branch: a2@origin [new] tracked + bookmark: a1@origin [new] tracked + bookmark: a2@origin [new] tracked "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" ○ decaa3966c83 descr_for_a2 a2 @@ -723,8 +723,8 @@ fn test_git_fetch_some_of_many_bookmarks() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a1@origin [updated] tracked - branch: b@origin [updated] tracked + bookmark: a1@origin [updated] tracked + bookmark: b@origin [updated] tracked Abandoned 1 commits that are no longer reachable. "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" @@ -762,7 +762,7 @@ fn test_git_fetch_some_of_many_bookmarks() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a2@origin [updated] tracked + bookmark: a2@origin [updated] tracked Abandoned 1 commits that are no longer reachable. "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" @@ -831,8 +831,8 @@ fn test_git_fetch_undo() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a1@origin [new] tracked - branch: b@origin [new] tracked + bookmark: a1@origin [new] tracked + bookmark: b@origin [new] tracked "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" ○ c7d4bdcbc215 descr_for_b b @@ -856,7 +856,7 @@ fn test_git_fetch_undo() { test_env.jj_cmd_ok(&target_jj_repo_path, &["git", "fetch", "--branch", "b"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: b@origin [new] tracked + bookmark: b@origin [new] tracked "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" ○ c7d4bdcbc215 descr_for_b b @@ -908,7 +908,7 @@ fn test_fetch_undo_what() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--branch", "b"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: b@origin [new] tracked + bookmark: b@origin [new] tracked "###); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" ○ c7d4bdcbc215 descr_for_b b @@ -996,7 +996,7 @@ fn test_git_fetch_remove_fetch() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: origin@origin [new] tracked + bookmark: origin@origin [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" origin (conflicted): @@ -1081,10 +1081,10 @@ fn test_git_fetch_removed_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&target_jj_repo_path, &["git", "fetch"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a1@origin [new] tracked - branch: a2@origin [new] tracked - branch: b@origin [new] tracked - branch: trunk1@origin [new] tracked + bookmark: a1@origin [new] tracked + bookmark: a2@origin [new] tracked + bookmark: b@origin [new] tracked + bookmark: trunk1@origin [new] tracked "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" ○ c7d4bdcbc215 descr_for_b b @@ -1125,7 +1125,7 @@ fn test_git_fetch_removed_bookmark() { test_env.jj_cmd_ok(&target_jj_repo_path, &["git", "fetch", "--branch", "a2"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a2@origin [deleted] untracked + bookmark: a2@origin [deleted] untracked Abandoned 1 commits that are no longer reachable. "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" @@ -1173,10 +1173,10 @@ fn test_git_fetch_removed_parent_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&target_jj_repo_path, &["git", "fetch"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a1@origin [new] tracked - branch: a2@origin [new] tracked - branch: b@origin [new] tracked - branch: trunk1@origin [new] tracked + bookmark: a1@origin [new] tracked + bookmark: a2@origin [new] tracked + bookmark: b@origin [new] tracked + bookmark: trunk1@origin [new] tracked "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" ○ c7d4bdcbc215 descr_for_b b @@ -1204,8 +1204,8 @@ fn test_git_fetch_removed_parent_bookmark() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a1@origin [deleted] untracked - branch: trunk1@origin [deleted] untracked + bookmark: a1@origin [deleted] untracked + bookmark: trunk1@origin [deleted] untracked Abandoned 1 commits that are no longer reachable. "###); insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" diff --git a/cli/tests/test_git_import_export.rs b/cli/tests/test_git_import_export.rs index 1474191511..72f29bb5da 100644 --- a/cli/tests/test_git_import_export.rs +++ b/cli/tests/test_git_import_export.rs @@ -67,11 +67,11 @@ fn test_git_export_conflicting_git_refs() { insta::assert_snapshot!(stdout, @""); insta::with_settings!({filters => vec![("Failed to set: .*", "Failed to set: ...")]}, { insta::assert_snapshot!(stderr, @r###" - Warning: Failed to export some branches: + Warning: Failed to export some bookmarks: main/sub: Failed to set: ... Hint: Git doesn't allow a branch name that looks like a parent directory of - another (e.g. `foo` and `foo/bar`). Try to rename the branches that failed to - export or their "parent" branches. + another (e.g. `foo` and `foo/bar`). Try to rename the bookmarks that failed to + export or their "parent" bookmarks. "###); }); } @@ -149,7 +149,7 @@ fn test_git_import_undo() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a [new] tracked + bookmark: a [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" a: qpvuntsm 230dd059 (empty) (no description set) @@ -165,7 +165,7 @@ fn test_git_import_undo() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a [new] tracked + bookmark: a [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" a: qpvuntsm 230dd059 (empty) (no description set) @@ -196,7 +196,7 @@ fn test_git_import_move_export_with_default_undo() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a [new] tracked + bookmark: a [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" a: qpvuntsm 230dd059 (empty) (no description set) @@ -244,7 +244,7 @@ fn test_git_import_move_export_with_default_undo() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - branch: a [new] tracked + bookmark: a [new] tracked "###); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" a: yqosqzyt 096dc80d (empty) (no description set) diff --git a/cli/tests/test_git_private_commits.rs b/cli/tests/test_git_private_commits.rs index 101275f335..1faef6e255 100644 --- a/cli/tests/test_git_private_commits.rs +++ b/cli/tests/test_git_private_commits.rs @@ -89,7 +89,7 @@ fn test_git_private_commits_block_pushing() { test_env.add_config(r#"git.private-commits = "none()""#); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark main from 7eb97bf230ad to aa3058ff8663 Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Working copy now at: znkkpsqq 2e1adf47 (empty) (no description set) @@ -117,7 +117,7 @@ fn test_git_private_commits_can_be_overridden() { &["git", "push", "--all", "--allow-private"], ); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark main from 7eb97bf230ad to aa3058ff8663 Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Working copy now at: znkkpsqq 2e1adf47 (empty) (no description set) @@ -136,7 +136,7 @@ fn test_git_private_commits_are_not_checked_if_immutable() { test_env.add_config(r#"revset-aliases."immutable_heads()" = "all()""#); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark main from 7eb97bf230ad to aa3058ff8663 Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Working copy now at: yostqsxw dce4a15c (empty) (no description set) @@ -172,7 +172,7 @@ fn test_git_private_commits_descending_from_commits_pushed_do_not_block_pushing( test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark main from 7eb97bf230ad to 05ef53bc99ec "###); } @@ -195,7 +195,7 @@ fn test_git_private_commits_already_on_the_remote_do_not_block_push() { let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main", "-b=bookmark1"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark main from 7eb97bf230ad to fbb352762352 Add bookmark bookmark1 to 7eb97bf230ad Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. @@ -212,7 +212,7 @@ fn test_git_private_commits_already_on_the_remote_do_not_block_push() { ); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark bookmark1 from 7eb97bf230ad to fbb352762352 "###); @@ -225,7 +225,7 @@ fn test_git_private_commits_already_on_the_remote_do_not_block_push() { test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "bookmark2"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=bookmark2"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark bookmark2 to ee5b808b0b95 "###); } @@ -243,7 +243,7 @@ fn test_git_private_commits_are_evaluated_separately_for_each_remote() { test_env.jj_cmd_ok(&workspace_root, &["bookmark", "set", "main"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark main from 7eb97bf230ad to d8632ce893ab "###); diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index 00bf98ffc7..9259278ff4 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -91,7 +91,7 @@ fn test_git_push_current_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--dry-run"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark bookmark2 from 8476341eb395 to bc7610b65a91 Add bookmark my-bookmark to bc7610b65a91 Dry-run requested, not pushing. @@ -99,7 +99,7 @@ fn test_git_push_current_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark bookmark2 from 8476341eb395 to bc7610b65a91 Add bookmark my-bookmark to bc7610b65a91 "###); @@ -135,7 +135,7 @@ fn test_git_push_current_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-bbookmark2"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move backward bookmark bookmark2 from bc7610b65a91 to 8476341eb395 "###); } @@ -154,7 +154,7 @@ fn test_git_push_parent_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move sideways bookmark bookmark1 from d13ecdbda2a2 to e612d524a5c6 "###); } @@ -214,7 +214,7 @@ fn test_git_push_other_remote_has_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move sideways bookmark bookmark1 from d13ecdbda2a2 to a657f1b61b94 "###); // Since it's already pushed to origin, nothing will happen if push again @@ -235,7 +235,7 @@ fn test_git_push_other_remote_has_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--remote=other"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to other: + Bookmark changes to push to other: Add bookmark bookmark1 to a657f1b61b94 "###); } @@ -259,7 +259,7 @@ fn test_git_push_forward_unexpectedly_moved() { // Pushing should fail let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark bookmark1 from d13ecdbda2a2 to 6750425ff51c Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. @@ -299,7 +299,7 @@ fn test_git_push_sideways_unexpectedly_moved() { let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move sideways bookmark bookmark1 from d13ecdbda2a2 to 0f8bf988588e Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. @@ -337,7 +337,7 @@ fn test_git_push_deletion_unexpectedly_moved() { let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--bookmark", "bookmark1"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. @@ -376,7 +376,7 @@ fn test_git_push_unexpectedly_deleted() { // Pushing a moved bookmark fails if deleted on remote let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move sideways bookmark bookmark1 from d13ecdbda2a2 to 1ebe27ba04bf Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. @@ -394,7 +394,7 @@ fn test_git_push_unexpectedly_deleted() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-bbookmark1"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 "###); } @@ -418,7 +418,7 @@ fn test_git_push_creation_unexpectedly_already_exists() { let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark bookmark1 to cb17dcdc74d5 Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. @@ -436,7 +436,7 @@ fn test_git_push_locally_created_and_rewritten() { test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "my"]); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark my to fcc999921ce9 "###); @@ -453,7 +453,7 @@ fn test_git_push_locally_created_and_rewritten() { "###); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move sideways bookmark my from fcc999921ce9 to bde1d2e44b2a "###); } @@ -481,7 +481,7 @@ fn test_git_push_multiple() { test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all", "--dry-run"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92 Add bookmark my-bookmark to c4a3c3105d92 @@ -494,7 +494,7 @@ fn test_git_push_multiple() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Add bookmark my-bookmark to c4a3c3105d92 Dry-run requested, not pushing. @@ -514,7 +514,7 @@ fn test_git_push_multiple() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Add bookmark my-bookmark to c4a3c3105d92 Dry-run requested, not pushing. @@ -526,7 +526,7 @@ fn test_git_push_multiple() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92 Dry-run requested, not pushing. @@ -548,7 +548,7 @@ fn test_git_push_multiple() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92 Add bookmark my-bookmark to c4a3c3105d92 @@ -583,7 +583,7 @@ fn test_git_push_changes() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Creating bookmark push-yostqsxwqrlt for revision yostqsxwqrlt - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark push-yostqsxwqrlt to cf1a53a8800a "###); // test pushing two changes at once @@ -601,7 +601,7 @@ fn test_git_push_changes() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Creating bookmark push-yqosqzytrlsw for revision yqosqzytrlsw - Branch changes to push to origin: + Bookmark changes to push to origin: Move sideways bookmark push-yostqsxwqrlt from cf1a53a8800a to 16c169664e9f Add bookmark push-yqosqzytrlsw to a050abf4ff07 "###); @@ -610,7 +610,7 @@ fn test_git_push_changes() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-c=all:(@|@)"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move sideways bookmark push-yostqsxwqrlt from 16c169664e9f to ef6313d50ac1 "###); @@ -622,7 +622,7 @@ fn test_git_push_changes() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move sideways bookmark push-yostqsxwqrlt from ef6313d50ac1 to c1e65d3a64ce "###); @@ -651,7 +651,7 @@ fn test_git_push_changes() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move sideways bookmark push-yostqsxwqrlt from c1e65d3a64ce to 38cb417ce3a6 "###); let stdout = test_env.jj_cmd_success(&workspace_root, &["status"]); @@ -676,7 +676,7 @@ fn test_git_push_changes() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Creating bookmark test-yostqsxwqrlt for revision yostqsxwqrlt - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark test-yostqsxwqrlt to 38cb417ce3a6 "###); } @@ -712,7 +712,7 @@ fn test_git_push_revisions() { test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=@-", "--dry-run"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark bookmark-1 to 5f432a855e59 Dry-run requested, not pushing. "###); @@ -724,7 +724,7 @@ fn test_git_push_revisions() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Warning: No bookmarks point to the specified revisions: @-- - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark bookmark-1 to 5f432a855e59 Dry-run requested, not pushing. "###); @@ -733,7 +733,7 @@ fn test_git_push_revisions() { test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-r=@", "--dry-run"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark bookmark-2a to 84f499037f5c Add bookmark bookmark-2b to 84f499037f5c Dry-run requested, not pushing. @@ -745,7 +745,7 @@ fn test_git_push_revisions() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark bookmark-1 to 5f432a855e59 Dry-run requested, not pushing. "###); @@ -777,7 +777,7 @@ fn test_git_push_mixed() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" Creating bookmark push-yqosqzytrlsw for revision yqosqzytrlsw - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark push-yqosqzytrlsw to a050abf4ff07 Add bookmark bookmark-1 to 5f432a855e59 Add bookmark bookmark-2a to 84f499037f5c @@ -802,7 +802,7 @@ fn test_git_push_existing_long_bookmark() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--change=@"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark push-19b790168e73f7a73a98deae21e807c0 to a050abf4ff07 "###); } @@ -882,7 +882,7 @@ fn test_git_push_no_description_in_immutable() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark my-bookmark to ea7373507ad9 Dry-run requested, not pushing. "###); @@ -950,7 +950,7 @@ fn test_git_push_missing_author_in_immutable() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark my-bookmark to 68fdae89de4f Dry-run requested, not pushing. "###); @@ -1029,7 +1029,7 @@ fn test_git_push_missing_committer_in_immutable() { ); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark my-bookmark to c79f85e90b4a Dry-run requested, not pushing. "###); @@ -1043,7 +1043,7 @@ fn test_git_push_deleted() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--deleted"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 "###); let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-rall()"]); @@ -1101,7 +1101,7 @@ fn test_git_push_conflicting_bookmarks() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Warning: Branch bookmark2 is conflicted + Warning: Bookmark bookmark2 is conflicted Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. Nothing changed. "###); @@ -1110,7 +1110,7 @@ fn test_git_push_conflicting_bookmarks() { let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--bookmark", "bookmark2"]); insta::assert_snapshot!(stderr, @r###" - Error: Branch bookmark2 is conflicted + Error: Bookmark bookmark2 is conflicted Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. "###); @@ -1119,9 +1119,9 @@ fn test_git_push_conflicting_bookmarks() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Warning: Branch bookmark2 is conflicted + Warning: Bookmark bookmark2 is conflicted Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark bookmark1 from d13ecdbda2a2 to 8df52121b022 "###); @@ -1130,9 +1130,9 @@ fn test_git_push_conflicting_bookmarks() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-rall()"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" - Warning: Branch bookmark2 is conflicted + Warning: Bookmark bookmark2 is conflicted Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark bookmark1 from 8df52121b022 to 345e1f64a64d "###); } @@ -1183,7 +1183,7 @@ fn test_git_push_tracked_vs_all() { let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--tracked", "--dry-run"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Delete bookmark bookmark2 from 8476341eb395 Dry-run requested, not pushing. "###); @@ -1226,7 +1226,7 @@ fn test_git_push_tracked_vs_all() { insta::assert_snapshot!(stderr, @r###" Warning: Non-tracking remote bookmark bookmark1@origin exists Hint: Run `jj bookmark track bookmark1@origin` to import the remote bookmark. - Branch changes to push to origin: + Bookmark changes to push to origin: Add bookmark bookmark3 to 1aa4f1f2ef7f "###); } @@ -1285,7 +1285,7 @@ fn test_git_push_to_remote_named_git() { let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--all", "--remote=git"]); insta::assert_snapshot!(stderr, @r###" - Branch changes to push to git: + Bookmark changes to push to git: Add bookmark bookmark1 to d13ecdbda2a2 Add bookmark bookmark2 to 8476341eb395 Error: Git remote named 'git' is reserved for local Git repository diff --git a/cli/tests/test_new_command.rs b/cli/tests/test_new_command.rs index f466f11f8f..35f9ec87ee 100644 --- a/cli/tests/test_new_command.rs +++ b/cli/tests/test_new_command.rs @@ -643,11 +643,11 @@ fn test_new_conflicting_bookmarks() { let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "foo"]); insta::assert_snapshot!(stderr, @r###" Error: Revset "foo" resolved to more than one revision - Hint: Branch foo resolved to multiple revisions because it's conflicted. + Hint: Bookmark foo resolved to multiple revisions because it's conflicted. It resolved to these revisions: kkmpptxz 66c6502d foo?? | (empty) two qpvuntsm 876f4b7e foo?? | (empty) one - Hint: Set which revision the branch points to with `jj branch set foo -r `. + Hint: Set which revision the bookmark points to with `jj bookmark set foo -r `. "###); } diff --git a/cli/tests/test_operations.rs b/cli/tests/test_operations.rs index c754c9cecb..0784d1adc3 100644 --- a/cli/tests/test_operations.rs +++ b/cli/tests/test_operations.rs @@ -890,12 +890,12 @@ fn test_op_diff() { ○ Change qpvuntsmwlqt - qpvuntsm hidden 230dd059 (empty) (no description set) - Changed local branches: + Changed local bookmarks: bookmark-1: + ulyvmwyz 1d843d1f bookmark-1 | Commit 1 - (absent) - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + tracked ulyvmwyz 1d843d1f bookmark-1 | Commit 1 - untracked ulyvmwyz 1d843d1f bookmark-1 | Commit 1 @@ -921,12 +921,12 @@ fn test_op_diff() { ○ Change zzzzzzzzzzzz + zzzzzzzz 00000000 (empty) (no description set) - Changed local branches: + Changed local bookmarks: bookmark-1: + ulyvmwyz 1d843d1f bookmark-1 | Commit 1 - (absent) - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + tracked ulyvmwyz 1d843d1f bookmark-1 | Commit 1 - untracked (absent) @@ -956,12 +956,12 @@ fn test_op_diff() { ○ Change zzzzzzzzzzzz - zzzzzzzz hidden 00000000 (empty) (no description set) - Changed local branches: + Changed local bookmarks: bookmark-1: + (absent) - ulyvmwyz hidden 1d843d1f Commit 1 - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + untracked (absent) - tracked ulyvmwyz hidden 1d843d1f Commit 1 @@ -1024,7 +1024,7 @@ fn test_op_diff() { From operation ea112f6a02be: check out git remote's default branch To operation f534dfc3151b: reconcile divergent operations - Changed local branches: + Changed local bookmarks: bookmark-1: + (added) ulyvmwyz 1d843d1f bookmark-1?? bookmark-1@origin | Commit 1 + (added) yuvsmzqk 3d9189bc bookmark-1?? bookmark-2@origin | Commit 2 @@ -1047,13 +1047,13 @@ fn test_op_diff() { ○ Change qpvuntsmwlqt - qpvuntsm hidden 230dd059 (empty) (no description set) - Changed local branches: + Changed local bookmarks: bookmark-1: + (added) ulyvmwyz 1d843d1f bookmark-1?? bookmark-1@origin | Commit 1 + (added) yuvsmzqk 3d9189bc bookmark-1?? bookmark-2@origin | Commit 2 - yuvsmzqk 3d9189bc bookmark-1?? bookmark-2@origin | Commit 2 - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + tracked ulyvmwyz 1d843d1f bookmark-1?? bookmark-1@origin | Commit 1 - untracked ulyvmwyz 1d843d1f bookmark-1?? bookmark-1@origin | Commit 1 @@ -1065,9 +1065,9 @@ fn test_op_diff() { insta::assert_snapshot!(&stdout, @r###" "###); insta::assert_snapshot!(&stderr, @r###" - branch: bookmark-1@origin [updated] tracked - branch: bookmark-2@origin [updated] untracked - branch: bookmark-3@origin [deleted] untracked + bookmark: bookmark-1@origin [updated] tracked + bookmark: bookmark-2@origin [updated] untracked + bookmark: bookmark-3@origin [deleted] untracked Abandoned 1 commits that are no longer reachable. "###); let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); @@ -1083,14 +1083,14 @@ fn test_op_diff() { ○ Change tqyxmsztkvot - tqyxmszt hidden 3e785984 Commit 3 - Changed local branches: + Changed local bookmarks: bookmark-1: + (added) slvtnnzx 4f856199 bookmark-1?? bookmark-1@origin | Commit 4 + (added) yuvsmzqk 3d9189bc bookmark-1?? | Commit 2 - (added) ulyvmwyz 1d843d1f Commit 1 - (added) yuvsmzqk 3d9189bc bookmark-1?? | Commit 2 - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + tracked slvtnnzx 4f856199 bookmark-1?? bookmark-1@origin | Commit 4 - tracked ulyvmwyz 1d843d1f Commit 1 @@ -1123,7 +1123,7 @@ fn test_op_diff() { From operation 8a21e297a587: fetch from git remote(s) origin To operation ef314062f7f5: create bookmark bookmark-2 pointing to commit d487febd08e690ee775a4e0387e30d544307e409 - Changed local branches: + Changed local bookmarks: bookmark-2: + qzxslznx d487febd bookmark-2 bookmark-2@origin | Commit 5 - (absent) @@ -1142,7 +1142,7 @@ fn test_op_diff() { From operation ef314062f7f5: create bookmark bookmark-2 pointing to commit d487febd08e690ee775a4e0387e30d544307e409 To operation bc306c9bb67f: track remote bookmark bookmark-2@origin - Changed remote branches: + Changed remote bookmarks: bookmark-2@origin: + tracked qzxslznx d487febd bookmark-2 | Commit 5 - untracked qzxslznx d487febd bookmark-2 | Commit 5 @@ -1163,7 +1163,7 @@ fn test_op_diff() { From operation ef314062f7f5: create bookmark bookmark-2 pointing to commit d487febd08e690ee775a4e0387e30d544307e409 To operation bc306c9bb67f: track remote bookmark bookmark-2@origin - Changed remote branches: + Changed remote bookmarks: bookmark-2@origin: + tracked qzxslznx d487febd bookmark-2 | Commit 5 - untracked qzxslznx d487febd bookmark-2 | Commit 5 @@ -1206,7 +1206,7 @@ fn test_op_diff() { From operation 1ae777a7acc8: new empty commit To operation 5728693d7de3: point bookmark bookmark-1 to commit 358b82d6be53fa9b062325abb8bc820a8b34c68d - Changed local branches: + Changed local bookmarks: bookmark-1: + wvuyspvk 358b82d6 bookmark-1* | (empty) new commit - (added) slvtnnzx 4f856199 bookmark-1@origin | Commit 4 @@ -1225,7 +1225,7 @@ fn test_op_diff() { From operation 5728693d7de3: point bookmark bookmark-1 to commit 358b82d6be53fa9b062325abb8bc820a8b34c68d To operation 0f77d601f1cd: delete bookmark bookmark-2 - Changed local branches: + Changed local bookmarks: bookmark-2: + (absent) - qzxslznx d487febd bookmark-2@origin | Commit 5 @@ -1236,7 +1236,7 @@ fn test_op_diff() { insta::assert_snapshot!(&stdout, @r###" "###); insta::assert_snapshot!(&stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark bookmark-1 from 4f856199edbf to 358b82d6be53 Delete bookmark bookmark-2 from d487febd08e6 Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. @@ -1252,7 +1252,7 @@ fn test_op_diff() { ○ Change oupztwtkortx + oupztwtk 2f0718a0 (empty) (no description set) - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + tracked wvuyspvk 358b82d6 bookmark-1 | (empty) new commit - tracked slvtnnzx 4f856199 Commit 4 @@ -1516,7 +1516,7 @@ fn test_op_diff_word_wrap() { test_env.jj_cmd_ok(&repo_path, &["debug", "snapshot"]); // ui.log-word-wrap option works, and diff stat respects content width - insta::assert_snapshot!(render(&["op", "diff", "--from=@---", "--stat"], 40, true), @r#" + insta::assert_snapshot!(render(&["op", "diff", "--from=@---", "--stat"], 40, true), @r###" From operation b51416386f26: add workspace 'default' To operation d12081b11443: snapshot working copy @@ -1546,13 +1546,13 @@ fn test_op_diff_word_wrap() { (no description set) 0 files changed, 0 insertions(+), 0 deletions(-) - Changed local branches: + Changed local bookmarks: bookmark-1: + ulyvmwyz 1d843d1f bookmark-1 | Commit 1 - (absent) - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + tracked ulyvmwyz 1d843d1f bookmark-1 | Commit 1 @@ -1565,12 +1565,12 @@ fn test_op_diff_word_wrap() { + untracked tqyxmszt 3e785984 bookmark-3@origin | Commit 3 - untracked (absent) - "#); + "###); // Graph width should be subtracted from the term width let config = r#"templates.commit_summary='"0 1 2 3 4 5 6 7 8 9"'"#; insta::assert_snapshot!( - render(&["op", "diff", "--from=@---", "--config-toml", config], 10, true), @r#" + render(&["op", "diff", "--from=@---", "--config-toml", config], 10, true), @r###" From operation b51416386f26: add workspace 'default' To operation d12081b11443: snapshot working copy @@ -1604,7 +1604,7 @@ fn test_op_diff_word_wrap() { Changed local - branches: + bookmarks: bookmark-1: + 0 1 2 3 4 5 6 7 8 @@ -1613,7 +1613,7 @@ fn test_op_diff_word_wrap() { Changed remote - branches: + bookmarks: bookmark-1@origin: + tracked 0 1 2 3 4 @@ -1637,7 +1637,7 @@ fn test_op_diff_word_wrap() { - untracked (absent) - "#); + "###); } #[test] @@ -1683,12 +1683,12 @@ fn test_op_show() { ○ Change qpvuntsmwlqt - qpvuntsm hidden 230dd059 (empty) (no description set) - Changed local branches: + Changed local bookmarks: bookmark-1: + ulyvmwyz 1d843d1f bookmark-1 | Commit 1 - (absent) - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + tracked ulyvmwyz 1d843d1f bookmark-1 | Commit 1 - untracked ulyvmwyz 1d843d1f bookmark-1 | Commit 1 @@ -1712,7 +1712,7 @@ fn test_op_show() { ○ Change ulyvmwyzwuwt + ulyvmwyz 1d843d1f bookmark-1@origin | Commit 1 - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + untracked ulyvmwyz 1d843d1f bookmark-1@origin | Commit 1 - untracked (absent) @@ -1755,9 +1755,9 @@ fn test_op_show() { insta::assert_snapshot!(&stdout, @r###" "###); insta::assert_snapshot!(&stderr, @r###" - branch: bookmark-1@origin [updated] tracked - branch: bookmark-2@origin [updated] untracked - branch: bookmark-3@origin [deleted] untracked + bookmark: bookmark-1@origin [updated] tracked + bookmark: bookmark-2@origin [updated] untracked + bookmark: bookmark-3@origin [deleted] untracked Abandoned 1 commits that are no longer reachable. "###); let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); @@ -1774,14 +1774,14 @@ fn test_op_show() { ○ Change tqyxmsztkvot - tqyxmszt hidden 3e785984 Commit 3 - Changed local branches: + Changed local bookmarks: bookmark-1: + (added) slvtnnzx 4f856199 bookmark-1?? bookmark-1@origin | Commit 4 + (added) yuvsmzqk 3d9189bc bookmark-1?? | Commit 2 - (added) ulyvmwyz 1d843d1f Commit 1 - (added) yuvsmzqk 3d9189bc bookmark-1?? | Commit 2 - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + tracked slvtnnzx 4f856199 bookmark-1?? bookmark-1@origin | Commit 4 - tracked ulyvmwyz 1d843d1f Commit 1 @@ -1815,7 +1815,7 @@ fn test_op_show() { create bookmark bookmark-2 pointing to commit d487febd08e690ee775a4e0387e30d544307e409 args: jj bookmark create bookmark-2 -r bookmark-2@origin - Changed local branches: + Changed local bookmarks: bookmark-2: + qzxslznx d487febd bookmark-2 bookmark-2@origin | Commit 5 - (absent) @@ -1835,7 +1835,7 @@ fn test_op_show() { track remote bookmark bookmark-2@origin args: jj bookmark track bookmark-2@origin - Changed remote branches: + Changed remote bookmarks: bookmark-2@origin: + tracked qzxslznx d487febd bookmark-2 | Commit 5 - untracked qzxslznx d487febd bookmark-2 | Commit 5 @@ -1856,7 +1856,7 @@ fn test_op_show() { track remote bookmark bookmark-2@origin args: jj bookmark track bookmark-2@origin - Changed remote branches: + Changed remote bookmarks: bookmark-2@origin: + tracked qzxslznx d487febd bookmark-2 | Commit 5 - untracked qzxslznx d487febd bookmark-2 | Commit 5 @@ -1901,7 +1901,7 @@ fn test_op_show() { point bookmark bookmark-1 to commit eb6c2b21ec20a33ab6a1c44bc86c59d84ffd93ac args: jj bookmark set bookmark-1 -r @ - Changed local branches: + Changed local bookmarks: bookmark-1: + xznxytkn eb6c2b21 bookmark-1* | (empty) new commit - (added) slvtnnzx 4f856199 bookmark-1@origin | Commit 4 @@ -1921,7 +1921,7 @@ fn test_op_show() { delete bookmark bookmark-2 args: jj bookmark delete bookmark-2 - Changed local branches: + Changed local bookmarks: bookmark-2: + (absent) - qzxslznx d487febd bookmark-2@origin | Commit 5 @@ -1932,7 +1932,7 @@ fn test_op_show() { insta::assert_snapshot!(&stdout, @r###" "###); insta::assert_snapshot!(&stderr, @r###" - Branch changes to push to origin: + Bookmark changes to push to origin: Move forward bookmark bookmark-1 from 4f856199edbf to eb6c2b21ec20 Delete bookmark bookmark-2 from d487febd08e6 Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. @@ -1949,7 +1949,7 @@ fn test_op_show() { ○ Change pzsxstztnpkv + pzsxstzt 7ab2d837 (empty) (no description set) - Changed remote branches: + Changed remote bookmarks: bookmark-1@origin: + tracked xznxytkn eb6c2b21 bookmark-1 | (empty) new commit - tracked slvtnnzx 4f856199 Commit 4 diff --git a/docs/FAQ.md b/docs/FAQ.md index f29e4e2488..a6692916ec 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -52,8 +52,8 @@ The [co-location documentation describes the drawbacks](git-compatibility.md#co-located-jujutsugit-repos) but the most important ones are: -- Interleaving `git` and `jj` commands may create confusing branch conflicts or - divergent changes. +- Interleaving `git` and `jj` commands may create confusing bookmark conflicts + or divergent changes. - Jujutsu commands may be a little slower in very large repositories due to importing and exporting changes to Git. Most repositories are not noticeably diff --git a/docs/design/run.md b/docs/design/run.md index 99228b9ec8..b313ad25ba 100644 --- a/docs/design/run.md +++ b/docs/design/run.md @@ -80,7 +80,7 @@ unpredictable. **Large scale changes across repositories, local and remote:** -- `jj run 'sed /some/test/' -r 'mine() & ~remote_branches(exact:"origin")'` +- `jj run 'sed /some/test/' -r 'mine() & ~remote_bookmarks(exact:"origin")'` - `jj run '$rewrite-tool' -r '$revset'` **Build systems:** diff --git a/docs/glossary.md b/docs/glossary.md index a02da36460..3f201b107e 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -1,12 +1,12 @@ # Glossary -## Anonymous bookmark +## Anonymous branch -An anonymous bookmark is a chain of commits that doesn't have any +An anonymous branch is a chain of commits that doesn't have any [named bookmarks](#bookmark) pointing to it or to any of its descendants. Unlike -Git, Jujutsu keeps commits on anonymous bookmarks around until they are -explicitly abandoned. Visible anonymous bookmarks are tracked by the -[view](#view), which stores a list of [heads](#head) of such bookmarks. +Git, Jujutsu keeps commits on anonymous branches around until they are +explicitly abandoned. Visible anonymous branches are tracked by the +[view](#view), which stores a list of [heads](#head) of such branches. ## Backend @@ -23,12 +23,11 @@ such as the "operation store backend" for storing ## Bookmark A bookmark is a named pointer to a [commit](#commit). They automatically follow -the commit if it gets [rewritten](#rewrite). Branches are sometimes called -"named bookmarks" to distinguish them from -[anonymous bookmarks](#anonymous-bookmark), but note that they are more similar -to Git's bookmarks than to -[Mercurial's named bookmarks](https://www.mercurial-scm.org/wiki/Branch#Named_bookmarks). -See [here](bookmarks.md) for details. +the commit if it gets [rewritten](#rewrite). Bookmarks are sometimes called +"named branches" to distinguish them from [anonymous branches](#anonymous-branch). +They are similar to Git's branches and even more similar to +[Mercurial's bookmarks](https://wiki.mercurial-scm.org/Bookmarks). See +[here](bookmarks.md) for details. ## Change diff --git a/docs/operation-log.md b/docs/operation-log.md index 3041a967a5..dc41f32e6f 100644 --- a/docs/operation-log.md +++ b/docs/operation-log.md @@ -6,7 +6,7 @@ Jujutsu records each operation that modifies the repo in the "operation log". You can see the log with `jj op log`. Each operation object contains a snapshot of how the repo looked at the end of the operation. We call this snapshot a -"view" object. The view contains information about where each branch, tag, and +"view" object. The view contains information about where each bookmark, tag, and Git ref (in Git-backed repos) pointed, as well as the set of heads in the repo, and the current working-copy commit in each workspace. The operation object also (in addition to the view) contains pointers to the operation(s) immediately diff --git a/docs/revsets.md b/docs/revsets.md index 8eab38eee6..136f796bd0 100644 --- a/docs/revsets.md +++ b/docs/revsets.md @@ -20,7 +20,7 @@ ID or a Git ref pointing to them). The `@` expression refers to the working copy commit in the current workspace. Use `@` to refer to the working-copy commit in another -workspace. Use `@` to refer to a remote-tracking branch. +workspace. Use `@` to refer to a remote-tracking bookmark. A full commit ID refers to a single commit. A unique prefix of the full commit ID can also be used. It is an error to use a non-unique prefix. @@ -41,7 +41,7 @@ something like `jj log -r '"x-"'`. Jujutsu attempts to resolve a symbol in the following order: 1. Tag name -2. Branch name +2. Bookmark name 3. Git ref 4. Commit ID or change ID @@ -196,34 +196,34 @@ revsets (expressions) as arguments. * `none()`: No commits. This function is rarely useful; it is provided for completeness. -* `branches([pattern])`: All local branch targets. If `pattern` is specified, - this selects the branches whose name match the given [string - pattern](#string-patterns). For example, `branches(push)` would match the - branches `push-123` and `repushed` but not the branch `main`. If a branch is +* `bookmarks([pattern])`: All local bookmark targets. If `pattern` is specified, + this selects the bookmarks whose name match the given [string + pattern](#string-patterns). For example, `bookmarks(push)` would match the + bookmarks `push-123` and `repushed` but not the bookmark `main`. If a bookmark is in a conflicted state, all its possible targets are included. -* `remote_branches([branch_pattern[, [remote=]remote_pattern]])`: All remote - branch targets across all remotes. If just the `branch_pattern` is - specified, the branches whose names match the given [string +* `remote_bookmarks([bookmark_pattern[, [remote=]remote_pattern]])`: All remote + bookmarks targets across all remotes. If just the `bookmark_pattern` is + specified, the bookmarks whose names match the given [string pattern](#string-patterns) across all remotes are selected. If both - `branch_pattern` and `remote_pattern` are specified, the selection is + `bookmark_pattern` and `remote_pattern` are specified, the selection is further restricted to just the remotes whose names match `remote_pattern`. - For example, `remote_branches(push, ri)` would match the branches + For example, `remote_bookmarks(push, ri)` would match the bookmarks `push-123@origin` and `repushed@private` but not `push-123@upstream` or - `main@origin` or `main@upstream`. If a branch is in a conflicted state, all + `main@origin` or `main@upstream`. If a bookmark is in a conflicted state, all its possible targets are included. - While Git-tracking branches can be selected by `@git`, these branches - aren't included in `remote_branches()`. + While Git-tracking bookmarks can be selected by `@git`, these bookmarks + aren't included in `remote_bookmarks()`. -* `tracked_remote_branches([branch_pattern[, [remote=]remote_pattern]])`: All - targets of tracked remote branches. Supports the same optional arguments as - `remote_branches()`. +* `tracked_remote_bookmarks([bookmark_pattern[, [remote=]remote_pattern]])`: All + targets of tracked remote bookmarks. Supports the same optional arguments as + `remote_bookmarks()`. -* `untracked_remote_branches([branch_pattern[, [remote=]remote_pattern]])`: - All targets of untracked remote branches. Supports the same optional arguments - as `remote_branches()`. +* `untracked_remote_bookmarks([bookmark_pattern[, [remote=]remote_pattern]])`: + All targets of untracked remote bookmarks. Supports the same optional arguments + as `remote_bookmarks()`. * `tags()`: All tag targets. If a tag is in a conflicted state, all its possible targets are included. @@ -299,7 +299,7 @@ given [string pattern](#string-patterns). * `conflict()`: Commits with conflicts. * `present(x)`: Same as `x`, but evaluated to `none()` if any of the commits - in `x` doesn't exist (e.g. is an unknown branch name.) + in `x` doesn't exist (e.g. is an unknown bookmark name.) * `working_copies()`: The working copy commits across all the workspaces. @@ -409,31 +409,32 @@ are defined as aliases in order to allow you to overwrite them as needed. See [revsets.toml](https://github.com/martinvonz/jj/blob/main/cli/src/config/revsets.toml) for a comprehensive list. -* `trunk()`: Resolves to the head commit for the trunk branch of the remote - named `origin` or `upstream`. The branches `main`, `master`, and `trunk` are +* `trunk()`: Resolves to the head commit for the trunk bookmark of the remote + named `origin` or `upstream`. The bookmarks `main`, `master`, and `trunk` are tried. If more than one potential trunk commit exists, the newest one is - chosen. If none of the branches exist, the revset evaluates to `root()`. + chosen. If none of the bookmarks exist, the revset evaluates to `root()`. When working with an existing Git repository (via `jj git clone` or `jj git init`), `trunk()` will be overridden at the repository level - to the default branch of the remote `origin`. + to the default bookmark of the remote `origin`. You can [override](./config.md) this as appropriate. If you do, make sure it always resolves to exactly one commit. For example: ```toml [revset-aliases] - 'trunk()' = 'your-branch@your-remote' + 'trunk()' = 'your-bookmark@your-remote' ``` -* `builtin_immutable_heads()`: Resolves to `trunk() | tags() | untracked_remote_branches()`. +* `builtin_immutable_heads()`: Resolves to `trunk() | tags() | untracked_remote_bookmarks()`. It is used as the default definition for `immutable_heads()` below. it is not - recommended to redefined this alias. Prefer to redefine `immutable_heads()` instead. + recommended to redefined this alias. Prefer to redefine `immutable_heads()` + instead. -* `immutable_heads()`: Resolves to `trunk() | tags() | - untracked_remote_branches()` by default. It is actually defined as `builtin_immutable_heads()`, - and can be overridden as required. - See [here](config.md#set-of-immutable-commits) for details. +* `immutable_heads()`: Resolves to `trunk() | tags() | untracked_remote_bookmarks()` + by default. It is actually defined as `builtin_immutable_heads()`, and can be + overridden as required. See [here](config.md#set-of-immutable-commits) for + details. * `immutable()`: The set of commits that `jj` treats as immutable. This is equivalent to `::(immutable_heads() | root())`. It is not recommended to redefine @@ -493,16 +494,16 @@ Show all ancestors of the working copy (like plain `git log`) jj log -r ::@ ``` -Show commits not on any remote branch: +Show commits not on any remote bookmark: ``` -jj log -r 'remote_branches()..' +jj log -r 'remote_bookmarks()..' ``` Show commits not on `origin` (if you have other remotes like `fork`): ``` -jj log -r 'remote_branches(remote=origin)..' +jj log -r 'remote_bookmarks(remote=origin)..' ``` Show the initial commits in the repo (the ones Git calls "root commits"): @@ -514,7 +515,7 @@ jj log -r 'root()+' Show some important commits (like `git --simplify-by-decoration`): ``` -jj log -r 'tags() | branches()' +jj log -r 'tags() | bookmarks()' ``` Show local commits leading up to the working copy, as well as descendants of @@ -522,7 +523,7 @@ those commits: ``` -jj log -r '(remote_branches()..@)::' +jj log -r '(remote_bookmarks()..@)::' ``` Show commits authored by "martinvonz" and containing the word "reset" in the diff --git a/docs/technical/concurrency.md b/docs/technical/concurrency.md index b51e7338f0..cda896a16d 100644 --- a/docs/technical/concurrency.md +++ b/docs/technical/concurrency.md @@ -42,9 +42,9 @@ changes made remotely. Jujutsu's lock-free concurrency means that it's possible to update copies of the clone on different machines and then let `rsync` (or Dropbox, or NFS, etc.) merge them. The working copy may mismatch what's supposed to be checked out, but -no changes to the repo will be lost (added commits, moved branches, etc.). If +no changes to the repo will be lost (added commits, moved bookmarks, etc.). If conflicting changes were made, they will appear as conflicts. For example, if a -branch was moved to two different locations, they will appear in `jj log` in +bookmark was moved to two different locations, they will appear in `jj log` in both locations but with a "?" after the name, and `jj status` will also inform the user about the conflict. @@ -57,8 +57,8 @@ Moreover, such use of Jujutsu is not currently thoroughly tested, especially in the context of [co-located repositories](../glossary.md#co-located-repos). While the contents of commits should be safe, concurrent modification of a repository from different computers -might conceivably lose some branch pointers. Note that, unlike in pure -Git, losing a branch pointer does not lead to losing commits. +might conceivably lose some bookmark pointers. Note that, unlike in pure +Git, losing a bookmark pointer does not lead to losing commits. ## Operation log @@ -69,7 +69,7 @@ what allows us to detect and merge divergent operations. The operation log is similar to a commit DAG (such as in [Git's object model](https://git-scm.com/book/en/v2/Git-Internals-Git-Objects)), but each commit object is instead an "operation" and each tree object is instead -a "view". The view object contains the set of visible head commits, branches, +a "view". The view object contains the set of visible head commits, bookmarks, tags, and the working-copy commit in each workspace. The operation object contains a pointer to the view object (like how commit objects point to tree objects), pointers to parent operation(s) (like how commit objects point to @@ -101,15 +101,15 @@ divergent operations. If Jujutsu tries to load the repo and finds multiple heads in the operation log, it will do a 3-way merge of the view objects based on their common ancestor (possibly several 3-way merges if there were more than two heads). Conflicts -are recorded in the resulting view object. For example, if branch `main` was +are recorded in the resulting view object. For example, if bookmark `main` was moved from commit A to commit B in one operation and moved to commit C in a concurrent operation, then `main` will be recorded as "moved from A to B or C". See the `RefTarget` definition in `op_store.proto`. -Because we allow branches (etc.) to be in a conflicted state rather than just +Because we allow bookmarks (etc.) to be in a conflicted state rather than just erroring out when there are multiple heads, the user can continue to use the repo, including performing further operations on the repo. Of course, some -commands will fail when using a conflicted branch. For example, +commands will fail when using a conflicted bookmark. For example, `jj checkout main` when `main` is in a conflicted state will result in an error telling you that `main` resolved to multiple revisions. diff --git a/docs/technical/conflicts.md b/docs/technical/conflicts.md index 7ac9a664c6..295140c644 100644 --- a/docs/technical/conflicts.md +++ b/docs/technical/conflicts.md @@ -4,7 +4,7 @@ Conflicts can happen when two changes are applied to some state. This document is about conflicts between changes to files (not about [conflicts between -changes to branch targets](concurrency.md), for example). +changes to bookmark targets](concurrency.md), for example). For example, if you merge two branches in a repo, there may be conflicting changes between the two branches. Most DVCSs require you to resolve those diff --git a/docs/templates.md b/docs/templates.md index 1a4a5ccb5a..23edbeb303 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -81,7 +81,7 @@ This type cannot be printed. The following methods are defined. * `current_working_copy() -> Boolean`: True for the working-copy commit of the current workspace. * `bookmarks() -> List`: Local and remote bookmarks pointing to the - commit. A tracking remote branch will be included only if its target is + commit. A tracking remote bookmark will be included only if its target is different from the local one. * `local_bookmarks() -> List`: All local bookmarks pointing to the commit. * `remote_bookmarks() -> List`: All remote bookmarks pointing to the commit. @@ -158,10 +158,10 @@ invoked. If not set, an error will be reported inline on method call. The following methods are defined. -* `.name() -> String`: Local branch or tag name. +* `.name() -> String`: Local bookmark or tag name. * `.remote() -> String`: Remote name or empty if this is a local ref. * `.present() -> Boolean`: True if the ref points to any commit. -* `.conflict() -> Boolean`: True if [the branch or tag is +* `.conflict() -> Boolean`: True if [the bookmark or tag is conflicted](bookmarks.md#conflicts). * `.normal_target() -> Option`: Target commit if the ref is not conflicted and points to a commit. diff --git a/docs/tutorial.md b/docs/tutorial.md index d1a54f0714..46089f3f15 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -160,12 +160,12 @@ included in the graph. We can use the `--revisions`/`-r` flag to select a different set of revisions to list. The flag accepts a ["revset"](revsets.md), which is an expression in a simple language for specifying revisions. For example, `@` refers to the working-copy commit, `root()` refers to the root -commit, `branches()` refers to all commits pointed to by branches. We can -combine expressions with `|` for union, `&` for intersection and `~` for -difference. For example: +commit, `bookmarks()` refers to all commits pointed to by bookmarks (similar to +Git's branches). We can combine expressions with `|` for union, `&` for +intersection and `~` for difference. For example: ```shell -$ jj log -r '@ | root() | branches()' +$ jj log -r '@ | root() | bookmarks()' @ mpqrykyp martinvonz@google.com 2023-02-12 15:00:22.000 -08:00 aef4df99 ╷ (empty) (no description set) ◉ orrkosyo octocat@nowhere.com 2012-03-06 15:06:50.000 -08:00 master 7fd1a60b @@ -193,7 +193,7 @@ commits. We use `jj new` with the `--message`/`-m` option to set change descriptions (commit messages) right away. ```shell -# Start creating a chain of commits off of the `master` branch +# Start creating a chain of commits off of the `master` bookmark $ jj new master -m A; echo a > file1 Working copy now at: nuvyytnq 00a2aeed (empty) A Parent commit : orrkosyo 7fd1a60b master | (empty) Merge pull request #6 from Spaceghost/patch-1 diff --git a/lib/src/git.rs b/lib/src/git.rs index 127b760ff7..5de8c695f9 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -40,7 +40,7 @@ use crate::op_store::RefTargetOptionExt; use crate::op_store::RemoteRef; use crate::op_store::RemoteRefState; use crate::refs; -use crate::refs::BranchPushUpdate; +use crate::refs::BookmarkPushUpdate; use crate::repo::MutableRepo; use crate::repo::Repo; use crate::revset::RevsetExpression; @@ -231,7 +231,7 @@ struct RefsToImport { /// Reflect changes made in the underlying Git repo in the Jujutsu repo. /// -/// This function detects conflicts (if both Git and JJ modified a branch) and +/// This function detects conflicts (if both Git and JJ modified a bookmark) and /// records them in JJ's view. pub fn import_refs( mut_repo: &mut MutableRepo, @@ -1341,7 +1341,7 @@ pub enum GitPushError { #[derive(Clone, Debug)] pub struct GitBranchPushTargets { - pub branch_updates: Vec<(String, BranchPushUpdate)>, + pub branch_updates: Vec<(String, BookmarkPushUpdate)>, } pub struct GitRefUpdate { diff --git a/lib/src/op_store.rs b/lib/src/op_store.rs index 4eb44ba638..2daa50fc3f 100644 --- a/lib/src/op_store.rs +++ b/lib/src/op_store.rs @@ -255,7 +255,7 @@ impl<'a> RefTargetOptionExt for Option<&'a RemoteRef> { /// Local and remote bookmarks of the same bookmark name. #[derive(PartialEq, Eq, Clone, Debug)] -pub struct BranchTarget<'a> { +pub struct BookmarkTarget<'a> { /// The commit the bookmark points to locally. pub local_target: &'a RefTarget, /// `(remote_name, remote_ref)` pairs in lexicographical order. @@ -297,7 +297,7 @@ pub struct RemoteView { pub(crate) fn merge_join_bookmark_views<'a>( local_bookmarks: &'a BTreeMap, remote_views: &'a BTreeMap, -) -> impl Iterator)> { +) -> impl Iterator)> { let mut local_bookmarks_iter = local_bookmarks .iter() .map(|(bookmark_name, target)| (bookmark_name.as_str(), target)) @@ -321,7 +321,7 @@ pub(crate) fn merge_join_bookmark_views<'a>( }) .map(|((_, remote_name), remote_ref)| (remote_name, remote_ref)) .collect(); - let bookmark_target = BranchTarget { + let bookmark_target = BookmarkTarget { local_target, remote_refs, }; @@ -508,7 +508,7 @@ mod tests { vec![ ( "bookmark1", - BranchTarget { + BookmarkTarget { local_target: &local_bookmark1_target, remote_refs: vec![ ("git", &git_bookmark1_remote_ref), @@ -518,7 +518,7 @@ mod tests { ), ( "bookmark2", - BranchTarget { + BookmarkTarget { local_target: &local_bookmark2_target.clone(), remote_refs: vec![ ("git", &git_bookmark2_remote_ref), @@ -538,7 +538,7 @@ mod tests { merge_join_bookmark_views(&local_bookmarks, &remote_views).collect_vec(), vec![( "bookmark1", - BranchTarget { + BookmarkTarget { local_target: &local_bookmark1_target, remote_refs: vec![], }, @@ -558,7 +558,7 @@ mod tests { merge_join_bookmark_views(&local_bookmarks, &remote_views).collect_vec(), vec![( "bookmark1", - BranchTarget { + BookmarkTarget { local_target: RefTarget::absent_ref(), remote_refs: vec![("remote1", &remote1_bookmark1_remote_ref)], }, diff --git a/lib/src/refs.rs b/lib/src/refs.rs index 8fdf15b496..f9d62e8c4d 100644 --- a/lib/src/refs.rs +++ b/lib/src/refs.rs @@ -175,14 +175,14 @@ pub struct LocalAndRemoteRef<'a> { } #[derive(Debug, PartialEq, Eq, Clone, Hash)] -pub struct BranchPushUpdate { +pub struct BookmarkPushUpdate { pub old_target: Option, pub new_target: Option, } #[derive(Debug, PartialEq, Eq, Clone)] -pub enum BranchPushAction { - Update(BranchPushUpdate), +pub enum BookmarkPushAction { + Update(BookmarkPushUpdate), AlreadyMatches, LocalConflicted, RemoteConflicted, @@ -191,19 +191,19 @@ pub enum BranchPushAction { /// Figure out what changes (if any) need to be made to the remote when pushing /// this bookmark. -pub fn classify_bookmark_push_action(targets: LocalAndRemoteRef) -> BranchPushAction { +pub fn classify_bookmark_push_action(targets: LocalAndRemoteRef) -> BookmarkPushAction { let local_target = targets.local_target; let remote_target = targets.remote_ref.tracking_target(); if local_target == remote_target { - BranchPushAction::AlreadyMatches + BookmarkPushAction::AlreadyMatches } else if local_target.has_conflict() { - BranchPushAction::LocalConflicted + BookmarkPushAction::LocalConflicted } else if remote_target.has_conflict() { - BranchPushAction::RemoteConflicted + BookmarkPushAction::RemoteConflicted } else if targets.remote_ref.is_present() && !targets.remote_ref.is_tracking() { - BranchPushAction::RemoteUntracked + BookmarkPushAction::RemoteUntracked } else { - BranchPushAction::Update(BranchPushUpdate { + BookmarkPushAction::Update(BookmarkPushUpdate { old_target: remote_target.as_normal().cloned(), new_target: local_target.as_normal().cloned(), }) @@ -238,7 +238,7 @@ mod tests { }; assert_eq!( classify_bookmark_push_action(targets), - BranchPushAction::AlreadyMatches + BookmarkPushAction::AlreadyMatches ); } @@ -251,7 +251,7 @@ mod tests { }; assert_eq!( classify_bookmark_push_action(targets), - BranchPushAction::Update(BranchPushUpdate { + BookmarkPushAction::Update(BookmarkPushUpdate { old_target: None, new_target: Some(commit_id1), }) @@ -267,7 +267,7 @@ mod tests { }; assert_eq!( classify_bookmark_push_action(targets), - BranchPushAction::Update(BranchPushUpdate { + BookmarkPushAction::Update(BookmarkPushUpdate { old_target: Some(commit_id1), new_target: None, }) @@ -284,7 +284,7 @@ mod tests { }; assert_eq!( classify_bookmark_push_action(targets), - BranchPushAction::Update(BranchPushUpdate { + BookmarkPushAction::Update(BookmarkPushUpdate { old_target: Some(commit_id1), new_target: Some(commit_id2), }) @@ -302,7 +302,7 @@ mod tests { }; assert_eq!( classify_bookmark_push_action(targets), - BranchPushAction::AlreadyMatches + BookmarkPushAction::AlreadyMatches ); } @@ -316,7 +316,7 @@ mod tests { }; assert_eq!( classify_bookmark_push_action(targets), - BranchPushAction::RemoteUntracked + BookmarkPushAction::RemoteUntracked ); } @@ -330,7 +330,7 @@ mod tests { }; assert_eq!( classify_bookmark_push_action(targets), - BranchPushAction::LocalConflicted + BookmarkPushAction::LocalConflicted ); } @@ -347,7 +347,7 @@ mod tests { }; assert_eq!( classify_bookmark_push_action(targets), - BranchPushAction::RemoteConflicted + BookmarkPushAction::RemoteConflicted ); } } diff --git a/lib/src/repo.rs b/lib/src/repo.rs index d42d194afe..312c8afcff 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -836,7 +836,7 @@ pub struct MutableRepo { index: Box, view: DirtyCell, // The commit identified by the key has been replaced by all the ones in the value. - // * Branches pointing to the old commit should be updated to the new commit, resulting in a + // * Bookmarks pointing to the old commit should be updated to the new commit, resulting in a // conflict if there multiple new commits. // * Children of the old commit should be rebased onto the new commits. However, if the type is // `Divergent`, they should be left in place. @@ -1066,12 +1066,12 @@ impl MutableRepo { fn update_all_references(&mut self, settings: &UserSettings) -> BackendResult<()> { let rewrite_mapping = self.resolve_rewrite_mapping_with(|_| true); - self.update_local_branches(&rewrite_mapping); + self.update_local_bookmarks(&rewrite_mapping); self.update_wc_commits(settings, &rewrite_mapping)?; Ok(()) } - fn update_local_branches(&mut self, rewrite_mapping: &HashMap>) { + fn update_local_bookmarks(&mut self, rewrite_mapping: &HashMap>) { let changed_branches = self .view() .local_bookmarks() diff --git a/lib/src/revset.rs b/lib/src/revset.rs index a1645ef945..d49312774e 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -1510,9 +1510,9 @@ impl PartialSymbolResolver for TagResolver { } } -struct BranchResolver; +struct BookmarkResolver; -impl PartialSymbolResolver for BranchResolver { +impl PartialSymbolResolver for BookmarkResolver { fn resolve_symbol( &self, repo: &dyn Repo, @@ -1546,7 +1546,7 @@ impl PartialSymbolResolver for GitRefResolver { } const DEFAULT_RESOLVERS: &[&'static dyn PartialSymbolResolver] = - &[&TagResolver, &BranchResolver, &GitRefResolver]; + &[&TagResolver, &BookmarkResolver, &GitRefResolver]; #[derive(Default)] struct CommitPrefixResolver<'a> { diff --git a/lib/src/revset_parser.rs b/lib/src/revset_parser.rs index ba43e608ec..e07b32f137 100644 --- a/lib/src/revset_parser.rs +++ b/lib/src/revset_parser.rs @@ -1137,34 +1137,34 @@ mod tests { ); // Space is allowed around keyword arguments assert_eq!( - parse_normalized("remote_branches( remote = foo )"), - parse_normalized("remote_branches(remote=foo)"), + parse_normalized("remote_bookmarks( remote = foo )"), + parse_normalized("remote_bookmarks(remote=foo)"), ); // Trailing comma isn't allowed for empty argument - assert!(parse_into_kind("branches(,)").is_err()); + assert!(parse_into_kind("bookmarks(,)").is_err()); // Trailing comma is allowed for the last argument assert_eq!( - parse_normalized("branches(a,)"), - parse_normalized("branches(a)") + parse_normalized("bookmarks(a,)"), + parse_normalized("bookmarks(a)") ); assert_eq!( - parse_normalized("branches(a , )"), - parse_normalized("branches(a)") + parse_normalized("bookmarks(a , )"), + parse_normalized("bookmarks(a)") ); - assert!(parse_into_kind("branches(,a)").is_err()); - assert!(parse_into_kind("branches(a,,)").is_err()); - assert!(parse_into_kind("branches(a , , )").is_err()); + assert!(parse_into_kind("bookmarks(,a)").is_err()); + assert!(parse_into_kind("bookmarks(a,,)").is_err()); + assert!(parse_into_kind("bookmarks(a , , )").is_err()); assert_eq!( parse_normalized("file(a,b,)"), parse_normalized("file(a, b)") ); assert!(parse_into_kind("file(a,,b)").is_err()); assert_eq!( - parse_normalized("remote_branches(a,remote=b , )"), - parse_normalized("remote_branches(a, remote=b)"), + parse_normalized("remote_bookmarks(a,remote=b , )"), + parse_normalized("remote_bookmarks(a, remote=b)"), ); - assert!(parse_into_kind("remote_branches(a,,remote=b)").is_err()); + assert!(parse_into_kind("remote_bookmarks(a,,remote=b)").is_err()); } #[test] diff --git a/lib/src/str_util.rs b/lib/src/str_util.rs index 41c303d19f..22921a85c2 100644 --- a/lib/src/str_util.rs +++ b/lib/src/str_util.rs @@ -41,7 +41,7 @@ fn parse_glob(src: &str) -> Result { } /// Pattern to be tested against string property like commit description or -/// branch name. +/// bookmark name. #[derive(Clone, Debug)] pub enum StringPattern { /// Matches strings exactly. diff --git a/lib/src/view.rs b/lib/src/view.rs index 733bc7fe0d..ace5e378cd 100644 --- a/lib/src/view.rs +++ b/lib/src/view.rs @@ -22,7 +22,7 @@ use itertools::Itertools; use crate::backend::CommitId; use crate::op_store; -use crate::op_store::BranchTarget; +use crate::op_store::BookmarkTarget; use crate::op_store::RefTarget; use crate::op_store::RefTargetOptionExt as _; use crate::op_store::RemoteRef; @@ -71,7 +71,7 @@ impl View { } /// Iterates pair of local and remote bookmarks by bookmark name. - pub fn bookmarks(&self) -> impl Iterator)> { + pub fn bookmarks(&self) -> impl Iterator)> { op_store::merge_join_bookmark_views(&self.data.local_bookmarks, &self.data.remote_views) } diff --git a/lib/tests/test_git.rs b/lib/tests/test_git.rs index c38fd94825..d9106f994f 100644 --- a/lib/tests/test_git.rs +++ b/lib/tests/test_git.rs @@ -45,11 +45,11 @@ use jj_lib::git::RefName; use jj_lib::git::SubmoduleConfig; use jj_lib::git_backend::GitBackend; use jj_lib::object_id::ObjectId; -use jj_lib::op_store::BranchTarget; +use jj_lib::op_store::BookmarkTarget; use jj_lib::op_store::RefTarget; use jj_lib::op_store::RemoteRef; use jj_lib::op_store::RemoteRefState; -use jj_lib::refs::BranchPushUpdate; +use jj_lib::refs::BookmarkPushUpdate; use jj_lib::repo::MutableRepo; use jj_lib::repo::ReadonlyRepo; use jj_lib::repo::Repo; @@ -1072,7 +1072,7 @@ fn test_import_refs_reimport_conflicted_remote_bookmark() { let mut tx2 = repo.start_transaction(&settings); git::import_refs(tx2.repo_mut(), &git_settings).unwrap(); - // Remote branch can diverge by divergent operations (like `jj git fetch`) + // Remote bookmark can diverge by divergent operations (like `jj git fetch`) let repo = commit_transactions(&settings, vec![tx1, tx2]); assert_eq!( repo.view().get_git_ref("refs/remotes/origin/main"), @@ -2318,7 +2318,7 @@ fn test_fetch_initial_commit() { assert_eq!( view.bookmarks().collect::>(), btreemap! { - "main" => BranchTarget { + "main" => BookmarkTarget { local_target: &initial_commit_target, remote_refs: vec![ ("origin", &initial_commit_remote_ref), @@ -2392,7 +2392,7 @@ fn test_fetch_success() { assert_eq!( view.bookmarks().collect::>(), btreemap! { - "main" => BranchTarget { + "main" => BookmarkTarget { local_target: &new_commit_target, remote_refs: vec![ ("origin", &new_commit_remote_ref), @@ -2653,7 +2653,7 @@ fn test_push_bookmarks_success() { let targets = GitBranchPushTargets { branch_updates: vec![( "main".to_owned(), - BranchPushUpdate { + BookmarkPushUpdate { old_target: Some(setup.main_commit.id().clone()), new_target: Some(setup.child_of_main_commit.id().clone()), }, @@ -2722,7 +2722,7 @@ fn test_push_bookmarks_deletion() { let targets = GitBranchPushTargets { branch_updates: vec![( "main".to_owned(), - BranchPushUpdate { + BookmarkPushUpdate { old_target: Some(setup.main_commit.id().clone()), new_target: None, }, @@ -2771,14 +2771,14 @@ fn test_push_bookmarks_mixed_deletion_and_addition() { branch_updates: vec![ ( "main".to_owned(), - BranchPushUpdate { + BookmarkPushUpdate { old_target: Some(setup.main_commit.id().clone()), new_target: None, }, ), ( "topic".to_owned(), - BranchPushUpdate { + BookmarkPushUpdate { old_target: None, new_target: Some(setup.child_of_main_commit.id().clone()), }, @@ -2838,7 +2838,7 @@ fn test_push_bookmarks_not_fast_forward() { let targets = GitBranchPushTargets { branch_updates: vec![( "main".to_owned(), - BranchPushUpdate { + BookmarkPushUpdate { old_target: Some(setup.main_commit.id().clone()), new_target: Some(setup.sideways_commit.id().clone()), }, diff --git a/lib/tests/test_index.rs b/lib/tests/test_index.rs index 2d7d92ffb0..ed68d34207 100644 --- a/lib/tests/test_index.rs +++ b/lib/tests/test_index.rs @@ -344,10 +344,10 @@ fn test_index_commits_hidden_but_referenced() { let test_repo = TestRepo::init(); let repo = &test_repo.repo; - // Remote branches are usually visible at a certain point in operation + // Remote bookmarks are usually visible at a certain point in operation // history, but that's not guaranteed if old operations have been discarded. - // This can also happen if imported remote branches get immediately - // abandoned because the other branch has moved. + // This can also happen if imported remote bookmarks get immediately + // abandoned because the other bookmark has moved. let mut tx = repo.start_transaction(&settings); let commit_a = write_random_commit(tx.repo_mut(), &settings); let commit_b = write_random_commit(tx.repo_mut(), &settings); @@ -356,7 +356,7 @@ fn test_index_commits_hidden_but_referenced() { tx.repo_mut().remove_head(commit_b.id()); tx.repo_mut().remove_head(commit_c.id()); tx.repo_mut().set_remote_bookmark( - "branch", + "bookmark", "origin", RemoteRef { target: RefTarget::from_legacy_form( diff --git a/lib/tests/test_revset.rs b/lib/tests/test_revset.rs index e09cd53120..d7d1d2cd2d 100644 --- a/lib/tests/test_revset.rs +++ b/lib/tests/test_revset.rs @@ -2125,7 +2125,7 @@ fn test_evaluate_expression_remote_bookmarks() { // Can get bookmarks when there are none assert_eq!(resolve_commit_ids(mut_repo, "remote_bookmarks()"), vec![]); - // Branch 1 is untracked on remote origin + // Bookmark 1 is untracked on remote origin mut_repo.set_remote_bookmark( "bookmark1", "origin", @@ -2134,7 +2134,7 @@ fn test_evaluate_expression_remote_bookmarks() { state: RemoteRefState::New, }, ); - // Branch 2 is tracked on remote private + // Bookmark 2 is tracked on remote private mut_repo.set_remote_bookmark( "bookmark2", "private", diff --git a/lib/tests/test_rewrite.rs b/lib/tests/test_rewrite.rs index 1f029e172e..c785634e82 100644 --- a/lib/tests/test_rewrite.rs +++ b/lib/tests/test_rewrite.rs @@ -977,8 +977,8 @@ fn test_rebase_descendants_basic_bookmark_update() { let test_repo = TestRepo::init(); let repo = &test_repo.repo; - // Branch "main" points to commit B. B gets rewritten as B2. Branch main should - // be updated to point to B2. + // Bookmark "main" points to commit B. B gets rewritten as B2. Bookmark main + // should be updated to point to B2. // // B main B2 main // | => | @@ -1015,7 +1015,7 @@ fn test_rebase_descendants_bookmark_move_two_steps() { let test_repo = TestRepo::init(); let repo = &test_repo.repo; - // Branch "main" points to bookmark C. C gets rewritten as C2 and B gets + // Bookmark "main" points to bookmark C. C gets rewritten as C2 and B gets // rewritten as B2. C2 should be rebased onto B2, creating C3, and main // should be updated to point to C3. // @@ -1066,9 +1066,9 @@ fn test_rebase_descendants_basic_bookmark_update_with_non_local_bookmark() { let test_repo = TestRepo::init(); let repo = &test_repo.repo; - // Branch "main" points to commit B. B gets rewritten as B2. Branch main should - // be updated to point to B2. Remote bookmark main@origin and tag v1 should not - // get updated. + // Bookmark "main" points to commit B. B gets rewritten as B2. Bookmark main + // should be updated to point to B2. Remote bookmark main@origin and tag v1 + // should not get updated. // // B2 main // B main main@origin v1 | B main@origin v1 @@ -1125,7 +1125,7 @@ fn test_rebase_descendants_update_bookmark_after_abandon() { let test_repo = TestRepo::init(); let repo = &test_repo.repo; - // Branch "main" points to commit B. B is then abandoned. Branch main should + // Bookmark "main" points to commit B. B is then abandoned. Bookmark main should // be updated to point to A. // // B main @@ -1159,8 +1159,8 @@ fn test_rebase_descendants_update_bookmarks_after_divergent_rewrite() { let test_repo = TestRepo::init(); let repo = &test_repo.repo; - // Branch "main" points to commit B. B gets rewritten as {B2, B3, B4}, then - // B4 as {B41, B42}. Branch main should become a conflict pointing to {B2, + // Bookmark "main" points to commit B. B gets rewritten as {B2, B3, B4}, then + // B4 as {B41, B42}. Bookmark main should become a conflict pointing to {B2, // B3, B41, B42}. // // C other @@ -1228,7 +1228,7 @@ fn test_rebase_descendants_update_bookmarks_after_divergent_rewrite() { let main_target = tx.repo_mut().get_local_bookmark("main"); assert!(main_target.has_conflict()); - // If the branch were moved at each rewrite point, there would be separate + // If the bookmark were moved at each rewrite point, there would be separate // negative terms: { commit_b => 2, commit_b4 => 1 }. Since we flatten // intermediate rewrites, commit_b4 doesn't appear in the removed_ids. assert_eq!( @@ -1266,7 +1266,7 @@ fn test_rebase_descendants_rewrite_updates_bookmark_conflict() { let test_repo = TestRepo::init(); let repo = &test_repo.repo; - // Branch "main" is a conflict removing commit A and adding commits B and C. + // Bookmark "main" is a conflict removing commit A and adding commits B and C. // A gets rewritten as A2 and A3. B gets rewritten as B2 and B2. The bookmark // should become a conflict removing A and B, and adding B2, B3, C. let mut tx = repo.start_transaction(&settings); @@ -1351,7 +1351,7 @@ fn test_rebase_descendants_rewrite_resolves_bookmark_conflict() { let test_repo = TestRepo::init(); let repo = &test_repo.repo; - // Branch "main" is a conflict removing ancestor commit A and adding commit B + // Bookmark "main" is a conflict removing ancestor commit A and adding commit B // and C (maybe it moved forward to B locally and moved forward to C // remotely). Now B gets rewritten as B2, which is a descendant of C (maybe // B was automatically rebased on top of the updated remote). That @@ -1397,7 +1397,7 @@ fn test_rebase_descendants_bookmark_delete_modify_abandon() { let test_repo = TestRepo::init(); let repo = &test_repo.repo; - // Branch "main" initially points to commit A. One operation rewrites it to + // Bookmark "main" initially points to commit A. One operation rewrites it to // point to B (child of A). A concurrent operation deletes the bookmark. That // leaves the bookmark pointing to "-A+B". We now abandon B. That should // result in the bookmark pointing to "-A+A=0", so the bookmark should diff --git a/lib/tests/test_view.rs b/lib/tests/test_view.rs index 22d5f91fdd..0ebcecbb76 100644 --- a/lib/tests/test_view.rs +++ b/lib/tests/test_view.rs @@ -14,7 +14,7 @@ use std::collections::BTreeMap; -use jj_lib::op_store::BranchTarget; +use jj_lib::op_store::BookmarkTarget; use jj_lib::op_store::RefTarget; use jj_lib::op_store::RemoteRef; use jj_lib::op_store::RemoteRefState; @@ -269,7 +269,7 @@ fn test_merge_views_bookmarks() { ); let repo = commit_transactions(&settings, vec![tx1, tx2]); - let expected_main_bookmark = BranchTarget { + let expected_main_bookmark = BookmarkTarget { local_target: &RefTarget::from_legacy_form( [main_bookmark_local_tx0.id().clone()], [ @@ -283,7 +283,7 @@ fn test_merge_views_bookmarks() { ("origin", &main_bookmark_origin_tx2_remote_ref), ], }; - let expected_feature_bookmark = BranchTarget { + let expected_feature_bookmark = BookmarkTarget { local_target: &RefTarget::normal(feature_bookmark_tx1.id().clone()), remote_refs: vec![], };