-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
08da40b
commit 0bc1341
Showing
6 changed files
with
84 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters