Skip to main content

Module library_merge

Module library_merge 

Source
Expand description

Merging another Eagle library into the open one (Eagle’s Library ▸ Import Library).

Eagle refuses the library that is open, asks with the other library’s top-level folder count and the number of entries in its images/, then:

  • folders: a top-level folder whose id the open library already has is not added again; its subfolders go through the same test inside the existing one. New folders are added with their whole subtree.
  • smart folders and tag groups whose id is already present are skipped, the rest are appended.
  • every images/<id>.info folder the open library lacks is copied verbatim; ones it has are left alone. The items keep their folder ids, which the merged tree now contains.

falcon differs in two small ways: it copies only *.info folders (not stray files in images/), and a new folder’s descendants whose ids already exist elsewhere in the open library are merged into those instead of being added a second time, so the tree never holds one id twice. Each item folder is copied under a temporary name and renamed into place, so an interrupted merge never leaves half an item.

The copy (copy_items) needs no lock on the open library and runs on a background thread; Library::finish_merge then merges the folder tree and registers the copied items.

Structs§

MergePlan
What merging source would bring in, read before asking.
MergeReport
What a finished merge added.

Enums§

MergeRefusal
Why a merge can’t start.

Functions§

copy_items
Copies the plan’s item folders that dest_root lacks into its images/, calling progress(done, total) after each, and stops early when cancel is set. Returns the folder names copied. A folder that fails to copy is skipped (its partial copy removed) and reported in the second list with the reason.
plan
Reads source to merge into dest.