ok/jj
1
0
Fork 0
forked from mirrors/jj

refs: rename diff_named_refs() to diff_named_ref_targets()

I'm going to add RemoteRef variant of this function, and "refs" there will
be ambiguous.
This commit is contained in:
Yuya Nishihara 2023-10-21 08:00:07 +09:00
parent 59eb03eec5
commit 6450194ccd
2 changed files with 6 additions and 6 deletions

View file

@ -24,7 +24,7 @@ use crate::op_store::{RefTarget, RemoteRef};
/// Compares `refs1` and `refs2` targets, yields entry if they differ.
///
/// `refs1` and `refs2` must be sorted by `K`.
pub fn diff_named_refs<'a, 'b, K: Ord>(
pub fn diff_named_ref_targets<'a, 'b, K: Ord>(
refs1: impl IntoIterator<Item = (K, &'a RefTarget)>,
refs2: impl IntoIterator<Item = (K, &'b RefTarget)>,
) -> impl Iterator<Item = (K, (&'a RefTarget, &'b RefTarget))> {

View file

@ -46,7 +46,7 @@ use crate::op_store::{
OpStore, OpStoreError, OperationId, RefTarget, RemoteRef, RemoteRefState, WorkspaceId,
};
use crate::operation::Operation;
use crate::refs::{diff_named_refs, merge_ref_targets};
use crate::refs::{diff_named_ref_targets, merge_ref_targets};
use crate::revset::{self, ChangeIdIndex, Revset, RevsetExpression};
use crate::rewrite::DescendantRebaser;
use crate::settings::{RepoSettings, UserSettings};
@ -1133,9 +1133,9 @@ impl MutableRepo {
// TODO: somehow merge tracking state of remote refs?
let changed_refs = itertools::chain!(
diff_named_refs(base.local_branches(), other.local_branches())
diff_named_ref_targets(base.local_branches(), other.local_branches())
.map(|(name, diff)| (RefName::LocalBranch(name.to_owned()), diff)),
diff_named_refs(
diff_named_ref_targets(
base.all_remote_branches()
.map(|(full_name, remote_ref)| (full_name, &remote_ref.target)),
other
@ -1149,9 +1149,9 @@ impl MutableRepo {
};
(ref_name, diff)
}),
diff_named_refs(base.tags(), other.tags())
diff_named_ref_targets(base.tags(), other.tags())
.map(|(name, diff)| (RefName::Tag(name.to_owned()), diff)),
diff_named_refs(base.git_refs(), other.git_refs())
diff_named_ref_targets(base.git_refs(), other.git_refs())
.map(|(name, diff)| (RefName::GitRef(name.to_owned()), diff)),
);
for (ref_name, (base_target, other_target)) in changed_refs {