Repository navigation
Conversation
HistoryStore.copy_history(src, dst) copies every version of one file into another file's history (hard link, else copy), keeping ids, times, labels and descriptions and noting copied_from; ids already there are skipped and the source history is untouched. record() takes suffix= so an archive's model text can be stored as .rbds under the archive's history.
list_versions, snapshot_version, label_version and restore_version keyed the history on the workspace copy (models/<id>/model.rbds) as soon as a model was edited, or at open for an .rbdz, so the versions vanished when the file was reopened under a new model_id and the desktop never saw them. They now use the opened file whenever it is a real model file, and fall back to the workspace copy only for a model with no file (template, build_model, AWB import). Unedited, a snapshot stores the opened bytes in their own format; edited, the workspace copy is stored as .rbds under the opened file. Workspace.edited_since_open() tells the two apart by the undo chain's first backup. restore_version writes the version in its own format: an .rbdz version is written as .rbdz (it was written into an .rbds), and an .rbd as .rbd. The open-file guard now runs after the extension is settled. Reproduced: the MCP reopen loss (new test). The desktop reopen of an .rbds kept its versions in every route tried; see the Save As commit.
Versions are kept per user, keyed on where the file is, so a Save As to another name or format (.rbds to .rbdz, a rename, .rbd) started the new file with none, without a word. Save As now asks, in a small dialog shown only when it applies, whether to bring the old file's versions along (checked; unchecking says the new file starts with none and the versions stay with the old one), and for an .rbdz whether to include the results on screen. A model-only archive skips the results, the archive-results guard and the manifest's results; a plain Save of that archive repeats the choice until another model is loaded. A failed copy keeps the save and warns. Plain Save never asks. Cause of the reported ".rbds reopen loses versions": not reproduced in the desktop app. Close and reopen by path, plain save then reopen, and opening through a symlink all keep the versions (regression test added). The loss reproduced only after a Save As to .rbdz, when Recent opens the .rbdz, which had no versions: that is what this commit fixes. The MCP route (fixed in the previous commit) is the other confirmed cause.
The Version History dialog now says, in a visible note, that a file's versions are kept on this computer, tied to where the file is, not inside it (an .rbdz holds the model and its results, not its versions), and that Save As offers to bring them along. Restore is disabled for a version saved in another format than the open file (an MCP edit of an .rbdz is stored as .rbds); its tooltip points to Open as copy, then Save As.
Add models now lists "Saved version of <file>" after "From a file…" when the open file has versions: the 20 newest, each by label (or "(no label)") and time. A chosen version is a SavedVersion entry, named "<file> · <label or time>", run from its stored file, handed to What's different? by its path, and listed once. Compare's and Differences' file filters accept .rbds, .rbdz and .rbd (load_model_file already reads all three). docs/VERSION_HISTORY.md says versions are not inside any file, and covers Save As, the MCP rule and Compare.
This branch has not been deployed
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.
Closes #389
.rbdz, which holds the model, its results and a manifest. The Version History window now says this in a visible note..rbdzwhether to include the results. Nothing is dropped silently any more. Versions are copied withHistoryStore.copy_history, which keeps their ids, labels and descriptions and leaves the old file's versions untouched.list_versionsafter a close and reopen.restore_versionnow writes a snapshot in its own format; before, an.rbdzsnapshot was written into a.rbdsfile..rbdz.Root cause: on the desktop, reopening a
.rbdskept its versions on every route tried. The loss reproduced only after Save As.rbdzfollowed by reopening from Recent, which now points to the.rbdzand so has no versions, and through MCP. Both are fixed.Known gap: the What's different? label for a saved version shows the stored snapshot's file name, not the version label.
Tests run locally, with
-m "":