diff --git a/lib/src/conflicts.rs b/lib/src/conflicts.rs index f1bdf72c54..2d85033466 100644 --- a/lib/src/conflicts.rs +++ b/lib/src/conflicts.rs @@ -367,10 +367,12 @@ pub fn materialized_diff_stream<'a>( .buffered((store.concurrency() / 2).max(1)) } -/// Parses conflict markers from a slice. Returns None if there were no valid -/// conflict markers. The caller has to provide the expected number of merge -/// sides (adds). Conflict markers that are otherwise valid will be considered -/// invalid if they don't have the expected arity. +/// Parses conflict markers from a slice. +/// +/// Returns `None` if there were no valid conflict markers. The caller +/// has to provide the expected number of merge sides (adds). Conflict +/// markers that are otherwise valid will be considered invalid if +/// they don't have the expected arity. // TODO: "parse" is not usually the opposite of "materialize", so maybe we // should rename them to "serialize" and "deserialize"? pub fn parse_conflict(input: &[u8], num_sides: usize) -> Option>> { diff --git a/lib/src/diff.rs b/lib/src/diff.rs index 1472bea49f..ea6de6b315 100644 --- a/lib/src/diff.rs +++ b/lib/src/diff.rs @@ -672,11 +672,13 @@ impl<'diff, 'input> Iterator for DiffHunkIterator<'diff, 'input> { } } -/// Diffs slices of bytes. The returned diff hunks may be any length (may -/// span many lines or may be only part of a line). This currently uses -/// Histogram diff (or maybe something similar; I'm not sure I understood the -/// algorithm correctly). It first diffs lines in the input and then refines -/// the changed ranges at the word level. +/// Diffs slices of bytes. +/// +/// The returned diff hunks may be any length (may span many lines or +/// may be only part of a line). This currently uses Histogram diff +/// (or maybe something similar; I'm not sure I understood the +/// algorithm correctly). It first diffs lines in the input and then +/// refines the changed ranges at the word level. pub fn diff<'a, T: AsRef<[u8]> + ?Sized + 'a>( inputs: impl IntoIterator, ) -> Vec> { diff --git a/lib/src/fsmonitor.rs b/lib/src/fsmonitor.rs index eaa88ed47c..4cf93f4076 100644 --- a/lib/src/fsmonitor.rs +++ b/lib/src/fsmonitor.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +//! Filesystem monitor tool interface. +//! //! Interfaces with a filesystem monitor tool to efficiently query for //! filesystem updates, without having to crawl the entire working copy. This is //! particularly useful for large working copies, or for working copies for diff --git a/lib/src/merge.rs b/lib/src/merge.rs index 341a397d41..dd9fd51cbe 100644 --- a/lib/src/merge.rs +++ b/lib/src/merge.rs @@ -519,10 +519,12 @@ impl ContentHash for Merge { /// Borrowed `MergedTreeValue`. pub type MergedTreeVal<'a> = Merge>; -/// The value at a given path in a commit. It depends on the context whether it -/// can be absent (`Merge::is_absent()`). For example, when getting the value at -/// a specific path, it may be, but when iterating over entries in a tree, it -/// shouldn't be. +/// The value at a given path in a commit. +/// +/// It depends on the context whether it can be absent +/// (`Merge::is_absent()`). For example, when getting the value at a +/// specific path, it may be, but when iterating over entries in a +/// tree, it shouldn't be. pub type MergedTreeValue = Merge>; impl MergedTreeValue { diff --git a/lib/src/merged_tree.rs b/lib/src/merged_tree.rs index 81090aedb0..4ce2abe2ea 100644 --- a/lib/src/merged_tree.rs +++ b/lib/src/merged_tree.rs @@ -1101,10 +1101,13 @@ impl Stream for TreeDiffStreamImpl<'_> { } } -/// Helps with writing trees with conflicts. You start by creating an instance -/// of this type with one or more base trees. You then add overrides on top. The -/// overrides may be conflicts. Then you can write the result as a legacy tree -/// (allowing path-level conflicts) or as multiple conflict-free trees. +/// Helper for writing trees with conflicts. +/// +/// You start by creating an instance of this type with one or more +/// base trees. You then add overrides on top. The overrides may be +/// conflicts. Then you can write the result as a legacy tree +/// (allowing path-level conflicts) or as multiple conflict-free +/// trees. pub struct MergedTreeBuilder { base_tree_id: MergedTreeId, overrides: BTreeMap, diff --git a/lib/src/rewrite.rs b/lib/src/rewrite.rs index b58213e7a6..9f336e9bdc 100644 --- a/lib/src/rewrite.rs +++ b/lib/src/rewrite.rs @@ -463,12 +463,14 @@ pub struct MoveCommitsStats { } /// Moves `target_commits` from their current location to a new location in the -/// graph, given by the set of `new_parent_ids` and `new_children`. -/// The roots of `target_commits` are rebased onto the new parents, while the -/// new children are rebased onto the heads of `target_commits`. -/// This assumes that `target_commits` and `new_children` can be rewritten, and -/// there will be no cycles in the resulting graph. -/// `target_commits` should be in reverse topological order. +/// graph. +/// +/// The roots of `target_commits` are rebased onto the new parents +/// given by `new_parent_ids`, while the `new_children` commits are +/// rebased onto the heads of `target_commits`. This assumes that +/// `target_commits` and `new_children` can be rewritten, and there +/// will be no cycles in the resulting graph. `target_commits` should +/// be in reverse topological order. pub fn move_commits( settings: &UserSettings, mut_repo: &mut MutableRepo, diff --git a/lib/src/stacked_table.rs b/lib/src/stacked_table.rs index d88e053669..b7d140c1a2 100644 --- a/lib/src/stacked_table.rs +++ b/lib/src/stacked_table.rs @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! A persistent table of fixed-size keys to variable-size values. The keys are -//! stored in sorted order, with each key followed by an integer offset into the -//! list of values. The values are concatenated after the keys. A file may have -//! a parent file, and the parent may have its own parent, and so on. The child -//! file then represents the union of the entries. +//! A persistent table of fixed-size keys to variable-size values. +//! +//! The keys are stored in sorted order, with each key followed by an +//! integer offset into the list of values. The values are +//! concatenated after the keys. A file may have a parent file, and +//! the parent may have its own parent, and so on. The child file then +//! represents the union of the entries. #![allow(missing_docs)] diff --git a/lib/src/transaction.rs b/lib/src/transaction.rs index 32e98e0bf4..a85d1e7c60 100644 --- a/lib/src/transaction.rs +++ b/lib/src/transaction.rs @@ -164,6 +164,8 @@ pub fn create_op_metadata( } } +/// An unpublished operation in the store. +/// /// An Operation which has been written to the operation store but not /// published. The repo can be loaded at an unpublished Operation, but the /// Operation will not be visible in the op log if the repo is loaded at head. diff --git a/lib/src/workspace.rs b/lib/src/workspace.rs index 7d03ca610f..e624a92614 100644 --- a/lib/src/workspace.rs +++ b/lib/src/workspace.rs @@ -93,6 +93,8 @@ pub enum WorkspaceLoadError { Path(#[from] PathError), } +/// The combination of a repo and a working copy. +/// /// Represents the combination of a repo and working copy, i.e. what's typically /// the .jj/ directory and its parent. See ///