fix(workspace): newer-format editor stays usable; media learn the home's photo names
A pull onto a newer Chronos's settings made the editor throw: ProjectHistory.Replace rebased every undo and redo snapshot through ProjectMerge, which refuses to merge a newer format when both sides changed, so any non-empty undo stack broke the reload after a sync that had succeeded. Replace now drops the steps instead when either side (or a step) is of a newer format: the project is shown read-only and undo never brings back values from before the newer settings. The media learnt the home's hashes and conversion aliases only inside a replay, so a status or Save version before that compared a SHA-named base with photo-named media and read a false Modified or saved a version that only re-keyed photos. Now: - ProjectContent.SameChoices also compares the texts as placed on the frames, hashed or not (Bound), so status and commit without a home agree with the base; - a status asked of the home teaches the media its names (written under the lease, or when the lease is free), and so does a checkout of a project already here; - WorkspaceStatus.MediaOutdated reports frames moved at the home, or names the media could not learn yet, and the project menu offers Update media for it (tooltip text updated in en and it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8256b72913
commit
43b092bd5d
10 files changed
+321
-19
No files matched your search
@@ -69,12 +69,23 @@ public sealed class ProjectHistory(ProjectSettings initial, int capacity = 200,
|
||||
/// <summary>
|
||||
/// Adopts a project changed outside the editor (analysis advice, another client's edit merged on save) without an
|
||||
/// undo step. Every undo and redo snapshot takes the same outside change, so undo reverts only the user's own steps
|
||||
/// and never brings back a value that predates the adopted change.
|
||||
/// and never brings back a value that predates the adopted change. Settings of a newer Chronos on either side (a pull
|
||||
/// took them: the project is shown read-only) are never merged with this one's (<see cref="ProjectMerge"/>), so no step
|
||||
/// can take that change: the undo and redo steps go instead, and undo never brings back values from before it.
|
||||
/// </summary>
|
||||
public void Replace(ProjectSettings current)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(current);
|
||||
if (ProjectMerge.SameValues(current, Current)) return;
|
||||
if (current.IsNewerFormat || Current.IsNewerFormat || _undo.Any(s => s.IsNewerFormat) || _redo.Any(s => s.IsNewerFormat))
|
||||
{
|
||||
_undo.Clear();
|
||||
_redo.Clear();
|
||||
_runKey = null;
|
||||
Current = current;
|
||||
Changed?.Invoke();
|
||||
return;
|
||||
}
|
||||
var (basis, theirs) = (Current, current);
|
||||
Func<ProjectSettings, ProjectSettings> rebase = merge is null ? new ProjectMerge.Rebase(basis, theirs).Apply : step => merge(basis, step, theirs);
|
||||
Rebase(_undo, rebase);
|
||||
|
||||
Reference in new issue
Block a user