ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib/src/default_index
Jonathan Tan 0bc1341fd0 revset: add count_estimate() to Revset trait
The count() function in this trait is used by "jj branch" to determine
(and then report) how many commits a certain branch is ahead/behind
another branch. This is currently implemented by walking all commits
in the revset, counting how many were encountered. But this could be
improved: if the number is large, it is probably sufficient to report
"at least N" (instead of walking all the way), and this does not scale
well to jj backends that may not have all commits present locally (which
may prefer to return an estimate, rather than access the network).

Therefore, add a function that is explicitly documented to be O(1)
and that can return a range of values if the backend so chooses.

Also remove count(), as it is not immediately obvious that it is an
expensive call, and callers that are willing to pay the cost can obtain
the exact same functionality through iter().count() anyway. (In this
commit, all users of count() are migrated to iter().count() to preserve
all existing functionality; they will be migrated to count_estimate() in
a subsequent commit.)

"branch" needed to be updated due to this change. Although jj
is currently only available in English, I have attempted to keep
user-visible text from being assembled piece by piece, so that if we
later decide to translate jj into other languages, things will be easier
for translators.
2024-01-22 15:07:00 -08:00
..
composite.rs index: add all_heads_for_gc() that iterates heads of all indexed commits 2024-01-17 23:07:14 +09:00
entry.rs object_id: extract ObjectId trait and macros to separate module 2024-01-05 10:20:57 +09:00
mod.rs index: add all_heads_for_gc() that iterates heads of all indexed commits 2024-01-17 23:07:14 +09:00
mutable.rs index: add all_heads_for_gc() that iterates heads of all indexed commits 2024-01-17 23:07:14 +09:00
readonly.rs index: add all_heads_for_gc() that iterates heads of all indexed commits 2024-01-17 23:07:14 +09:00
rev_walk.rs
revset_engine.rs revset: add count_estimate() to Revset trait 2024-01-22 15:07:00 -08:00
revset_graph_iterator.rs default_index: adopt revset engine and graph iterator modules 2024-01-07 05:37:47 -08:00
store.rs index: fix reindexing to scan all referenced commits such as hidden remote refs 2024-01-12 12:53:16 +09:00