Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up diverging structure in bookmark trees #19

Merged
merged 15 commits into from
Jan 30, 2019
Merged

Commits on Jan 18, 2019

  1. Configuration menu
    Copy the full SHA
    b5e38d4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f844722 View commit details
    Browse the repository at this point in the history
  3. Reupload diverged nodes.

    linabutler committed Jan 18, 2019
    Configuration menu
    Copy the full SHA
    eeaee8f View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2019

  1. Configuration menu
    Copy the full SHA
    615707f View commit details
    Browse the repository at this point in the history
  2. Don't store placeholders for missing children in entries.

    Originally, I'd intended for the tree to expose diverging structure to
    the merger, and for the merger to fix it. That was part of why I split
    `Item` into `Existing` and `Missing` variants.
    
    However, it turns out it's simpler to resolve divergences in the tree,
    and expose a well-formed structure to the merger instead. Changing
    `Item` to an enum means we now need a pattern match for _every_ item,
    when all we really want is a flag on the parent that says "this folder
    has diverged because it has a missing child".
    
    `Entry::divergence` already flags diverging structure for multiple
    parents, so let's use it to also flag parents with missing children,
    instead of forcing the merger to handle invalid structure for this one
    case.
    linabutler committed Jan 19, 2019
    Configuration menu
    Copy the full SHA
    8225591 View commit details
    Browse the repository at this point in the history
  3. Refactor and refine the new tree.

    * Add missing doc comments.
    * Rename reparenting methods for clarity.
    * Move `Tree::{children, parent}_for_entry` to
      `Node::{children, parent}`.
    * Remove optional return value from `Node::level`.
    * Add `Node::is_{root, default_parent_for_orphans}`.
    * Iterate over `Tree::entries` instead of
      `Tree::entry_index_by_guid`. The two should point to the same
      entries, but `entries` is more direct.
    * Don't mark trees with orphans as equal.
    linabutler committed Jan 19, 2019
    Configuration menu
    Copy the full SHA
    ea1a022 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ed65291 View commit details
    Browse the repository at this point in the history
  5. Remove Item::Missing.

    This reverts commit b5e38d4.
    linabutler committed Jan 19, 2019
    Configuration menu
    Copy the full SHA
    d23fd74 View commit details
    Browse the repository at this point in the history
  6. Remove unused deps.

    linabutler committed Jan 19, 2019
    Configuration menu
    Copy the full SHA
    67b6cb7 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2019

  1. Reviews from @thomcc and @mhammond.

    * Clarify why `merge::Driver` exists.
    * Make `Merger` generic over `Driver`, instead of using a trait object.
    * Use `clone` instead of `to_owned`.
    * Replace `Entry#is` with `std::ptr::eq`.
    * Add `MergedNode::remote_guid_changed`.
    linabutler committed Jan 26, 2019
    Configuration menu
    Copy the full SHA
    a1ba30b View commit details
    Browse the repository at this point in the history
  2. Don't store divergence on tree nodes.

    In most cases, `node.2 == node.entry().divergence`, except for
    orphans, default orphans, and diverging `parentid`s. This is a
    surprising inconsistency that means `node_for_guid` and
    `children` need to do more work to figure out if the node has
    actually diverged.
    
    This commit:
    
    * Changes the tree to flag divergent `parentid`s at `insert` time.
    * Cleans up `Tree::structure_for_insert`, to clarify what happens when
      a `parentid` is or isn't provided.
    * Moves the logic for checking default folder divergences into
      `Node::diverged`.
    * Replaces `EntryParents::{indices, guids}` with `EntryParents::iter()`,
      which doesn't allocate (thanks, @thomcc!).
    linabutler committed Jan 26, 2019
    Configuration menu
    Copy the full SHA
    b182366 View commit details
    Browse the repository at this point in the history
  3. @pjenvey's review.

    * Clean up optionals with `.map_or(...)` and `.filter(...).map(...)`.
    * Explain why we use `ptr::eq` to compare entries.
    linabutler committed Jan 26, 2019
    Configuration menu
    Copy the full SHA
    25b31ef View commit details
    Browse the repository at this point in the history
  4. Naming is the hardest problem in computer science.

    * Shorten import paths.
    * Rename `Child::Existing` to `Child::Exists`.
    * Rename `Divergence::Ok` to `Divergence::Consistent`, since `Ok`
      might be confused with `Result`.
    linabutler committed Jan 26, 2019
    Configuration menu
    Copy the full SHA
    3842b40 View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2019

  1. Include nodes from both sides for each MergeState.

    We need this to apply the merged tree, when we join to the local and
    remote trees.
    linabutler committed Jan 29, 2019
    Configuration menu
    Copy the full SHA
    ceb45d6 View commit details
    Browse the repository at this point in the history
  2. Refactor error handling in Store.

    * Fix infinite recursion in `fmt::Display::fmt()` for `Error`.
    * Make `Store` generic over the error type. This allows callers to
      provide their own error types that unify with Dogear errors,
      `nsresult`s, and others, instead of requiring them to wrap their
      errors into `ErrorKind::Storage(...)`.
    * Forward decoding errors from `Guid::from{utf8, uft16}()`.
    * Rename `ErrorKind::GenerateGuid` to `ErrorKind::InvalidGuid`.
    * Move `dogear::merge` into `Store::merge`.
    linabutler committed Jan 29, 2019
    Configuration menu
    Copy the full SHA
    07fd161 View commit details
    Browse the repository at this point in the history