|
KiCad PCB EDA Suite
|
Simple local history manager built on libgit2. More...
#include <local_history.h>
Classes | |
| struct | SAVER_ENTRY |
Public Member Functions | |
| LOCAL_HISTORY () | |
| ~LOCAL_HISTORY () | |
| bool | Init (const wxString &aProjectPath) |
| Initialize the local history repository for the given project path. | |
| bool | CommitSnapshot (const std::vector< wxString > &aFiles, const wxString &aTitle) |
| Commit the given files to the local history repository. | |
| bool | CommitFullProjectSnapshot (const wxString &aProjectPath, const wxString &aTitle) |
| Commit a snapshot of the entire project directory (excluding the .history directory and ignored transient files) to the local history repository. | |
| void | RegisterSaver (const void *aSaverObject, const std::function< void(const wxString &, std::vector< HISTORY_FILE_DATA > &)> &aSaver, const std::weak_ptr< void > &aLifetime={}) |
| Register a saver callback invoked during autosave history commits. | |
| void | UnregisterSaver (const void *aSaverObject) |
| Unregister a previously registered saver callback. | |
| void | ClearAllSavers () |
| Clear all registered savers. | |
| bool | RunRegisteredSaversAndCommit (const wxString &aProjectPath, const wxString &aTitle, const wxString &aTagFileType=wxEmptyString) |
| Run all registered savers and, if any staged changes differ from HEAD, create a commit. | |
| bool | RunRegisteredSaversAsAutosaveFiles (const wxString &aProjectPath) |
| Run all registered savers and write their output to autosave files instead of committing to the local history repository. | |
| std::vector< std::pair< wxString, wxString > > | FindStaleAutosaveFiles (const wxString &aProjectPath, const std::vector< wxString > &aExtensions) const |
Enumerate autosave files newer than their corresponding source files for the project at aProjectPath, restricted to sources whose extension is in aExtensions. | |
| void | RemoveAutosaveFiles (const wxString &aProjectPath) const |
Remove every autosave file under the project at aProjectPath regardless of which source it shadowed. | |
| void | RemoveAutosaveFiles (const wxString &aProjectPath, const std::vector< wxString > &aSourcePaths) const |
Remove only the autosave files corresponding to aSourcePaths. | |
| void | NoteFileChange (const wxString &aFile) |
| Record that a file has been modified and should be included in the next snapshot. | |
| bool | CommitPending () |
| Commit any pending modified files to the history repository. | |
| bool | HistoryExists (const wxString &aProjectPath) |
| Return true if history exists for the project. | |
| bool | TagSave (const wxString &aProjectPath, const wxString &aFileType) |
| Tag a manual save in the local history repository. | |
| bool | CommitDuplicateOfLastSave (const wxString &aProjectPath, const wxString &aFileType, const wxString &aMessage) |
| Create a new commit duplicating the tree pointed to by Last_Save_<fileType> and move the Last_Save_<fileType> tag to the new commit (used when user discards changes). | |
| bool | EnforceSizeLimit (const wxString &aProjectPath, size_t aMaxBytes, PROGRESS_REPORTER *aReporter=nullptr) |
| Enforce total size limit by rebuilding trimmed history keeping newest commits whose cumulative unique blob sizes fit within limit. | |
| bool | HeadNewerThanLastSave (const wxString &aProjectPath) |
| Return true if the autosave data is newer than the last manual save. | |
| wxString | GetHeadHash (const wxString &aProjectPath) |
| Return the current head commit hash. | |
| bool | RestoreCommit (const wxString &aProjectPath, const wxString &aHash, wxWindow *aParent=nullptr, bool aConfirm=true) |
| Restore the project files to the state recorded by the given commit hash. | |
| std::vector< LOCAL_HISTORY_SNAPSHOT_INFO > | GetSnapshots (const wxString &aProjectPath) |
| Snapshots (commits) for the project, newest first. | |
| bool | ExtractAllFilesAtCommit (const wxString &aProjectPath, const wxString &aHash, const wxString &aDestDir, const std::vector< wxString > &aExtensions={}) |
| Write files recorded at aHash into aDestDir, recreating the project's relative folder structure. | |
| wxString | TreeFingerprint (const wxString &aProjectPath, const wxString &aHash, const wxString &aExtension) |
| Fingerprint of all files ending in aExtension recorded by commit aHash (sorted path:blob pairs). | |
| void | ShowRestoreDialog (const wxString &aProjectPath, wxWindow *aParent) |
| Show a dialog allowing the user to choose a snapshot to restore. | |
| void | WaitForPendingSave () |
| Block until any pending background save completes. | |
| bool | IsCompacting () const |
| True while a background compaction started by autosave is still running. | |
| void | EnforceSizeLimitInBackground (const wxString &aProjectPath, size_t aMaxBytes) |
| Run EnforceSizeLimit without a reporter on a background thread, after any running compaction. | |
Static Public Member Functions | |
| static std::vector< std::pair< wxString, wxString > > | CollectAutosaveFilePairs (const wxString &aAutosaveRoot, const wxString &aProjectPath, BACKUP_LOCATION aLocation) |
Enumerate every (autosave, source) pair found under aAutosaveRoot for the project at aProjectPath, honoring aLocation for name resolution. | |
Private Member Functions | |
| std::vector< LOCAL_HISTORY_SNAPSHOT_INFO > | LoadSnapshots (const wxString &aProjectPath) |
| bool | enforceSizeLimit (const wxString &aProjectPath, const wxString &aHistoryPath, size_t aMaxBytes, PROGRESS_REPORTER *aReporter) |
| EnforceSizeLimit with the history directory already resolved, so it can run off the UI thread. | |
| SNAPSHOT_COMMIT_RESULT | commitInBackground (const wxString &aProjectPath, const wxString &aTitle, const std::vector< HISTORY_FILE_DATA > &aFileData, bool aIsManualSave) |
| Execute file writes and git commit on a background thread. | |
| void | scheduleCompaction (const wxString &aProjectPath, size_t aLooseLimit) |
Start packing loose history objects on a background thread once they exceed aLooseLimit bytes, so the close-time size check rarely finds anything to do. | |
| void | pruneExpiredSavers () |
| Drop tracked savers whose owning document has been freed, before any saver runs. | |
Private Attributes | |
| std::set< wxString > | m_pendingFiles |
| std::map< const void *, SAVER_ENTRY > | m_savers |
| std::atomic< bool > | m_saveInProgress { false } |
| std::future< bool > | m_pendingFuture |
| std::atomic< bool > | m_cancelCompaction { false } |
| std::future< void > | m_compactFuture |
Simple local history manager built on libgit2.
Stores history for project files in a hidden .history git repository within the project directory.
Definition at line 78 of file local_history.h.
| LOCAL_HISTORY::LOCAL_HISTORY | ( | ) |
Definition at line 332 of file local_history.cpp.
| LOCAL_HISTORY::~LOCAL_HISTORY | ( | ) |
Definition at line 336 of file local_history.cpp.
References m_cancelCompaction, m_compactFuture, and WaitForPendingSave().
| void LOCAL_HISTORY::ClearAllSavers | ( | ) |
Clear all registered savers.
Definition at line 415 of file local_history.cpp.
References m_savers, traceAutoSave, and WaitForPendingSave().
Referenced by KIWAY::ProjectChanged().
|
static |
Enumerate every (autosave, source) pair found under aAutosaveRoot for the project at aProjectPath, honoring aLocation for name resolution.
The walk terminates on symlink cycles and refuses to follow links out of aAutosaveRoot, so a project directory that contains a root-escape symlink (e.g. a Wine prefix's dosdevices/z: -> /) cannot send it walking the whole filesystem. Exposed as a static entry point so the traversal can be exercised without the settings singleton.
Each entry has: first - autosave file path second - corresponding source path under the project directory
Definition at line 628 of file local_history.cpp.
References AUTOSAVE_PREFIX, DIR_LOOP_GUARD::IsRooted(), name, PROJECT_DIR, DIR_LOOP_GUARD::ShouldDescend(), and sourceForAutosaveFile().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and findAutosaveFilePairs().
| bool LOCAL_HISTORY::CommitDuplicateOfLastSave | ( | const wxString & | aProjectPath, |
| const wxString & | aFileType, | ||
| const wxString & | aMessage ) |
Create a new commit duplicating the tree pointed to by Last_Save_<fileType> and move the Last_Save_<fileType> tag to the new commit (used when user discards changes).
Definition at line 1517 of file local_history.cpp.
References HISTORY_LOCK_MANAGER::GetRepository(), HISTORY_LOCK_MANAGER::IsLocked(), isProjectDirectory(), localHistoryEnabled(), and traceAutoSave.
Referenced by PCB_EDIT_FRAME::canCloseWindow(), and SCH_EDIT_FRAME::canCloseWindow().
| bool LOCAL_HISTORY::CommitFullProjectSnapshot | ( | const wxString & | aProjectPath, |
| const wxString & | aTitle ) |
Commit a snapshot of the entire project directory (excluding the .history directory and ignored transient files) to the local history repository.
This does not modify any document dirty flags; it purely mirrors on-disk state for history purposes.
Definition at line 1379 of file local_history.cpp.
References collectProjectFiles(), commitSnapshotForProject(), Init(), isProjectDirectory(), and localHistoryEnabled().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), KICAD_MANAGER_FRAME::CloseProject(), and KICAD_MANAGER_FRAME::LoadProject().
|
private |
Execute file writes and git commit on a background thread.
Definition at line 796 of file local_history.cpp.
References Committed, PATHS::EnsurePathExists(), Error, HISTORY_LOCK_MANAGER::GetIndex(), HISTORY_LOCK_MANAGER::GetLockError(), HISTORY_LOCK_MANAGER::GetRepository(), historyPath(), index, HISTORY_LOCK_MANAGER::IsLocked(), NoChanges, path, KICAD_FORMAT::Prettify(), readFileContent(), removeLegacyWorkingCopies(), and traceAutoSave.
| bool LOCAL_HISTORY::CommitPending | ( | ) |
Commit any pending modified files to the history repository.
Definition at line 1040 of file local_history.cpp.
References CommitSnapshot(), and m_pendingFiles.
| bool LOCAL_HISTORY::CommitSnapshot | ( | const std::vector< wxString > & | aFiles, |
| const wxString & | aTitle ) |
Commit the given files to the local history repository.
Definition at line 1283 of file local_history.cpp.
References commitSnapshotForProject(), Init(), isProjectDirectory(), and localHistoryEnabled().
Referenced by BOOST_AUTO_TEST_CASE(), and CommitPending().
| bool LOCAL_HISTORY::EnforceSizeLimit | ( | const wxString & | aProjectPath, |
| size_t | aMaxBytes, | ||
| PROGRESS_REPORTER * | aReporter = nullptr ) |
Enforce total size limit by rebuilding trimmed history keeping newest commits whose cumulative unique blob sizes fit within limit.
Definition at line 1820 of file local_history.cpp.
References enforceSizeLimit(), and historyPath().
Referenced by BOOST_AUTO_TEST_CASE(), and KICAD_MANAGER_FRAME::CloseProject().
|
private |
EnforceSizeLimit with the history directory already resolved, so it can run off the UI thread.
Definition at line 1826 of file local_history.cpp.
References _, PROGRESS_REPORTER::AdvancePhase(), KIID::AsString(), compactRepository(), dirSizeRecursive(), HISTORY_LOCK_MANAGER::GetRepository(), HISTORY_LOCK_MANAGER::IsLocked(), PROGRESS_REPORTER::KeepRefreshing(), name, HISTORY_LOCK_MANAGER::ReleaseRepository(), removeLegacyWorkingCopies(), HISTORY_LOCK_MANAGER::ReopenRepository(), PROGRESS_REPORTER::Report(), PROGRESS_REPORTER::SetCurrentProgress(), traceAutoSave, and writePack().
Referenced by EnforceSizeLimit(), and EnforceSizeLimitInBackground().
| void LOCAL_HISTORY::EnforceSizeLimitInBackground | ( | const wxString & | aProjectPath, |
| size_t | aMaxBytes ) |
Run EnforceSizeLimit without a reporter on a background thread, after any running compaction.
Compaction only packs, so it never trims history down to the limit.
Definition at line 2452 of file local_history.cpp.
References enforceSizeLimit(), historyPath(), m_cancelCompaction, and m_compactFuture.
Referenced by KICAD_MANAGER_FRAME::CloseProject().
| bool LOCAL_HISTORY::ExtractAllFilesAtCommit | ( | const wxString & | aProjectPath, |
| const wxString & | aHash, | ||
| const wxString & | aDestDir, | ||
| const std::vector< wxString > & | aExtensions = {} ) |
Write files recorded at aHash into aDestDir, recreating the project's relative folder structure.
Used to reconstruct a multi-file document (e.g. a schematic hierarchy) at a commit. When aExtensions is non-empty only files ending in one of them are written, so a compare can skip large unrelated files (3D models, gerbers, the other editor's document).
Definition at line 3073 of file local_history.cpp.
References extensions, historyPath(), and name.
Referenced by BOARD_INSPECTION_TOOL::CompareBoardWithHistory(), and SCH_INSPECTION_TOOL::CompareSchematicWithHistory().
| std::vector< std::pair< wxString, wxString > > LOCAL_HISTORY::FindStaleAutosaveFiles | ( | const wxString & | aProjectPath, |
| const std::vector< wxString > & | aExtensions ) const |
Enumerate autosave files newer than their corresponding source files for the project at aProjectPath, restricted to sources whose extension is in aExtensions.
Used by editors at startup to detect crash-recovery candidates for files they own.
Each entry in the returned vector has: first - autosave file path second - corresponding source path under the project directory
Definition at line 700 of file local_history.cpp.
References filesContentEqual(), and findAutosaveFilePairs().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and EDA_BASE_FRAME::CheckForAutosaveFiles().
| wxString LOCAL_HISTORY::GetHeadHash | ( | const wxString & | aProjectPath | ) |
Return the current head commit hash.
Definition at line 2476 of file local_history.cpp.
References historyPath().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and KICAD_MANAGER_FRAME::LoadProject().
| std::vector< LOCAL_HISTORY_SNAPSHOT_INFO > LOCAL_HISTORY::GetSnapshots | ( | const wxString & | aProjectPath | ) |
Snapshots (commits) for the project, newest first.
Definition at line 3000 of file local_history.cpp.
References LoadSnapshots().
Referenced by BOARD_INSPECTION_TOOL::CompareBoardWithHistory(), and SCH_INSPECTION_TOOL::CompareSchematicWithHistory().
| bool LOCAL_HISTORY::HeadNewerThanLastSave | ( | const wxString & | aProjectPath | ) |
Return true if the autosave data is newer than the last manual save.
Definition at line 1462 of file local_history.cpp.
References historyPath().
| bool LOCAL_HISTORY::HistoryExists | ( | const wxString & | aProjectPath | ) |
Return true if history exists for the project.
Definition at line 1394 of file local_history.cpp.
References historyPath().
Referenced by KICAD_MANAGER_FRAME::doReCreateMenuBar(), and ShowRestoreDialog().
| bool LOCAL_HISTORY::Init | ( | const wxString & | aProjectPath | ) |
Initialize the local history repository for the given project path.
Definition at line 1048 of file local_history.cpp.
References PATHS::EnsurePathExists(), historyPath(), isProjectDirectory(), and localHistoryEnabled().
Referenced by BOOST_AUTO_TEST_CASE(), CommitFullProjectSnapshot(), CommitSnapshot(), EDA_BASE_FRAME::CommonSettingsChanged(), and RunRegisteredSaversAndCommit().
| bool LOCAL_HISTORY::IsCompacting | ( | ) | const |
True while a background compaction started by autosave is still running.
Definition at line 2469 of file local_history.cpp.
References m_compactFuture.
Referenced by scheduleCompaction().
|
private |
Definition at line 2929 of file local_history.cpp.
References historyPath(), and info.
Referenced by GetSnapshots(), and ShowRestoreDialog().
| void LOCAL_HISTORY::NoteFileChange | ( | const wxString & | aFile | ) |
Record that a file has been modified and should be included in the next snapshot.
Definition at line 348 of file local_history.cpp.
References localHistoryEnabled(), and m_pendingFiles.
Referenced by PCB_EDIT_FRAME::OnModify(), and SCH_EDIT_FRAME::OnModify().
|
private |
Drop tracked savers whose owning document has been freed, before any saver runs.
Definition at line 383 of file local_history.cpp.
References m_savers.
Referenced by RunRegisteredSaversAndCommit(), and RunRegisteredSaversAsAutosaveFiles().
| void LOCAL_HISTORY::RegisterSaver | ( | const void * | aSaverObject, |
| const std::function< void(const wxString &, std::vector< HISTORY_FILE_DATA > &)> & | aSaver, | ||
| const std::weak_ptr< void > & | aLifetime = {} ) |
Register a saver callback invoked during autosave history commits.
The callback receives the project path and should populate aFileData with serialized content or source paths for inclusion.
| aSaverObject | Unique object pointer identifier for this saver (to prevent duplicate registration) |
| aSaver | The saver callback function |
| aLifetime | Optional liveness token owned by the serialized document. When supplied, an expired token makes the saver-runner skip and drop the saver instead of invoking a callback that would dereference a freed document. The autosave timer is shared across editor frames, so a saver can outlive the document it captures unless its lifetime is tracked here. |
Definition at line 359 of file local_history.cpp.
References LOCAL_HISTORY::SAVER_ENTRY::lifetime, m_savers, LOCAL_HISTORY::SAVER_ENTRY::saver, traceAutoSave, and LOCAL_HISTORY::SAVER_ENTRY::tracked.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), KICAD_MANAGER_FRAME::ProjectChanged(), PCB_EDIT_FRAME::ProjectChanged(), and SCH_EDIT_FRAME::ProjectChanged().
| void LOCAL_HISTORY::RemoveAutosaveFiles | ( | const wxString & | aProjectPath | ) | const |
Remove every autosave file under the project at aProjectPath regardless of which source it shadowed.
Used by the project manager to sweep autosaves on project close so nothing is left to prompt on next launch. Manual-save callers should prefer the source-scoped overload below to avoid wiping autosaves for files this save did not actually persist.
Definition at line 745 of file local_history.cpp.
References findAutosaveFilePairs().
Referenced by PCB_EDIT_FRAME::doCloseWindow(), SCH_EDIT_FRAME::doCloseWindow(), PCB_EDIT_FRAME::SavePcbFile(), and SCH_EDIT_FRAME::SaveProject().
| void LOCAL_HISTORY::RemoveAutosaveFiles | ( | const wxString & | aProjectPath, |
| const std::vector< wxString > & | aSourcePaths ) const |
Remove only the autosave files corresponding to aSourcePaths.
Called after a successful manual save so we drop autosaves the save just superseded without touching unsaved siblings (e.g. a PCB save must not erase a dirty schematic sheet's autosave when both editors are open).
Definition at line 758 of file local_history.cpp.
References findAutosaveFilePairs().
| bool LOCAL_HISTORY::RestoreCommit | ( | const wxString & | aProjectPath, |
| const wxString & | aHash, | ||
| wxWindow * | aParent = nullptr, | ||
| bool | aConfirm = true ) |
Restore the project files to the state recorded by the given commit hash.
When aConfirm is true a yes/no prompt is shown before any file is overwritten, callers that have already asked the user (the startup recovery prompt) pass false to avoid a double prompt.
Definition at line 2716 of file local_history.cpp.
References _, collectProjectFiles(), commitSnapshotWithLock(), Error, HISTORY_LOCK_MANAGER::GetIndex(), HISTORY_LOCK_MANAGER::GetRepository(), historyPath(), HISTORY_LOCK_MANAGER::IsLocked(), KICAD_MESSAGE_DIALOG, NoChanges, tagSaveAtHead(), and traceAutoSave.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), KICAD_MANAGER_FRAME::LoadProject(), and ShowRestoreDialog().
| bool LOCAL_HISTORY::RunRegisteredSaversAndCommit | ( | const wxString & | aProjectPath, |
| const wxString & | aTitle, | ||
| const wxString & | aTagFileType = wxEmptyString ) |
Run all registered savers and, if any staged changes differ from HEAD, create a commit.
When aTagFileType is non-empty the new commit is tagged Save_<type>_N (manual save); empty leaves the commit untagged (autosave).
Definition at line 423 of file local_history.cpp.
References Init(), isProjectDirectory(), localHistoryEnabled(), m_saveInProgress, m_savers, pruneExpiredSavers(), traceAutoSave, and WaitForPendingSave().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), EDA_BASE_FRAME::doAutoSave(), PCB_EDIT_FRAME::SavePcbFile(), and SCH_EDIT_FRAME::SaveProject().
| bool LOCAL_HISTORY::RunRegisteredSaversAsAutosaveFiles | ( | const wxString & | aProjectPath | ) |
Run all registered savers and write their output to autosave files instead of committing to the local history repository.
Used when BACKUP_FORMAT::ZIP is selected so the user still has crash recovery without a git store.
Output location follows BACKUP_LOCATION: PROJECT_DIR -> "<projectpath>/<reldir>/_autosave-<basename>" USER_DIR -> "<user_root>/<reldir>/<basename>" (mirroring the project tree)
Files are written via KIPLATFORM::IO::AtomicWriteFile so a crash mid-write cannot leave a half-written autosave on disk.
Definition at line 527 of file local_history.cpp.
References KIPLATFORM::IO::AtomicWriteFile(), PATHS::EnsurePathExists(), SETTINGS_MANAGER::GetAutosaveRootForProject(), SETTINGS_MANAGER::GetCommonSettings(), SETTINGS_MANAGER::GetProjectForPath(), PGM_BASE::GetSettingsManager(), COMMON_SETTINGS::AUTO_BACKUP::location, location, COMMON_SETTINGS::m_Backup, m_savers, Pgm(), KICAD_FORMAT::Prettify(), pruneExpiredSavers(), resolveAutosaveDestination(), and traceAutoSave.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and EDA_BASE_FRAME::doAutoSave().
|
private |
Start packing loose history objects on a background thread once they exceed aLooseLimit bytes, so the close-time size check rarely finds anything to do.
Definition at line 2367 of file local_history.cpp.
References buildPack(), HISTORY_LOCK_MANAGER::GetRepository(), historyPath(), IsCompacting(), HISTORY_LOCK_MANAGER::IsLocked(), listPackFiles(), looseObjectBytes(), m_cancelCompaction, m_compactFuture, pruneLooseObjects(), refTargets(), HISTORY_LOCK_MANAGER::ReleaseRepository(), removeStaleStageDirs(), STAGE_DIR_PREFIX, supersededBy(), and traceAutoSave.
| void LOCAL_HISTORY::ShowRestoreDialog | ( | const wxString & | aProjectPath, |
| wxWindow * | aParent ) |
Show a dialog allowing the user to choose a snapshot to restore.
Definition at line 2908 of file local_history.cpp.
References DIALOG_RESTORE_LOCAL_HISTORY::GetSelectedHash(), HistoryExists(), LoadSnapshots(), RestoreCommit(), and DIALOG_SHIM::ShowModal().
Referenced by KICAD_MANAGER_FRAME::RestoreLocalHistory().
| bool LOCAL_HISTORY::TagSave | ( | const wxString & | aProjectPath, |
| const wxString & | aFileType ) |
Tag a manual save in the local history repository.
Definition at line 1443 of file local_history.cpp.
References HISTORY_LOCK_MANAGER::GetRepository(), HISTORY_LOCK_MANAGER::IsLocked(), isProjectDirectory(), localHistoryEnabled(), tagSaveAtHead(), and traceAutoSave.
Referenced by BOOST_AUTO_TEST_CASE(), KICAD_MANAGER_FRAME::CloseProject(), and KICAD_MANAGER_FRAME::LoadProject().
| wxString LOCAL_HISTORY::TreeFingerprint | ( | const wxString & | aProjectPath, |
| const wxString & | aHash, | ||
| const wxString & | aExtension ) |
Fingerprint of all files ending in aExtension recorded by commit aHash (sorted path:blob pairs).
Empty when the commit has no such file. Two commits with equal fingerprints hold identical content for that type, so callers can collapse consecutive duplicates into one revision.
Definition at line 3006 of file local_history.cpp.
References historyPath(), name, and path.
Referenced by BOARD_INSPECTION_TOOL::CompareBoardWithHistory(), and SCH_INSPECTION_TOOL::CompareSchematicWithHistory().
| void LOCAL_HISTORY::UnregisterSaver | ( | const void * | aSaverObject | ) |
Unregister a previously registered saver callback.
| aSaverObject | The object pointer that was used to register the saver |
Definition at line 400 of file local_history.cpp.
References m_savers, traceAutoSave, and WaitForPendingSave().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), KICAD_MANAGER_FRAME::CloseProject(), PCB_EDIT_FRAME::doCloseWindow(), SCH_EDIT_FRAME::doCloseWindow(), PCB_EDIT_FRAME::SetBoard(), SCH_EDIT_FRAME::SetSchematic(), PCB_EDIT_FRAME::~PCB_EDIT_FRAME(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().
| void LOCAL_HISTORY::WaitForPendingSave | ( | ) |
Block until any pending background save completes.
Call before reading repo state (HeadNewerThanLastSave / GetHeadHash) at close time so an in-flight autosave can't leave the close path with a stale view of HEAD.
Definition at line 1030 of file local_history.cpp.
References m_pendingFuture, and traceAutoSave.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ClearAllSavers(), KICAD_MANAGER_FRAME::CloseProject(), RunRegisteredSaversAndCommit(), UnregisterSaver(), and ~LOCAL_HISTORY().
|
private |
Definition at line 286 of file local_history.h.
Referenced by EnforceSizeLimitInBackground(), scheduleCompaction(), and ~LOCAL_HISTORY().
|
private |
Definition at line 287 of file local_history.h.
Referenced by EnforceSizeLimitInBackground(), IsCompacting(), scheduleCompaction(), and ~LOCAL_HISTORY().
|
private |
Definition at line 280 of file local_history.h.
Referenced by CommitPending(), and NoteFileChange().
|
private |
Definition at line 284 of file local_history.h.
Referenced by WaitForPendingSave().
|
private |
Definition at line 283 of file local_history.h.
Referenced by RunRegisteredSaversAndCommit().
|
private |
Definition at line 281 of file local_history.h.
Referenced by ClearAllSavers(), pruneExpiredSavers(), RegisterSaver(), RunRegisteredSaversAndCommit(), RunRegisteredSaversAsAutosaveFiles(), and UnregisterSaver().