Repository navigation
Lightroom import gives the photos it adds the catalog's settings and history, not their file's XMP - #731
Merged
emmertex merged 1 commit intoNov 1, 2026
Conversation
…e XMP read from a file it adds or a browse left untouched Importing a catalog first adds the originals, and adding (or an earlier browse) merges the develop settings from the file's XMP and sets `edited`. `apply_prepared` then took those for edits the library already had and kept them over the catalog's (`keep_develop`), which also skipped the catalog's history and snapshots, counting the photo under `preservedExistingEdits`. An edit made in Lightroom since the file's XMP was saved was lost. The import now never counts photos its own add step created, or Local ones untouched since browsing (judged again at apply time, for offline originals), as existing: `ImportReport.promoted_changed` (not serialized) lists the promoted Local records changed after browsing, and only those, with records the library had before, keep their edits. For the others the catalog's settings start from the camera's defaults, since Lightroom leaves settings at zero (Clarity, Texture) out of its develop text; when that text can't be read, the photo keeps what it had. Sources: own design, ported from storytold#3435. UPSTREAM-PR: storytold#3435 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #730
Port of storytold/lightcraft PR #3435 (storytold/lightcraft issue #3434): storytold/lightcraft#3435
Problem
Importing a Lightroom Classic catalog into a new, empty library gave a raw whose file holds develop settings in XMP
(embedded in a DNG, or a
.xmpsidecar) those settings instead of the catalog's, dropped its Lightroom history andsnapshots, and counted it under
preservedExistingEdits. Any edit made in Lightroom since the metadata was lastsaved to the file was lost. A photo that had only been browsed (Local) and not touched since was treated the same
way.
Cause: the import first adds the originals to the library, and adding a raw (or browsing it earlier) merges the
settings from its XMP, which sets the photo's
editedtime.apply_preparedthen found that photo by path, sawedits, and set
keep_develop, which here also skips the catalog's history and snapshots.Change
Ported by hand from the upstream PR's two commits; the app keeps the import report in
import.rshere, and itskeep_developalso guards history and snapshots, so those come back with the settings.crates/engine/src/lightroom_catalog.rs:apply_preparedcollects the photos its own add step created orpromoted from Local (
files.imported, minus the promoted ones changed after browsing) and never treats those asexisting, so
keep_developapplies only to photos with changes of the library's own. A Local record stilluntouched since browsing counts as new too when its original is offline (missing originals skip the add step).
For these photos the catalog's settings start from the camera's defaults, not from what the file's XMP or a
default import preset gave the photo: Lightroom leaves some settings at zero out of its develop text (Clarity,
Texture), so a value only the file or preset holds would otherwise survive. When the catalog's develop text can't be read,
the photo keeps what it had, with a warning, instead of being left on the camera's defaults.
crates/engine/src/import.rs:ImportReportgainspromoted_changed(not serialized): the Local records amongimportedthatuntouched_local()says were changed after browsing, read before the promotion is committed.docs/lightroom-catalog-import.mdstates the rule; What's New and changelog entries.Not in this PR: "changed after browsing" is
untouched_local()'s whole-record test, so a browsed photo whoseonly change is a rating or keyword still keeps the settings it read from its file (conservative: nothing is lost).
updateExisting: trueover a photo with library edits still applies the catalog's settings on top of them, asbefore; a catalog row with no develop settings leaves the file's in place. A new virtual copy still starts from its
master's settings, so a value the copy's settings leave out comes from the master, and a catalog photo whose
original has the same bytes as another record starts from that record's settings (both older than this PR). A raw
given a default import preset keeps it as its import look, so Reset Edits returns to that preset, as before. Why a JPEG
with the same embedded settings was spared before was not traced.
How it was checked
cargo xtask ci --fast,cargo xtask silandcargo test --workspace --no-fail-fastpass on thisbranch, except three
lcc-enginepeerstests and onelcc-updaterzip-swap test that fail the same way onmainon this Mac.
a_photo_this_import_adds_takes_the_catalogs_settings_over_its_files_xmp: a DNG with embedded XMP and a DNG witha sidecar, both saying Dehaze 0 and Clarity +20, imported from a catalog that says Dehaze −50 with two history
steps, and a default raw import preset setting Texture 12. With the fix reverted,
preservedExistingEditsis 2(not 0) and no history comes in; without the camera-defaults reset, Clarity stays 20.
a_browsed_photo_keeps_only_edits_made_after_browsing: a real.lrcatimport (catalog Dehaze −50 and onehistory step) over a Local record holding settings read at browse time, untouched or edited after browsing,
with its original present or offline. Counting every promoted record as changed fails the untouched case
(preserved 1, not 0); counting none fails the edited case (preserved 0, not 1); without the
untouched_local()check at apply time the offline untouched case fails (preserved 1, not 0); without the camera-defaults reset a
Clarity the catalog leaves out stays 15.
unreadable_catalog_settings_leave_a_new_photos_file_settings: a DNG whose embedded XMP sets Clarity +20, with adefault raw import preset setting Texture 12, from a catalog whose develop text can't be read: both values stay,
with a warning. Resetting to the camera's defaults without checking the text first leaves Clarity at 0.
to file and then edited once more (Dehaze −50). Before:
preservedExistingEdits5,historySteps3, and the 5 rawshad Dehaze 0 and no history. After, into an empty library and into one with the folder browsed first:
preservedExistingEdits0,historySteps18, all six with Dehaze −50, Exposure +1 and 3 history steps. Importingthe catalog again keeps all six (
preservedExistingEdits6, nothing added).Acceptance criteria
history, whatever XMP its file embeds or its sidecar holds; the report's
preservedExistingEditsis 0. —test
a_photo_this_import_adds_takes_the_catalogs_settings_over_its_files_xmp(seen failing with the fixreverted)
updateExistingis true (today's rule for real existing edits). — existing testpreserves_existing_edits_and_rejects_invalid_structure_before_mutation, and the edited cases ofa_browsed_photo_keeps_only_edits_made_after_browsingkeep_developstill needseditedset (lightroom_catalog.rs)history too, though browsing read settings from its file's XMP, also when its original is offline; one changed
after browsing keeps its edits, as in AC-2. — test
a_browsed_photo_keeps_only_edits_made_after_browsing(each case seen failing with its rule reverted)
(Lightroom omits Clarity, Texture and others at zero) comes from the camera's defaults, not from the file's XMP
or a default import preset; a catalog row with no develop text leaves the photo's settings as they are. —
Clarity and Texture assertions in both tests (Clarity seen failing without the reset); the reset is skipped
when the row has no develop text or it can't be read (
lightroom_catalog.rs; testunreadable_catalog_settings_leave_a_new_photos_file_settings, seen failing without that check)Merging
UPSTREAM-PR:.get different settings: the catalog's.
unsafe, build scripts, network access, spawned processes, deleted files, CI orxtaskgatechanges: none.
Sources: own design, ported from storytold/lightcraft PR #3435.
🤖 Generated with Claude Code