ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib/src
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
..
default_index revset: add count_estimate() to Revset trait 2024-01-22 15:07:00 -08:00
lock
protos view: drop tracking of public heads 2024-01-13 22:23:57 -08:00
backend.rs object_id: extract ObjectId trait and macros to separate module 2024-01-05 10:20:57 +09:00
commit.rs
commit_builder.rs
conflicts.rs
content_hash.rs
dag_walk.rs
default_submodule_store.rs
diff.rs
file_util.rs op_store: implement GC of unreachble operations and views 2024-01-09 10:37:03 +09:00
files.rs
fmt_util.rs
fsmonitor.rs
git.rs git_backend: inline prevent_gc() to bulk-update refs 2024-01-17 10:43:25 +09:00
git_backend.rs git_backend: inline prevent_gc() to bulk-update refs 2024-01-17 10:43:25 +09:00
gitignore.rs
hex_util.rs
id_prefix.rs object_id: make ObjectId constructors non-trait methods 2024-01-05 23:36:57 +09:00
index.rs index: add all_heads_for_gc() that iterates heads of all indexed commits 2024-01-17 23:07:14 +09:00
lib.rs default_index: adopt revset engine and graph iterator modules 2024-01-07 05:37:47 -08:00
local_backend.rs object_id: extract ObjectId trait and macros to separate module 2024-01-05 10:20:57 +09:00
local_working_copy.rs working_copy: mark commit_id field in proto reserved 2024-01-12 17:38:23 -08:00
lock.rs
matchers.rs
merge.rs object_id: extract ObjectId trait and macros to separate module 2024-01-05 10:20:57 +09:00
merged_tree.rs
object_id.rs object_id: don't allow ObjectId::from_hex() a dynamically allocated string 2024-01-06 00:26:36 +09:00
op_heads_store.rs
op_store.rs op_store: add a virtual root operation, similar to root commit 2024-01-14 10:15:14 -08:00
op_walk.rs op_walk: assert that virtual root op is not reparented 2024-01-16 21:46:54 +09:00
operation.rs operation: remove operation::View wrapper in favor of view::View 2024-01-12 08:01:02 +09:00
refs.rs object_id: make ObjectId constructors non-trait methods 2024-01-05 23:36:57 +09:00
repo.rs repo: optimize enforce_view_invariants() to not traverse ancestors until root 2024-01-15 09:57:02 +09:00
repo_path.rs
revset.pest
revset.rs revset: add count_estimate() to Revset trait 2024-01-22 15:07:00 -08:00
revset_graph.rs object_id: extract ObjectId trait and macros to separate module 2024-01-05 10:20:57 +09:00
rewrite.rs object_id: extract ObjectId trait and macros to separate module 2024-01-05 10:20:57 +09:00
settings.rs object_id: make ObjectId constructors non-trait methods 2024-01-05 23:36:57 +09:00
signing.rs
simple_op_heads_store.rs object_id: extract ObjectId trait and macros to separate module 2024-01-05 10:20:57 +09:00
simple_op_store.rs op_store: add special case for root id resolution 2024-01-16 21:46:54 +09:00
stacked_table.rs
store.rs
str_util.rs
submodule_store.rs
transaction.rs
tree.rs object_id: extract ObjectId trait and macros to separate module 2024-01-05 10:20:57 +09:00
tree_builder.rs
view.rs view: drop tracking of public heads 2024-01-13 22:23:57 -08:00
working_copy.rs
workspace.rs no-op: Move external git repo canonicalization into Workspace::init_git_external 2024-01-16 10:46:02 +00:00