forked from mirrors/jj
view: rename remote_branches() to all_remote_branches()
I'm going to add a method that iterates branches of certain remote, and I can't find a better name for it than remote_branches(remote_name).
This commit is contained in:
parent
f4a6415865
commit
8bdef924c8
4 changed files with 18 additions and 17 deletions
|
@ -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();
|
||||
|
|
|
@ -341,19 +341,20 @@ fn diff_refs_to_import(
|
|||
})
|
||||
.collect();
|
||||
let mut known_remote_refs: HashMap<RefName, &RefTarget> = 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<RefName, (&RefTarget, &RefTarget)> = 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 {
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -192,7 +192,7 @@ impl View {
|
|||
|
||||
/// Iterates remote branch `((name, remote_name), target)`s in
|
||||
/// lexicographical order.
|
||||
pub fn remote_branches(&self) -> impl Iterator<Item = ((&str, &str), &RefTarget)> {
|
||||
pub fn all_remote_branches(&self) -> impl Iterator<Item = ((&str, &str), &RefTarget)> {
|
||||
// TODO: maybe yield RemoteRef instead of RefTarget?
|
||||
op_store::flatten_remote_branches(&self.data.remote_views)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue