diff --git a/cli/src/commands/mod.rs b/cli/src/commands/mod.rs index 0515b3696..2ef866520 100644 --- a/cli/src/commands/mod.rs +++ b/cli/src/commands/mod.rs @@ -1648,7 +1648,7 @@ fn cmd_status( .collect_vec(); let conflicted_remote_branches = repo .view() - .remote_branches() + .all_remote_branches() .filter(|(_, target)| target.has_conflict()) .map(|(full_name, _)| full_name) .collect_vec(); diff --git a/lib/src/git.rs b/lib/src/git.rs index 236cb8444..6ec74ba2d 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -341,19 +341,20 @@ fn diff_refs_to_import( }) .collect(); let mut known_remote_refs: HashMap = itertools::chain( - view.remote_branches().map(|((branch, remote), target)| { - // TODO: want to abstract local ref as "git" tracking remote, but - // we'll probably need to refactor the git_ref_filter API first. - let ref_name = if remote == REMOTE_NAME_FOR_LOCAL_GIT_REPO { - RefName::LocalBranch(branch.to_owned()) - } else { - RefName::RemoteBranch { - branch: branch.to_owned(), - remote: remote.to_owned(), - } - }; - (ref_name, target) - }), + view.all_remote_branches() + .map(|((branch, remote), target)| { + // TODO: want to abstract local ref as "git" tracking remote, but + // we'll probably need to refactor the git_ref_filter API first. + let ref_name = if remote == REMOTE_NAME_FOR_LOCAL_GIT_REPO { + RefName::LocalBranch(branch.to_owned()) + } else { + RefName::RemoteBranch { + branch: branch.to_owned(), + remote: remote.to_owned(), + } + }; + (ref_name, target) + }), // TODO: compare to tags stored in the "git" remote view. Since tags should never // be moved locally in jj, we can consider local tags as merge base. view.tags().iter().map(|(name, target)| { @@ -588,7 +589,7 @@ fn diff_refs_to_export( let mut all_branch_targets: HashMap = itertools::chain( view.local_branches() .map(|(branch, target)| (RefName::LocalBranch(branch.to_owned()), target)), - view.remote_branches() + view.all_remote_branches() .filter(|&((_, remote), _)| remote != REMOTE_NAME_FOR_LOCAL_GIT_REPO) .map(|((branch, remote), target)| { let ref_name = RefName::RemoteBranch { diff --git a/lib/src/repo.rs b/lib/src/repo.rs index 8b828c7d2..a30dd666d 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -1108,7 +1108,7 @@ impl MutableRepo { let changed_refs = itertools::chain!( diff_named_refs(base.local_branches(), other.local_branches()) .map(|(name, diff)| (RefName::LocalBranch(name.to_owned()), diff)), - diff_named_refs(base.remote_branches(), other.remote_branches()).map( + diff_named_refs(base.all_remote_branches(), other.all_remote_branches()).map( |((branch, remote), diff)| { let ref_name = RefName::RemoteBranch { branch: branch.to_owned(), diff --git a/lib/src/view.rs b/lib/src/view.rs index 72c5dbbd1..d498b8a35 100644 --- a/lib/src/view.rs +++ b/lib/src/view.rs @@ -192,7 +192,7 @@ impl View { /// Iterates remote branch `((name, remote_name), target)`s in /// lexicographical order. - pub fn remote_branches(&self) -> impl Iterator { + pub fn all_remote_branches(&self) -> impl Iterator { // TODO: maybe yield RemoteRef instead of RefTarget? op_store::flatten_remote_branches(&self.data.remote_views) }