20#ifndef GIT_STATUS_ENTRIES_H
21#define GIT_STATUS_ENTRIES_H
134 wxString
RefusalMessage(
const std::vector<wxString>& aUnsavedEditors,
bool aAllowTrackedChanges =
false )
const;
144 bool aAllowTrackedChanges =
false );
179 std::function<
void()> aFinished = {} );
202 const wxString& aRelativePath = wxEmptyString );
Represent a set of changes (additions, deletions or modifications) of a data model (e....
The base frame for deriving all KiCad main window classes.
A private scratch directory for extracting committed file versions to diff, removed when this object ...
bool IsOk() const
True when the scratch directory was created.
const wxString & Root() const
The scratch directory, for callers that lay out their own files (e.g. footprint libraries).
wxString Materialize(git_repository *aRepo, const wxString &aRef, const wxString &aRelPath, KICAD_DIFF::DOC_KIND aKind)
Extract aRelPath at aRef into a uniquely named slot and return the path to load, or an empty string w...
GIT_DIFF_WORKSPACE & operator=(const GIT_DIFF_WORKSPACE &)=delete
GIT_DIFF_WORKSPACE(const GIT_DIFF_WORKSPACE &)=delete
The project's git session.
Read repository state without blocking the UI.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
A temporary file or directory that is removed when the object goes out of scope.
std::vector< wxString > ChangedTrackedFilesOutsideProject(KIGIT_COMMON &aCommon, const wxString &aProjectPath)
Repository relative paths of tracked files changed outside the project directory, which the checklist...
EDITOR_SNAPSHOT CaptureOpenEditorDocs(KIWAY &aKiway)
Record the on-disk identity of the open documents, before an operation that may rewrite them.
bool MaterializeWorkingFile(KIGIT_COMMON &aCommon, GIT_DIFF_WORKSPACE &aWorkspace, const wxString &aRelativePath, GIT_FILE_SIDES &aSides)
Write the committed version of a file into aWorkspace and name its working copy beside it.
bool MaterializeCommitFile(KIGIT_COMMON &aCommon, GIT_DIFF_WORKSPACE &aWorkspace, const wxString &aCommitHash, const wxString &aRelativePath, GIT_FILE_SIDES &aSides)
Write both sides of one file a commit changed into aWorkspace, the parent's version and the commit's.
bool ProjectSafeToRewrite(EDA_BASE_FRAME *aFrame, wxWindow *aParent, const GIT_WORKTREE_STATUS &aStatus, bool aAllowTrackedChanges=false)
Combine the repository snapshot with live editor state and explain any refusal.
std::vector< FILE_CHECKLIST_ENTRY > BuildGitChangeEntries(KIGIT_COMMON &aCommon, const wxString &aProjectPath, bool aDarkTheme)
Build the file checklist entries for the project's changed files, transient files filtered out and ea...
GIT_EDITOR_PREP
What the caller is about to do, which decides the wording and whether the project file is written.
@ WORKING_TREE
The working files are about to be rewritten, by a pull, branch switch or stash.
void ReloadOpenEditors(KIWAY &aKiway, const EDITOR_SNAPSHOT &aBefore)
Tell the open board and schematic editors to reload from disk.
std::vector< wxString > LibraryEditorsWithUnsavedChanges(KIWAY &aKiway)
Names of the library editors holding unsaved changes.
void ProjectClearOfUncommittedWork(EDA_BASE_FRAME *aFrame, wxWindow *aParent, KIGIT_QUERY &aQuery, std::function< void(const GIT_WORKTREE_STATUS &)> aReady)
Check the working tree and Git LFS on a worker, then run aReady on the UI thread when the operation c...
GIT_WORKTREE_STATUS ReadGitWorktreeStatus(KIGIT_COMMON &aCommon, const wxString &aProjectPath)
Read tracked changes and Git LFS using a captured project path.
bool DocumentEditorsDirty(KIWAY &aKiway)
Unsaved schematic or board edits can be saved for a commit, even with no changes on disk.
void ShowGitFileDiff(EDA_BASE_FRAME *aFrame, const wxString &aRelativePath)
Open the diff for a changed file, comparing the committed version at HEAD with the working copy.
void SwitchProjectToBranch(EDA_BASE_FRAME *aFrame, wxWindow *aParent, const wxString &aBranch, KIGIT_QUERY &aQuery, std::function< void()> aFinished={})
Check the working tree on a worker, then confirm switching to aBranch and recheck unsaved editors.
bool PrepareEditorsForGitOperation(EDA_BASE_FRAME *aFrame, GIT_EDITOR_PREP aPurpose, bool *aSavedEditors=nullptr)
Offer to save unsaved schematic and board edits before a git operation.
void ShowGitCommitDiff(EDA_BASE_FRAME *aFrame, const wxString &aCommitHash, wxWindow *aParentWindow=nullptr, const wxString &aRelativePath=wxEmptyString)
Open the diff for what a commit changed, comparing it against its parent.
bool EditorsDirty(KIWAY &aKiway)
Unsaved document or library edits block operations that rewrite files. Call on the UI thread.
DOC_KIND
Document type a diff/merge entry point should route to, derived from a file path's extension.
What the open editors and the project settings looked like on disk before an operation that may rewri...
The two sides of one file, written out for a comparison.
KICAD_DIFF::DOC_KIND kind
wxString before
Empty when the file did not exist on that side.
wxString error
Why the sides could not be written, when they could not.
Repository state used before an operation that requires a clean working tree.
std::vector< wxString > outsideProject
wxString RefusalMessage(const std::vector< wxString > &aUnsavedEditors, bool aAllowTrackedChanges=false) const
Empty when rewriting is allowed.