20#ifndef GIT_COMMIT_PANE_H
21#define GIT_COMMIT_PANE_H
98 void BeginAmend(
const wxString& aExpectedCommit = wxEmptyString );
108 void onCommit( wxCommandEvent& aEvent );
110 void onPull( wxCommandEvent& aEvent );
114 void finishAbandonOperation( std::shared_ptr<KIGIT_COMMON> aCommon,
const std::vector<wxString>& aOutside );
125 void discardFile( std::shared_ptr<KIGIT_COMMON> aCommon,
const wxString& aPath );
126 void confirmDiscardFile( std::shared_ptr<KIGIT_COMMON> aCommon,
const wxString& aPath,
bool aTracked,
127 bool aConflicted, wxString aRoot );
133 struct COMMIT_REQUEST;
134 void saveForCommit( std::shared_ptr<KIGIT_COMMON> aCommon, std::shared_ptr<COMMIT_REQUEST> aRequest );
135 void finishCommit( std::shared_ptr<KIGIT_COMMON> aCommon,
const COMMIT_REQUEST& aRequest );
138 void onIdle( wxIdleEvent& aEvent );
190 void setBusy(
bool aBusy,
const wxString& aStatus );
202 std::function<
void()> aDone,
const wxString& aStatus );
206 bool deferForSecret(
const std::shared_ptr<KIGIT_COMMON>& aCommon,
const wxString& aStatus,
207 std::function<
void()> aStart );
215 void submitPush( std::shared_ptr<KIGIT_COMMON> aCommon,
bool aRetriedAfterTrust =
false );
216 void startPush( std::shared_ptr<KIGIT_COMMON> aCommon,
const wxString& aBranch,
const wxString& aHead,
217 bool aRetriedAfterTrust );
218 void onPushDone( std::shared_ptr<KIGIT_COMMON> aCommon,
int aResult,
const wxString& aError,
219 const wxString& aDetails,
bool aAuthFailure,
220 const std::optional<KIGIT::HOST_KEY_FAILURE>& aHostKey,
bool aRetriedAfterTrust,
bool aCancelled );
223 void submitPull( std::shared_ptr<KIGIT_COMMON> aCommon,
bool aThenPush,
bool aRetriedAfterTrust =
false );
224 void startPull( std::shared_ptr<KIGIT_COMMON> aCommon,
bool aThenPush,
bool aRetriedAfterTrust );
229 struct MERGE_PREPARATION;
231 std::shared_ptr<MERGE_PREPARATION> aPreparation );
232 void onPullDone( std::shared_ptr<KIGIT_COMMON> aCommon,
int aResult,
const wxString& aError,
233 const wxString& aDetails,
bool aAuthFailure,
234 const std::optional<KIGIT::HOST_KEY_FAILURE>& aHostKey,
bool aRetriedAfterTrust,
bool aThenPush,
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.
bool othersCanCancel() const
void updateCommitButton()
Set what the commit buttons say, and whether they are enabled, for the current state.
void onPull(wxCommandEvent &aEvent)
int m_credentialPrompts
Keyring reads and credential prompts the current request has shown, reset when it ends.
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 abandonKeyringWait()
void SetBusyChangedHandler(std::function< void(bool)> aHandler)
Called when a transfer starts and when it ends, so an owning window can follow along.
unsigned m_keyringRequest
UTIL::LINK m_transferLink
Follows the transfers other windows run on this pane's repository.
void ShowTransferProgress(const wxString &aText)
Show a line of transfer progress. Called from the UI thread by a KIGIT_STATUS_REPORTER.
wxString m_transferStatus
The status m_transfer began with, shown again once other windows' transfers end before it.
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)
std::pair< wxString, wxString > m_undoHead
The branch and commit the last refresh showed, so Undo takes back only the commit the user saw.
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)
void onUndoCommit(wxCommandEvent &aEvent)
Take back the last commit while no remote has it, keeping its changes staged and its message.
bool m_showingOthers
The busy state shows another window's transfer, which this pane releases when the last one ends.
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 submitPull(std::shared_ptr< KIGIT_COMMON > aCommon, bool aThenPush, bool aRetriedAfterTrust=false)
aThenPush pushes after a successful pull, which belongs only to the rejected-push recovery flow.
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.
bool othersBusy() const
The transfers on it that other windows started, leaving out this pane's own.
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.
bool deferForSecret(const std::shared_ptr< KIGIT_COMMON > &aCommon, const wxString &aStatus, std::function< void()> aStart)
Read the keyring before a transfer, holding the pane busy as aStatus, then call aStart unless cancell...
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.
wxString othersStatus() const
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.
size_t m_unpushedCount
Commits waiting to be pushed, or 0 when the branch has no upstream to count them against.
void onFileActivated(wxDataViewEvent &aEvent)
bool Layout() override
Lay out the pane, then re-wrap the status line when the width its column got has changed.
bool m_commitButtonPushes
True while the main button reads Push, with nothing left to commit.
void ShowHistory()
Open the advanced window on its History page.
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.
GIT_TRANSFER_BUSY::HOLD m_ownHold
m_transfer's hold on the repository, so every other pane on it follows and can cancel it
GIT_TRANSFER_BUSY & transfers() const
The transfers on the repository this pane shows.
void showDisabledState()
Clear the list and disable every control while version control is off.
void updateDescriptionHint()
Where the platform has no hint for a multi line box, a label lies over the description box while it i...
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.
void OnGitTransfersChanged() override
Follow a transfer on this pane's repository beginning or ending in any window.
void onPushDone(std::shared_ptr< KIGIT_COMMON > aCommon, int aResult, const wxString &aError, const wxString &aDetails, bool aAuthFailure, const std::optional< KIGIT::HOST_KEY_FAILURE > &aHostKey, bool aRetriedAfterTrust, bool aCancelled)
std::pair< wxString, wxString > m_amendHead
The branch and commit chosen when amend started. Keep them fixed while editing.
void onChecklistContextMenu(wxDataViewEvent &aEvent)
void startPush(std::shared_ptr< KIGIT_COMMON > aCommon, const wxString &aBranch, const wxString &aHead, bool aRetriedAfterTrust)
void setStatusText(const wxString &aText)
Set the status line text and wrap it to the width of the label's column.
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.
int m_statusWrapWidth
The width the status text was last wrapped to, so a layout re-wraps it only when that changes.
bool layoutAndWrapStatus()
Lay out the controls, then rewrap the status line to its column's new width.
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
void onThemeChanged(wxSysColourChangedEvent &aEvent)
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.
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 onPullDone(std::shared_ptr< KIGIT_COMMON > aCommon, int aResult, const wxString &aError, const wxString &aDetails, bool aAuthFailure, const std::optional< KIGIT::HOST_KEY_FAILURE > &aHostKey, bool aRetriedAfterTrust, bool aThenPush, bool aCancelled)
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 startPull(std::shared_ptr< KIGIT_COMMON > aCommon, bool aThenPush, bool aRetriedAfterTrust)
bool dropKeyringWait()
Forget a keyring wait without touching the busy state. True when one was pending.
void onAmendToggled(wxCommandEvent &aEvent)
void onIdle(wxIdleEvent &aEvent)
int m_dockMinHeight
The controls' minimum height from the last layout, applied to the AUI pane at idle time.
bool m_listenerAttached
True once this panel has attached its refresh listener to a session at least once.
void syncListener()
Register a refresh listener with the project's current git session, re-registering if the session cha...
bool m_keyringWait
A push or pull waits on the keyring. The count fences off an answer from a cancelled wait.
size_t m_upstreamAhead
Commits the upstream has that this project does not, which Get Changes brings in.
void applyTheme()
Set the icons and colours that follow the light or dark theme.
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, once that is 10 or fewer.
void applyStatus(const STATUS &aStatus)
Apply a completed repository snapshot on the UI thread.
void submitPush(std::shared_ptr< KIGIT_COMMON > aCommon, bool aRetriedAfterTrust=false)
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...
wxHyperlinkCtrl * m_historyLink
Opens the History page from the docked panel. Never shown inside the advanced window.
void updateDockMinHeight()
Give the AUI pane the controls' minimum height, so a dock never squeezes them.
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
void showTrustCommand(const wxString &aCommand)
Show a command to copy under the status line, or hide the row when aCommand is empty.
One transfer's hold on its repository, released when reset, begun again or destroyed.
The transfers running on one repository, so every window can show and cancel the others'.
Told whenever a transfer on the repository it subscribed to begins or ends.
The project's git session.
Read repository state without blocking the UI.
Simple RAII-handle to a subscription.
What the open editors and the project settings looked like on disk before an operation that may rewri...