|
KiCad PCB EDA Suite
|
#include <local_history.h>#include <dialogs/dialog_restore_local_history.h>#include <history_lock.h>#include <paths.h>#include <io/kicad/kicad_io_utils.h>#include <lockfile.h>#include <settings/common_settings.h>#include <settings/settings_manager.h>#include <pgm_base.h>#include <thread_pool.h>#include <trace_helpers.h>#include <wildcards_and_files_ext.h>#include <confirm.h>#include <progress_reporter.h>#include <kiid.h>#include <kiplatform/io.h>#include <git2.h>#include <git2/sys/odb_backend.h>#include <gestfich.h>#include <wx/filename.h>#include <wx/filefn.h>#include <wx/ffile.h>#include <wx/dir.h>#include <wx/datetime.h>#include <wx/log.h>#include <wx/msgdlg.h>#include <wx/utils.h>#include <vector>#include <string>#include <memory>#include <algorithm>#include <set>#include <map>#include <functional>#include <chrono>#include <cstring>Go to the source code of this file.
Functions | |
| static wxString | historyPath (const wxString &aProjectPath) |
| static wxString | joinHistoryDestination (const wxString &aHistoryRoot, const wxString &aRelativePath) |
| static bool | readFileContent (const wxString &aPath, std::string &aContent) |
| static void | removeLegacyWorkingCopies (git_repository *aRepo, const wxString &aHistoryRoot) |
| static bool | filesContentEqual (const wxString &aPathA, const wxString &aPathB) |
| static wxString | resolveAutosaveDestination (const wxString &aAutosaveRoot, const wxString &aRelativePath, BACKUP_LOCATION aLocation) |
| static wxString | sourceForAutosaveFile (const wxString &aAutosavePath, const wxString &aProjectPath, const wxString &aAutosaveRoot, BACKUP_LOCATION aLocation) |
| static bool | commitSnapshotForProject (const wxString &aProjectPath, const std::vector< wxString > &aFiles, const wxString &aTitle) |
| static bool | localHistoryEnabled () |
| static bool | isProjectDirectory (const wxString &aProjectPath) |
| static bool | isRestoreProtectedEntry (const wxString &aName) |
| static std::vector< std::pair< wxString, wxString > > | findAutosaveFilePairs (const wxString &aProjectPath) |
| static SNAPSHOT_COMMIT_RESULT | commitSnapshotWithLock (git_repository *repo, git_index *index, const wxString &aHistoryPath, const wxString &aProjectPath, const std::vector< wxString > &aFiles, const wxString &aTitle) |
| static bool | isKiCadProjectFile (const wxFileName &aFile) |
| static void | collectProjectFiles (const wxString &aProjectPath, std::vector< wxString > &aFiles) |
| static bool | tagSaveAtHead (git_repository *repo, const wxString &aFileType) |
| static size_t | dirSizeRecursive (const wxString &path) |
| static std::vector< wxString > | listPackFiles (const wxString &aPackDir) |
| static bool | writePack (git_packbuilder *aPb, const wxString &aPackDir, PROGRESS_REPORTER *aReporter, const std::atomic< bool > *aCancel=nullptr) |
| static void | pruneLooseObjects (const wxString &aObjectsPath, const wxString &aPackIndex, time_t aWalkStart) |
| static wxString | buildPack (git_repository *aRepo, const wxString &aPackDir, PROGRESS_REPORTER *aReporter, const std::atomic< bool > *aCancel) |
| static std::vector< wxString > | supersededBy (const std::vector< wxString > &aPriorPacks, const wxString &aNewStem) |
| static bool | compactRepository (git_repository *aRepo, PROGRESS_REPORTER *aReporter, std::vector< wxString > *aSupersededPacks) |
| static void | removeStaleStageDirs (const wxString &aGitDir) |
| static std::vector< std::string > | refTargets (git_repository *aRepo) |
| static size_t | looseObjectBytes (const wxString &aObjectsPath) |
Variables | |
| static const wxString | AUTOSAVE_PREFIX = wxS( "_autosave-" ) |
| static const size_t | UNLIMITED_HISTORY_LOOSE_BYTES = 25 * 1024 * 1024 |
| static const time_t | UNREACHABLE_LOOSE_EXPIRY_SECONDS = 24 * 60 * 60 |
| static const wxString | STAGE_DIR_PREFIX = wxS( "kicad-compact-" ) |
|
static |
Definition at line 1747 of file local_history.cpp.
References writePack().
Referenced by compactRepository(), and LOCAL_HISTORY::scheduleCompaction().
|
static |
Definition at line 1316 of file local_history.cpp.
References isKiCadProjectFile(), isProjectDirectory(), isRestoreProtectedEntry(), DIR_LOOP_GUARD::IsRooted(), name, path, DIR_LOOP_GUARD::ShouldDescend(), and traceAutoSave.
Referenced by LOCAL_HISTORY::CommitFullProjectSnapshot(), and LOCAL_HISTORY::RestoreCommit().
|
static |
Definition at line 1264 of file local_history.cpp.
References commitSnapshotWithLock(), Committed, HISTORY_LOCK_MANAGER::GetIndex(), HISTORY_LOCK_MANAGER::GetLockError(), HISTORY_LOCK_MANAGER::GetRepository(), historyPath(), HISTORY_LOCK_MANAGER::IsLocked(), and traceAutoSave.
Referenced by LOCAL_HISTORY::CommitFullProjectSnapshot(), and LOCAL_HISTORY::CommitSnapshot().
|
static |
Definition at line 1122 of file local_history.cpp.
References Committed, delta, Error, index, NoChanges, and traceAutoSave.
Referenced by commitSnapshotForProject(), and LOCAL_HISTORY::RestoreCommit().
|
static |
Definition at line 1800 of file local_history.cpp.
References buildPack(), listPackFiles(), pruneLooseObjects(), and supersededBy().
Referenced by LOCAL_HISTORY::enforceSizeLimit().
|
static |
Definition at line 1595 of file local_history.cpp.
References dirSizeRecursive(), name, and path.
Referenced by dirSizeRecursive(), LOCAL_HISTORY::enforceSizeLimit(), and looseObjectBytes().
|
static |
Definition at line 193 of file local_history.cpp.
Referenced by LOCAL_HISTORY::FindStaleAutosaveFiles().
|
static |
Definition at line 689 of file local_history.cpp.
References LOCAL_HISTORY::CollectAutosaveFilePairs(), SETTINGS_MANAGER::GetAutosaveRootForProject(), SETTINGS_MANAGER::GetCommonSettings(), SETTINGS_MANAGER::GetProjectForPath(), PGM_BASE::GetSettingsManager(), COMMON_SETTINGS::AUTO_BACKUP::location, location, COMMON_SETTINGS::m_Backup, and Pgm().
Referenced by LOCAL_HISTORY::FindStaleAutosaveFiles(), LOCAL_HISTORY::RemoveAutosaveFiles(), and LOCAL_HISTORY::RemoveAutosaveFiles().
|
static |
Definition at line 61 of file local_history.cpp.
References SETTINGS_MANAGER::GetLocalHistoryDirForPath(), PGM_BASE::GetSettingsManager(), and Pgm().
Referenced by commitSnapshotForProject().
|
static |
Definition at line 1302 of file local_history.cpp.
References name.
Referenced by collectProjectFiles().
|
static |
Definition at line 306 of file local_history.cpp.
References name, and FILEEXT::ProjectFileExtension.
Referenced by collectProjectFiles(), LOCAL_HISTORY::CommitDuplicateOfLastSave(), LOCAL_HISTORY::CommitFullProjectSnapshot(), LOCAL_HISTORY::CommitSnapshot(), LOCAL_HISTORY::Init(), LOCAL_HISTORY::RunRegisteredSaversAndCommit(), and LOCAL_HISTORY::TagSave().
|
static |
Definition at line 323 of file local_history.cpp.
References PROJECT_BACKUPS_DIR_SUFFIX.
Referenced by collectProjectFiles().
|
static |
Definition at line 70 of file local_history.cpp.
Referenced by removeLegacyWorkingCopies().
|
static |
Definition at line 1617 of file local_history.cpp.
References name.
Referenced by compactRepository(), and LOCAL_HISTORY::scheduleCompaction().
|
static |
Definition at line 296 of file local_history.cpp.
References COMMON_SETTINGS::AutosaveUsesLocalHistory(), PGM_BASE::GetCommonSettings(), and Pgm().
Referenced by LOCAL_HISTORY::CommitDuplicateOfLastSave(), LOCAL_HISTORY::CommitFullProjectSnapshot(), LOCAL_HISTORY::CommitSnapshot(), LOCAL_HISTORY::Init(), LOCAL_HISTORY::NoteFileChange(), LOCAL_HISTORY::RunRegisteredSaversAndCommit(), and LOCAL_HISTORY::TagSave().
|
static |
Definition at line 2348 of file local_history.cpp.
References dirSizeRecursive().
Referenced by LOCAL_HISTORY::scheduleCompaction().
|
static |
Definition at line 1686 of file local_history.cpp.
References UNREACHABLE_LOOSE_EXPIRY_SECONDS.
Referenced by compactRepository(), and LOCAL_HISTORY::scheduleCompaction().
|
static |
Definition at line 100 of file local_history.cpp.
Referenced by LOCAL_HISTORY::commitInBackground().
|
static |
Definition at line 2315 of file local_history.cpp.
Referenced by LOCAL_HISTORY::scheduleCompaction().
|
static |
Definition at line 121 of file local_history.cpp.
References joinHistoryDestination(), name, and path.
Referenced by LOCAL_HISTORY::commitInBackground(), and LOCAL_HISTORY::enforceSizeLimit().
|
static |
Definition at line 2292 of file local_history.cpp.
References name, STAGE_DIR_PREFIX, and UNREACHABLE_LOOSE_EXPIRY_SECONDS.
Referenced by LOCAL_HISTORY::scheduleCompaction().
|
static |
Definition at line 235 of file local_history.cpp.
References AUTOSAVE_PREFIX, and PROJECT_DIR.
Referenced by LOCAL_HISTORY::RunRegisteredSaversAsAutosaveFiles().
|
static |
Definition at line 258 of file local_history.cpp.
References AUTOSAVE_PREFIX, name, and PROJECT_DIR.
Referenced by LOCAL_HISTORY::CollectAutosaveFilePairs().
|
static |
Definition at line 1784 of file local_history.cpp.
Referenced by compactRepository(), and LOCAL_HISTORY::scheduleCompaction().
|
static |
Definition at line 1402 of file local_history.cpp.
Referenced by LOCAL_HISTORY::RestoreCommit(), and LOCAL_HISTORY::TagSave().
|
static |
Definition at line 1641 of file local_history.cpp.
References cancel, and reporter.
Referenced by buildPack(), and LOCAL_HISTORY::enforceSizeLimit().
|
static |
Definition at line 94 of file local_history.cpp.
Referenced by LOCAL_HISTORY::CollectAutosaveFilePairs(), resolveAutosaveDestination(), and sourceForAutosaveFile().
|
static |
Definition at line 2288 of file local_history.cpp.
Referenced by removeStaleStageDirs(), and LOCAL_HISTORY::scheduleCompaction().
|
static |
Definition at line 97 of file local_history.cpp.
|
static |
Definition at line 1681 of file local_history.cpp.
Referenced by pruneLooseObjects(), and removeStaleStageDirs().