20#ifndef GIT_COMMIT_PANE_H
21#define GIT_COMMIT_PANE_H
73 void SetTransferBusy(
bool aBusy,
const wxString& aStatus = wxEmptyString );
90 void BeginAmend(
const wxString& aExpectedCommit = wxEmptyString );
100 void onCommit( wxCommandEvent& aEvent );
102 void onPull( wxCommandEvent& aEvent );
106 void finishAbandonOperation( std::shared_ptr<KIGIT_COMMON> aCommon,
const std::vector<wxString>& aOutside );
113 void discardFile( std::shared_ptr<KIGIT_COMMON> aCommon,
const wxString& aPath );
114 void confirmDiscardFile( std::shared_ptr<KIGIT_COMMON> aCommon,
const wxString& aPath,
bool aTracked,
115 bool aConflicted, wxString aRoot );
121 struct COMMIT_REQUEST;
122 void saveForCommit( std::shared_ptr<KIGIT_COMMON> aCommon, std::shared_ptr<COMMIT_REQUEST> aRequest );
123 void finishCommit( std::shared_ptr<KIGIT_COMMON> aCommon,
const COMMIT_REQUEST& aRequest );
126 void onIdle( wxIdleEvent& aEvent );
127 void onSize( wxSizeEvent& aEvent );
167 void setBusy(
bool aBusy,
const wxString& aStatus );
171 std::function<
void()> aDone,
const wxString& aStatus );
175 void submitPush( std::shared_ptr<KIGIT_COMMON> aCommon );
176 void startPush( std::shared_ptr<KIGIT_COMMON> aCommon,
const wxString& aBranch,
const wxString& aHead );
177 void onPushDone( std::shared_ptr<KIGIT_COMMON> aCommon,
int aResult,
const wxString& aError,
bool aAuthFailure,
181 void submitPull( std::shared_ptr<KIGIT_COMMON> aCommon,
bool aThenPush );
182 void startPull( std::shared_ptr<KIGIT_COMMON> aCommon,
bool aThenPush );
187 struct MERGE_PREPARATION;
189 std::shared_ptr<MERGE_PREPARATION> aPreparation );
190 void onPullDone( std::shared_ptr<KIGIT_COMMON> aCommon,
int aResult,
const wxString& aError,
bool aAuthFailure,
191 bool aThenPush,
bool aCancelled );
The base frame for deriving all KiCad main window classes.
The advanced Git window: a non-modal dialog with a top bar naming the repository and branch and a sid...
GIT_COMMIT_PANE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 360), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
wxString abandonLabel() const
The label the network button carries while an operation is in progress.
void submitPull(std::shared_ptr< KIGIT_COMMON > aCommon, bool aThenPush)
aThenPush pushes after a successful pull, which belongs only to the rejected-push recovery flow.
void updateCommitButton()
Set what the commit buttons say, and whether they are enabled, for the current state.
void onPull(wxCommandEvent &aEvent)
void onMessageChanged(wxCommandEvent &aEvent)
void resolvePullConflicts(std::shared_ptr< KIGIT_COMMON > aCommon, bool aThenPush)
Resolve a conflicted pull file by file, using the visual merge tool for design files,...
void SetBusyChangedHandler(std::function< void(bool)> aHandler)
Called when a transfer starts and when it ends, so an owning window can follow along.
void ShowTransferProgress(const wxString &aText)
Show a line of transfer progress. Called from the UI thread by a KIGIT_STATUS_REPORTER.
void SetTransferBusy(bool aBusy, const wxString &aStatus=wxEmptyString)
Put the panel into the state it uses while a transfer runs, for one started elsewhere.
void Pull()
Get changes from the remote, as the Get Changes button does.
wxString GetCommitMessage() const
The message as typed. A second form on the same project shows the same text.
void onNewBranchToggled(wxCommandEvent &aEvent)
void abandonOperation(std::shared_ptr< KIGIT_COMMON > aCommon)
Drop an in-progress merge or rebase and return the project to its last commit.
void BeginAmend(const wxString &aExpectedCommit=wxEmptyString)
Prepare the amend form. A history entry supplies its hash and starts with no files selected.
void finishCommit(std::shared_ptr< KIGIT_COMMON > aCommon, const COMMIT_REQUEST &aRequest)
bool m_inAdvancedWindow
True on the advanced window's Changes page, false in the docked panel.
std::function< void(const wxString &)> m_fileSelectedHandler
void setDescription(const wxString &aText)
bool m_hasUnpushedCommits
void startPush(std::shared_ptr< KIGIT_COMMON > aCommon, const wxString &aBranch, const wxString &aHead)
void discardFile(std::shared_ptr< KIGIT_COMMON > aCommon, const wxString &aPath)
KIGIT_QUERY m_refresh
Coalesce refreshes while a repository read is running, and discard stale results.
std::pair< int, int > m_lineStats
Lines the working tree adds and removes against HEAD, read at the last refresh.
void onSettings(wxCommandEvent &aEvent)
The gear's menu: the advanced window and the author.
bool transferCanStart()
False, with a message, while a transfer is running or a merge waits to be finished.
void updateMessageVisibility(bool aHasChanges)
Show the message field whenever a commit is possible, including a message-only amend.
void RefreshFileList()
Read the project's git status and repopulate the list.
bool m_editorsDirty
True when an open editor held unsaved changes at the last refresh.
void finishPullConflictPreparation(std::shared_ptr< KIGIT_COMMON > aCommon, bool aThenPush, std::shared_ptr< MERGE_PREPARATION > aPreparation)
void setBusy(bool aBusy, const wxString &aStatus)
Enable or disable the controls while a network operation runs, showing a status.
void ReloadAdvancedWindow()
Reload the advanced window when it is open, for a preferences change it also shows.
bool m_canAmend
Whether the current branch allows an amend. A refresh must not change an active amend into a commit.
wxString operationNoun() const
The noun for the operation in progress, for messages.
void onChecklistChanged(wxDataViewEvent &aEvent)
void populateBranches(const STATUS &aStatus)
Fill the branch dropdown from the completed snapshot.
void onFileActivated(wxDataViewEvent &aEvent)
bool m_upstreamAhead
True when the upstream has commits this project does not, so Get Changes has work to do.
void onPullDone(std::shared_ptr< KIGIT_COMMON > aCommon, int aResult, const wxString &aError, bool aAuthFailure, bool aThenPush, bool aCancelled)
bool m_commitButtonPushes
True while the main button reads Push, with nothing left to commit.
wxStaticText * m_summaryRemoved
void updateSummary()
Refresh the staged count in the changes heading, and the summary box where the wide layout has one.
void saveForCommit(std::shared_ptr< KIGIT_COMMON > aCommon, std::shared_ptr< COMMIT_REQUEST > aRequest)
void onCommit(wxCommandEvent &aEvent)
The split button's main half. It commits, or pushes when that is all there is to do.
void showDisabledState()
Clear the list and disable every control while version control is off.
void submitPush(std::shared_ptr< KIGIT_COMMON > aCommon)
void updateDescriptionHint()
Where the platform has no hint for a multi line box, a label lies over the description box while it i...
void onPushDone(std::shared_ptr< KIGIT_COMMON > aCommon, int aResult, const wxString &aError, bool aAuthFailure, bool aCancelled)
std::function< void(bool)> m_busyChangedHandler
Told when a transfer starts and ends. Empty unless an owning window asked.
void layoutWide()
Put the file list beside the commit controls instead of above them, for a wide host,...
KIGIT_TRANSFER m_transfer
The push or pull this panel submitted last.
std::pair< wxString, wxString > m_amendHead
The branch and commit chosen when amend started. Keep them fixed while editing.
void onChecklistContextMenu(wxDataViewEvent &aEvent)
void setStatusText(const wxString &aText)
Set the status line text and wrap it to the current panel width.
std::function< void()> m_messageChangedHandler
Told when the message is edited. Empty unless an owning window asked.
bool m_headDetached
True when HEAD is a commit rather than a branch, so nothing can be committed or pushed.
wxString m_statusText
Unwrapped status text, kept so it can be re-wrapped on resize.
std::vector< wxString > m_recentMessageTexts
The full messages behind the Recent messages dropdown, in its order after the caption.
wxString m_currentBranch
The branch a commit will land on, empty when detached or before the first commit.
void populateRecentMessages(const std::vector< wxString > &aMessages)
Fill the Recent messages dropdown from the completed snapshot.
void Push()
Push the local commits, as the Push button does.
void onShowDiff(wxCommandEvent &aEvent)
bool m_operationInProgress
True while a merge or rebase is in progress. The network button then reads Abandon.
void SetCommitMessage(const wxString &aMessage)
wxStaticText * m_summaryFiles
wxMenuItem * m_commitAndPushItem
The arrow menu's entry, relabelled with the main button.
void SetMessageChangedHandler(std::function< void()> aHandler)
Called when the user edits the message, so another form can follow along.
void startPull(std::shared_ptr< KIGIT_COMMON > aCommon, bool aThenPush)
bool m_hasRepo
Whether the last completed status snapshot had a repository.
void SetFileSelectedHandler(std::function< void(const wxString &)> aHandler)
Called with the path of the file the user selects in the list, or empty when none is.
void onCommitAndPush(wxCommandEvent &aEvent)
GIT_COMMIT_PANE(EDA_BASE_FRAME *aParent)
int GetMinDockWidth() const
The width the panel needs so its widest row fits, for the dock that holds it.
int m_minDockWidth
The widest row's minimum width, measured before anything is hidden.
GitOperation m_operation
Which operation, so the button and the explanation can name it.
~GIT_COMMIT_PANE() override
std::set< wxString > m_shownPaths
Paths shown in the list at the last refresh, so a refresh can tell which files the user deliberately ...
void onRecentMessage(wxCommandEvent &aEvent)
void runActionQuery(std::shared_ptr< KIGIT_COMMON > aCommon, std::function< void(KIGIT_COMMON &)> aWork, std::function< void()> aDone, const wxString &aStatus)
Read an action's prerequisites off the UI thread, then resume only in the same project.
void onAmendToggled(wxCommandEvent &aEvent)
void onIdle(wxIdleEvent &aEvent)
bool m_listenerAttached
True once this panel has attached its refresh listener to a session at least once.
void onSize(wxSizeEvent &aEvent)
void syncListener()
Register a refresh listener with the project's current git session, re-registering if the session cha...
void confirmDiscardFile(std::shared_ptr< KIGIT_COMMON > aCommon, const wxString &aPath, bool aTracked, bool aConflicted, wxString aRoot)
KIGIT_QUERY m_actionQuery
EDITOR_SNAPSHOT m_docsBeforePull
On-disk identity of the open documents, taken before a pull so only the ones the merge rewrote are re...
wxStaticText * m_descriptionHint
The description box's hint, a label laid over it while it is empty.
void updateSummaryCount()
Show how many of the summary's 72 columns are left.
void applyStatus(const STATUS &aStatus)
Apply a completed repository snapshot on the UI thread.
void finishAbandonOperation(std::shared_ptr< KIGIT_COMMON > aCommon, const std::vector< wxString > &aOutside)
std::weak_ptr< KIGIT_COMMON > m_listenerSession
The git session this panel registered a refresh listener with, weak so it does not keep the session a...
void doCommit(bool aAndPush)
Commit the checked files (or amend the last commit when the amend box is ticked), then push when aAnd...
wxStaticText * m_summaryAdded
The project's git session.
Read repository state without blocking the UI.
What the open editors and the project settings looked like on disk before an operation that may rewri...