KiCad PCB EDA Suite
Loading...
Searching...
No Matches
GIT_COMMIT_PANE Class Reference

Docked panel for committing: the branch to commit to, a summary and description, the commit options, the changed files with a checkbox each, the commit and Get Changes buttons, and a gear holding the commit settings and the advanced Git window. More...

#include <git_commit_pane.h>

Inheritance diagram for GIT_COMMIT_PANE:
GIT_COMMIT_PANE_BASE

Classes

struct  COMMIT_REQUEST
 
struct  MERGE_PREPARATION
 
struct  STATUS
 

Public Member Functions

 GIT_COMMIT_PANE (EDA_BASE_FRAME *aParent)
 
 GIT_COMMIT_PANE (wxWindow *aParent, EDA_BASE_FRAME *aFrame)
 The same panel inside another window, such as the advanced window's Changes page.
 
 ~GIT_COMMIT_PANE () override
 
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.
 
wxString GetCommitMessage () const
 The message as typed. A second form on the same project shows the same text.
 
void SetCommitMessage (const wxString &aMessage)
 
void SetMessageChangedHandler (std::function< void()> aHandler)
 Called when the user edits the message, so another form can follow along.
 
void RefreshFileList ()
 Read the project's git status and repopulate the list.
 
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 ShowTransferProgress (const wxString &aText)
 Show a line of transfer progress. Called from the UI thread by a KIGIT_STATUS_REPORTER.
 
void ReloadAdvancedWindow ()
 Reload the advanced window when it is open, for a preferences change it also shows.
 
void Pull ()
 Get changes from the remote, as the Get Changes button does.
 
void Push ()
 Push the local commits, as the Push button does.
 
void BeginAmend (const wxString &aExpectedCommit=wxEmptyString)
 Prepare the amend form. A history entry supplies its hash and starts with no files selected.
 
void SetBusyChangedHandler (std::function< void(bool)> aHandler)
 Called when a transfer starts and when it ends, so an owning window can follow along.
 
int GetMinDockWidth () const
 The width the panel needs so its widest row fits, for the dock that holds it.
 

Protected Attributes

wxBoxSizer * m_branchRow
 
wxStaticText * m_branchName
 
wxChoice * m_recentMessages
 
STD_BITMAP_BUTTON * m_settingsButton
 
wxTextCtrl * m_summary
 
wxStaticText * m_summaryCount
 
wxTextCtrl * m_description
 
wxStaticBoxSizer * m_optionsSizer
 
wxCheckBox * m_amendCheckbox
 
wxCheckBox * m_signOffCheckbox
 
wxCheckBox * m_newBranchCheckbox
 
wxTextCtrl * m_newBranchName
 
wxBoxSizer * m_changesRow
 
wxStaticText * m_changesLabel
 
wxButton * m_showDiffButton
 
wxStaticText * m_emptyLabel
 
FILE_CHECKLIST_CTRL * m_checklist
 
SPLIT_BUTTON * m_commitButton
 
wxButton * m_pullButton
 

Private Member Functions

void onCommit (wxCommandEvent &aEvent)
 The split button's main half. It commits, or pushes when that is all there is to do.
 
void onCommitAndPush (wxCommandEvent &aEvent)
 
void onPull (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 finishAbandonOperation (std::shared_ptr< KIGIT_COMMON > aCommon, const std::vector< wxString > &aOutside)
 
void onAmendToggled (wxCommandEvent &aEvent)
 
void onNewBranchToggled (wxCommandEvent &aEvent)
 
void onRecentMessage (wxCommandEvent &aEvent)
 
void onShowDiff (wxCommandEvent &aEvent)
 
void onFileActivated (wxDataViewEvent &aEvent)
 
void onChecklistContextMenu (wxDataViewEvent &aEvent)
 
void discardFile (std::shared_ptr< KIGIT_COMMON > aCommon, const wxString &aPath)
 
void confirmDiscardFile (std::shared_ptr< KIGIT_COMMON > aCommon, const wxString &aPath, bool aTracked, bool aConflicted, wxString aRoot)
 
void doCommit (bool aAndPush)
 Commit the checked files (or amend the last commit when the amend box is ticked), then push when aAndPush is set.
 
void saveForCommit (std::shared_ptr< KIGIT_COMMON > aCommon, std::shared_ptr< COMMIT_REQUEST > aRequest)
 
void finishCommit (std::shared_ptr< KIGIT_COMMON > aCommon, const COMMIT_REQUEST &aRequest)
 
void onChecklistChanged (wxDataViewEvent &aEvent)
 
void onMessageChanged (wxCommandEvent &aEvent)
 
void onIdle (wxIdleEvent &aEvent)
 
void onSize (wxSizeEvent &aEvent)
 
void onSettings (wxCommandEvent &aEvent)
 The gear's menu: the advanced window and the author.
 
void setAuthor ()
 
void setStatusText (const wxString &aText)
 Set the status line text and wrap it to the current panel width.
 
bool transferCanStart ()
 False, with a message, while a transfer is running or a merge waits to be finished.
 
void layoutWide ()
 Put the file list beside the commit controls instead of above them, for a wide host, with a heading over the message and a summary of the working tree under it.
 
void updateSummary ()
 Refresh the staged count in the changes heading, and the summary box where the wide layout has one.
 
void applyStatus (const STATUS &aStatus)
 Apply a completed repository snapshot on the UI thread.
 
void populateBranches (const STATUS &aStatus)
 Fill the branch dropdown from the completed snapshot.
 
void populateRecentMessages (const std::vector< wxString > &aMessages)
 Fill the Recent messages dropdown from the completed snapshot.
 
void updateDescriptionHint ()
 Where the platform has no hint for a multi line box, a label lies over the description box while it is empty.
 
void setDescription (const wxString &aText)
 
void showDisabledState ()
 Clear the list and disable every control while version control is off.
 
void setBusy (bool aBusy, const wxString &aStatus)
 Enable or disable the controls while a network operation runs, showing a status.
 
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 submitPush (std::shared_ptr< KIGIT_COMMON > aCommon)
 
void startPush (std::shared_ptr< KIGIT_COMMON > aCommon, const wxString &aBranch, const wxString &aHead)
 
void onPushDone (std::shared_ptr< KIGIT_COMMON > aCommon, int aResult, const wxString &aError, bool aAuthFailure, bool aCancelled)
 
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 startPull (std::shared_ptr< KIGIT_COMMON > aCommon, bool aThenPush)
 
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, then create the merge commit.
 
void finishPullConflictPreparation (std::shared_ptr< KIGIT_COMMON > aCommon, bool aThenPush, std::shared_ptr< MERGE_PREPARATION > aPreparation)
 
void onPullDone (std::shared_ptr< KIGIT_COMMON > aCommon, int aResult, const wxString &aError, bool aAuthFailure, bool aThenPush, bool aCancelled)
 
void updateMessageVisibility (bool aHasChanges)
 Show the message field whenever a commit is possible, including a message-only amend.
 
void updateCommitButton ()
 Set what the commit buttons say, and whether they are enabled, for the current state.
 
void updateSummaryCount ()
 Show how many of the summary's 72 columns are left.
 
wxString operationNoun () const
 The noun for the operation in progress, for messages.
 
wxString abandonLabel () const
 The label the network button carries while an operation is in progress.
 
void syncListener ()
 Register a refresh listener with the project's current git session, re-registering if the session changed since last time (it is recreated when a project is loaded).
 

Private Attributes

EDA_BASE_FRAME * m_frame
 
int m_minDockWidth = 0
 The widest row's minimum width, measured before anything is hidden.
 
bool m_inAdvancedWindow = false
 True on the advanced window's Changes page, false in the docked panel.
 
bool m_hasUnpushedCommits
 
bool m_hasRemote
 
bool m_hasRepo = false
 Whether the last completed status snapshot had a repository.
 
bool m_headDetached
 True when HEAD is a commit rather than a branch, so nothing can be committed or pushed.
 
bool m_upstreamAhead
 True when the upstream has commits this project does not, so Get Changes has work to do.
 
bool m_operationInProgress
 True while a merge or rebase is in progress. The network button then reads Abandon.
 
GitOperation m_operation
 Which operation, so the button and the explanation can name it.
 
bool m_editorsDirty
 True when an open editor held unsaved changes at the last refresh.
 
bool m_canAmend = false
 Whether the current branch allows an amend. A refresh must not change an active amend into a commit.
 
std::pair< wxString, wxString > m_amendHead
 The branch and commit chosen when amend started. Keep them fixed while editing.
 
wxStaticText * m_descriptionHint = nullptr
 The description box's hint, a label laid over it while it is empty.
 
std::vector< wxString > m_recentMessageTexts
 The full messages behind the Recent messages dropdown, in its order after the caption.
 
wxMenuItem * m_commitAndPushItem = nullptr
 The arrow menu's entry, relabelled with the main button.
 
bool m_commitButtonPushes = false
 True while the main button reads Push, with nothing left to commit.
 
KIGIT_TRANSFER m_transfer
 The push or pull this panel submitted last.
 
std::function< void(bool)> m_busyChangedHandler
 Told when a transfer starts and ends. Empty unless an owning window asked.
 
wxString m_statusText
 Unwrapped status text, kept so it can be re-wrapped on resize.
 
bool m_listenerAttached = false
 True once this panel has attached its refresh listener to a session at least once.
 
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 alive.
 
std::set< wxString > m_shownPaths
 Paths shown in the list at the last refresh, so a refresh can tell which files the user deliberately unticked from files that are simply new, and preserve those unticks.
 
EDITOR_SNAPSHOT m_docsBeforePull
 On-disk identity of the open documents, taken before a pull so only the ones the merge rewrote are reloaded afterwards.
 
std::function< void()> m_messageChangedHandler
 Told when the message is edited. Empty unless an owning window asked.
 
wxString m_currentBranch
 The branch a commit will land on, empty when detached or before the first commit.
 
std::function< void(const wxString &)> m_fileSelectedHandler
 
wxStaticText * m_summaryFiles = nullptr
 
wxStaticText * m_summaryAdded = nullptr
 
wxStaticText * m_summaryRemoved = nullptr
 
std::pair< int, int > m_lineStats
 Lines the working tree adds and removes against HEAD, read at the last refresh.
 
KIGIT_QUERY m_refresh
 Coalesce refreshes while a repository read is running, and discard stale results.
 
KIGIT_QUERY m_actionQuery
 
bool m_actionPending = false
 

Detailed Description

Docked panel for committing: the branch to commit to, a summary and description, the commit options, the changed files with a checkbox each, the commit and Get Changes buttons, and a gear holding the commit settings and the advanced Git window.

Definition at line 47 of file git_commit_pane.h.

Constructor & Destructor Documentation

◆ GIT_COMMIT_PANE() [1/2]

GIT_COMMIT_PANE::GIT_COMMIT_PANE ( EDA_BASE_FRAME * aParent)

Definition at line 224 of file git_commit_pane.cpp.

References GIT_COMMIT_PANE().

Referenced by GIT_COMMIT_PANE().

◆ GIT_COMMIT_PANE() [2/2]

◆ ~GIT_COMMIT_PANE()

GIT_COMMIT_PANE::~GIT_COMMIT_PANE ( )
override

Member Function Documentation

◆ abandonLabel()

wxString GIT_COMMIT_PANE::abandonLabel ( ) const
private

The label the network button carries while an operation is in progress.

Definition at line 807 of file git_commit_pane.cpp.

References _, CherryPick, m_operation, Merge, Rebase, and Revert.

Referenced by updateCommitButton().

◆ abandonOperation()

void GIT_COMMIT_PANE::abandonOperation ( std::shared_ptr< KIGIT_COMMON > aCommon)
private

Drop an in-progress merge or rebase and return the project to its last commit.

Definition at line 1434 of file git_commit_pane.cpp.

References _, ChangedTrackedFilesOutsideProject(), finishAbandonOperation(), m_frame, and runActionQuery().

Referenced by onPull().

◆ applyStatus()

◆ BeginAmend()

◆ confirmDiscardFile()

void GIT_COMMIT_PANE::confirmDiscardFile ( std::shared_ptr< KIGIT_COMMON > aCommon,
const wxString & aPath,
bool aTracked,
bool aConflicted,
wxString aRoot )
private

◆ discardFile()

void GIT_COMMIT_PANE::discardFile ( std::shared_ptr< KIGIT_COMMON > aCommon,
const wxString & aPath )
private

◆ doCommit()

◆ finishAbandonOperation()

void GIT_COMMIT_PANE::finishAbandonOperation ( std::shared_ptr< KIGIT_COMMON > aCommon,
const std::vector< wxString > & aOutside )
private

◆ finishCommit()

◆ finishPullConflictPreparation()

◆ GetCommitMessage()

wxString GIT_COMMIT_PANE::GetCommitMessage ( ) const

The message as typed. A second form on the same project shows the same text.

Definition at line 972 of file git_commit_pane.cpp.

References KIGIT::ComposeCommitMessage(), GIT_COMMIT_PANE_BASE::m_description, and GIT_COMMIT_PANE_BASE::m_summary.

Referenced by BeginAmend().

◆ GetMinDockWidth()

int GIT_COMMIT_PANE::GetMinDockWidth ( ) const
inline

The width the panel needs so its widest row fits, for the dock that holds it.

Definition at line 96 of file git_commit_pane.h.

References m_minDockWidth.

◆ layoutWide()

void GIT_COMMIT_PANE::layoutWide ( )
private

◆ onAmendToggled()

void GIT_COMMIT_PANE::onAmendToggled ( wxCommandEvent & aEvent)
private

◆ onChecklistChanged()

void GIT_COMMIT_PANE::onChecklistChanged ( wxDataViewEvent & aEvent)
private

Definition at line 1100 of file git_commit_pane.cpp.

References updateCommitButton(), and updateSummary().

Referenced by GIT_COMMIT_PANE().

◆ onChecklistContextMenu()

void GIT_COMMIT_PANE::onChecklistContextMenu ( wxDataViewEvent & aEvent)
private

◆ onCommit()

void GIT_COMMIT_PANE::onCommit ( wxCommandEvent & aEvent)
private

The split button's main half. It commits, or pushes when that is all there is to do.

Definition at line 1310 of file git_commit_pane.cpp.

References doCommit(), and m_commitButtonPushes.

Referenced by GIT_COMMIT_PANE().

◆ onCommitAndPush()

void GIT_COMMIT_PANE::onCommitAndPush ( wxCommandEvent & aEvent)
private

Definition at line 1316 of file git_commit_pane.cpp.

References doCommit().

Referenced by GIT_COMMIT_PANE().

◆ onFileActivated()

void GIT_COMMIT_PANE::onFileActivated ( wxDataViewEvent & aEvent)
private

Definition at line 1301 of file git_commit_pane.cpp.

References GIT_COMMIT_PANE_BASE::m_checklist, m_frame, path, and ShowGitFileDiff().

Referenced by GIT_COMMIT_PANE().

◆ onIdle()

void GIT_COMMIT_PANE::onIdle ( wxIdleEvent & aEvent)
private

◆ onMessageChanged()

void GIT_COMMIT_PANE::onMessageChanged ( wxCommandEvent & aEvent)
private

Definition at line 962 of file git_commit_pane.cpp.

References m_messageChangedHandler, updateCommitButton(), and updateSummaryCount().

Referenced by GIT_COMMIT_PANE().

◆ onNewBranchToggled()

void GIT_COMMIT_PANE::onNewBranchToggled ( wxCommandEvent & aEvent)
private

◆ onPull()

void GIT_COMMIT_PANE::onPull ( wxCommandEvent & aEvent)
private

◆ onPullDone()

void GIT_COMMIT_PANE::onPullDone ( std::shared_ptr< KIGIT_COMMON > aCommon,
int aResult,
const wxString & aError,
bool aAuthFailure,
bool aThenPush,
bool aCancelled )
private

◆ onPushDone()

void GIT_COMMIT_PANE::onPushDone ( std::shared_ptr< KIGIT_COMMON > aCommon,
int aResult,
const wxString & aError,
bool aAuthFailure,
bool aCancelled )
private

◆ onRecentMessage()

void GIT_COMMIT_PANE::onRecentMessage ( wxCommandEvent & aEvent)
private

◆ onSettings()

void GIT_COMMIT_PANE::onSettings ( wxCommandEvent & aEvent)
private

The gear's menu: the advanced window and the author.

Definition at line 727 of file git_commit_pane.cpp.

References _, m_frame, m_inAdvancedWindow, setAuthor(), and GIT_ADVANCED_DIALOG::ShowForFrame().

Referenced by GIT_COMMIT_PANE().

◆ onShowDiff()

void GIT_COMMIT_PANE::onShowDiff ( wxCommandEvent & aEvent)
private

Definition at line 1002 of file git_commit_pane.cpp.

References GIT_COMMIT_PANE_BASE::m_checklist, m_frame, path, and ShowGitFileDiff().

Referenced by GIT_COMMIT_PANE().

◆ onSize()

void GIT_COMMIT_PANE::onSize ( wxSizeEvent & aEvent)
private

Definition at line 718 of file git_commit_pane.cpp.

References GIT_COMMIT_PANE_BASE::m_emptyLabel, m_statusText, and setStatusText().

Referenced by GIT_COMMIT_PANE().

◆ operationNoun()

wxString GIT_COMMIT_PANE::operationNoun ( ) const
private

The noun for the operation in progress, for messages.

Definition at line 794 of file git_commit_pane.cpp.

References _, CherryPick, m_operation, Merge, Rebase, and Revert.

Referenced by applyStatus(), finishAbandonOperation(), and transferCanStart().

◆ populateBranches()

void GIT_COMMIT_PANE::populateBranches ( const STATUS & aStatus)
private

◆ populateRecentMessages()

void GIT_COMMIT_PANE::populateRecentMessages ( const std::vector< wxString > & aMessages)
private

Fill the Recent messages dropdown from the completed snapshot.

Definition at line 1038 of file git_commit_pane.cpp.

References _, GIT_COMMIT_PANE_BASE::m_recentMessages, m_recentMessageTexts, and message.

Referenced by applyStatus().

◆ Pull()

void GIT_COMMIT_PANE::Pull ( )

Get changes from the remote, as the Get Changes button does.

The advanced window's Pull button lands here, so one place owns the merge and its conflict handling.

Definition at line 1390 of file git_commit_pane.cpp.

References _, DisplayInfoMessage(), m_frame, m_hasRemote, submitPull(), syncListener(), and transferCanStart().

Referenced by onPull().

◆ Push()

void GIT_COMMIT_PANE::Push ( )

Push the local commits, as the Push button does.

The advanced window's Push button lands here too.

Definition at line 1409 of file git_commit_pane.cpp.

References _, DisplayInfoMessage(), m_frame, m_hasRemote, m_hasUnpushedCommits, submitPush(), syncListener(), and transferCanStart().

◆ RefreshFileList()

◆ ReloadAdvancedWindow()

void GIT_COMMIT_PANE::ReloadAdvancedWindow ( )

Reload the advanced window when it is open, for a preferences change it also shows.

Definition at line 642 of file git_commit_pane.cpp.

References GIT_ADVANCED_DIALOG::Active().

◆ resolvePullConflicts()

void GIT_COMMIT_PANE::resolvePullConflicts ( std::shared_ptr< KIGIT_COMMON > aCommon,
bool aThenPush )
private

Resolve a conflicted pull file by file, using the visual merge tool for design files, then create the merge commit.

Cancelling leaves the repository exactly as it was.

Definition at line 2167 of file git_commit_pane.cpp.

References _, finishPullConflictPreparation(), KIGIT_COMMON::GetGitRootDirectory(), KIGIT_COMMON::GetMergeConflicts(), KIGIT_COMMON::IsPullRebaseConfigured(), KIGIT::ReadGitIdentity(), and runActionQuery().

Referenced by onPullDone().

◆ runActionQuery()

void GIT_COMMIT_PANE::runActionQuery ( std::shared_ptr< KIGIT_COMMON > aCommon,
std::function< void(KIGIT_COMMON &)> aWork,
std::function< void()> aDone,
const wxString & aStatus )
private

Read an action's prerequisites off the UI thread, then resume only in the same project.

Definition at line 1899 of file git_commit_pane.cpp.

References m_actionPending, m_actionQuery, m_frame, m_transfer, Pgm(), setBusy(), and KIGIT::ShowBusyMessage().

Referenced by abandonOperation(), BeginAmend(), discardFile(), doCommit(), onPushDone(), resolvePullConflicts(), setAuthor(), submitPull(), and submitPush().

◆ saveForCommit()

void GIT_COMMIT_PANE::saveForCommit ( std::shared_ptr< KIGIT_COMMON > aCommon,
std::shared_ptr< COMMIT_REQUEST > aRequest )
private

◆ setAuthor()

void GIT_COMMIT_PANE::setAuthor ( )
private

Definition at line 757 of file git_commit_pane.cpp.

References _, KIGIT::EditGitIdentity(), m_frame, KIGIT::ReadGitIdentity(), and runActionQuery().

Referenced by onSettings().

◆ setBusy()

◆ SetBusyChangedHandler()

void GIT_COMMIT_PANE::SetBusyChangedHandler ( std::function< void(bool)> aHandler)
inline

Called when a transfer starts and when it ends, so an owning window can follow along.

Definition at line 93 of file git_commit_pane.h.

References m_busyChangedHandler.

Referenced by GIT_ADVANCED_DIALOG::CloseForPane().

◆ SetCommitMessage()

void GIT_COMMIT_PANE::SetCommitMessage ( const wxString & aMessage)

◆ setDescription()

void GIT_COMMIT_PANE::setDescription ( const wxString & aText)
private

◆ SetFileSelectedHandler()

void GIT_COMMIT_PANE::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.

Definition at line 406 of file git_commit_pane.cpp.

References m_fileSelectedHandler.

◆ SetMessageChangedHandler()

void GIT_COMMIT_PANE::SetMessageChangedHandler ( std::function< void()> aHandler)
inline

Called when the user edits the message, so another form can follow along.

Definition at line 65 of file git_commit_pane.h.

References m_messageChangedHandler.

Referenced by GIT_ADVANCED_DIALOG::CloseForPane().

◆ setStatusText()

void GIT_COMMIT_PANE::setStatusText ( const wxString & aText)
private

Set the status line text and wrap it to the current panel width.

Definition at line 688 of file git_commit_pane.cpp.

References GIT_COMMIT_PANE_BASE::m_emptyLabel, and m_statusText.

Referenced by applyStatus(), onSize(), setBusy(), showDisabledState(), and updateCommitButton().

◆ SetTransferBusy()

void GIT_COMMIT_PANE::SetTransferBusy ( bool aBusy,
const wxString & aStatus = wxEmptyString )

Put the panel into the state it uses while a transfer runs, for one started elsewhere.

The advanced window hosts this panel, so a fetch or a force push begun from there must disable the same controls. A transfer this panel started keeps the state until it ends.

Definition at line 1933 of file git_commit_pane.cpp.

References m_transfer, and setBusy().

◆ showDisabledState()

◆ ShowTransferProgress()

void GIT_COMMIT_PANE::ShowTransferProgress ( const wxString & aText)

Show a line of transfer progress. Called from the UI thread by a KIGIT_STATUS_REPORTER.

Definition at line 1942 of file git_commit_pane.cpp.

References m_frame.

◆ startPull()

void GIT_COMMIT_PANE::startPull ( std::shared_ptr< KIGIT_COMMON > aCommon,
bool aThenPush )
private

◆ startPush()

void GIT_COMMIT_PANE::startPush ( std::shared_ptr< KIGIT_COMMON > aCommon,
const wxString & aBranch,
const wxString & aHead )
private

Definition at line 2017 of file git_commit_pane.cpp.

References _, KIGIT::CallOnUi(), Error, m_transfer, result, setBusy(), and Success.

Referenced by submitPush().

◆ submitPull()

void GIT_COMMIT_PANE::submitPull ( std::shared_ptr< KIGIT_COMMON > aCommon,
bool aThenPush )
private

aThenPush pushes after a successful pull, which belongs only to the rejected-push recovery flow.

A plain Get Changes leaves local commits unpublished.

Definition at line 2514 of file git_commit_pane.cpp.

References _, CHECK, KIGIT::EnsureGitIdentity(), m_frame, ProjectSafeToRewrite(), KIGIT::ReadGitIdentity(), ReadGitWorktreeStatus(), result, runActionQuery(), setBusy(), and startPull().

Referenced by onPullDone(), onPushDone(), and Pull().

◆ submitPush()

◆ syncListener()

void GIT_COMMIT_PANE::syncListener ( )
private

Register a refresh listener with the project's current git session, re-registering if the session changed since last time (it is recreated when a project is loaded).

Definition at line 427 of file git_commit_pane.cpp.

References GIT_ADVANCED_DIALOG::CloseActive(), m_actionPending, m_actionQuery, GIT_COMMIT_PANE_BASE::m_amendCheckbox, m_amendHead, m_frame, m_hasRepo, m_listenerAttached, m_listenerSession, m_refresh, m_shownPaths, RefreshFileList(), and setBusy().

Referenced by doCommit(), onPull(), Pull(), Push(), and RefreshFileList().

◆ transferCanStart()

bool GIT_COMMIT_PANE::transferCanStart ( )
private

False, with a message, while a transfer is running or a merge waits to be finished.

Definition at line 1361 of file git_commit_pane.cpp.

References _, DisplayInfoMessage(), m_actionPending, m_headDetached, m_operationInProgress, m_transfer, operationNoun(), and KIGIT::ShowBusyMessage().

Referenced by Pull(), and Push().

◆ updateCommitButton()

◆ updateDescriptionHint()

void GIT_COMMIT_PANE::updateDescriptionHint ( )
private

Where the platform has no hint for a multi line box, a label lies over the description box while it is empty.

Definition at line 1076 of file git_commit_pane.cpp.

References GIT_COMMIT_PANE_BASE::m_description, and m_descriptionHint.

Referenced by applyStatus(), GIT_COMMIT_PANE(), onIdle(), and setDescription().

◆ updateMessageVisibility()

◆ updateSummary()

void GIT_COMMIT_PANE::updateSummary ( )
private

Refresh the staged count in the changes heading, and the summary box where the wide layout has one.

Definition at line 1107 of file git_commit_pane.cpp.

References _, GIT_COMMIT_PANE_BASE::m_changesLabel, GIT_COMMIT_PANE_BASE::m_checklist, m_lineStats, GIT_COMMIT_PANE_BASE::m_showDiffButton, m_shownPaths, m_summaryAdded, m_summaryFiles, and m_summaryRemoved.

Referenced by applyStatus(), and onChecklistChanged().

◆ updateSummaryCount()

void GIT_COMMIT_PANE::updateSummaryCount ( )
private

Show how many of the summary's 72 columns are left.

Definition at line 954 of file git_commit_pane.cpp.

References left, GIT_COMMIT_PANE_BASE::m_summary, and GIT_COMMIT_PANE_BASE::m_summaryCount.

Referenced by GIT_COMMIT_PANE(), onMessageChanged(), and SetCommitMessage().

Member Data Documentation

◆ m_actionPending

bool GIT_COMMIT_PANE::m_actionPending = false
private

◆ m_actionQuery

KIGIT_QUERY GIT_COMMIT_PANE::m_actionQuery
private

◆ m_amendCheckbox

◆ m_amendHead

std::pair<wxString, wxString> GIT_COMMIT_PANE::m_amendHead
private

The branch and commit chosen when amend started. Keep them fixed while editing.

Definition at line 246 of file git_commit_pane.h.

Referenced by BeginAmend(), doCommit(), finishCommit(), onAmendToggled(), showDisabledState(), and syncListener().

◆ m_branchName

wxStaticText* GIT_COMMIT_PANE_BASE::m_branchName
protectedinherited

◆ m_branchRow

wxBoxSizer* GIT_COMMIT_PANE_BASE::m_branchRow
protectedinherited

◆ m_busyChangedHandler

std::function<void( bool )> GIT_COMMIT_PANE::m_busyChangedHandler
private

Told when a transfer starts and ends. Empty unless an owning window asked.

Definition at line 267 of file git_commit_pane.h.

Referenced by setBusy(), and SetBusyChangedHandler().

◆ m_canAmend

bool GIT_COMMIT_PANE::m_canAmend = false
private

Whether the current branch allows an amend. A refresh must not change an active amend into a commit.

Definition at line 243 of file git_commit_pane.h.

Referenced by applyStatus(), BeginAmend(), showDisabledState(), updateCommitButton(), and updateMessageVisibility().

◆ m_changesLabel

wxStaticText* GIT_COMMIT_PANE_BASE::m_changesLabel
protectedinherited

Definition at line 58 of file git_commit_pane_base.h.

Referenced by GIT_COMMIT_PANE_BASE(), and GIT_COMMIT_PANE::updateSummary().

◆ m_changesRow

wxBoxSizer* GIT_COMMIT_PANE_BASE::m_changesRow
protectedinherited

◆ m_checklist

◆ m_commitAndPushItem

wxMenuItem* GIT_COMMIT_PANE::m_commitAndPushItem = nullptr
private

The arrow menu's entry, relabelled with the main button.

Definition at line 256 of file git_commit_pane.h.

Referenced by GIT_COMMIT_PANE(), and updateCommitButton().

◆ m_commitButton

SPLIT_BUTTON* GIT_COMMIT_PANE_BASE::m_commitButton
protectedinherited

◆ m_commitButtonPushes

bool GIT_COMMIT_PANE::m_commitButtonPushes = false
private

True while the main button reads Push, with nothing left to commit.

Definition at line 259 of file git_commit_pane.h.

Referenced by GIT_COMMIT_PANE(), onCommit(), and updateCommitButton().

◆ m_currentBranch

wxString GIT_COMMIT_PANE::m_currentBranch
private

The branch a commit will land on, empty when detached or before the first commit.

Definition at line 292 of file git_commit_pane.h.

Referenced by doCommit(), and populateBranches().

◆ m_description

◆ m_descriptionHint

wxStaticText* GIT_COMMIT_PANE::m_descriptionHint = nullptr
private

The description box's hint, a label laid over it while it is empty.

Null where the box shows its own.

Definition at line 250 of file git_commit_pane.h.

Referenced by GIT_COMMIT_PANE(), and updateDescriptionHint().

◆ m_docsBeforePull

EDITOR_SNAPSHOT GIT_COMMIT_PANE::m_docsBeforePull
private

On-disk identity of the open documents, taken before a pull so only the ones the merge rewrote are reloaded afterwards.

Definition at line 286 of file git_commit_pane.h.

Referenced by finishPullConflictPreparation(), and startPull().

◆ m_editorsDirty

bool GIT_COMMIT_PANE::m_editorsDirty
private

True when an open editor held unsaved changes at the last refresh.

Definition at line 240 of file git_commit_pane.h.

Referenced by applyStatus(), GIT_COMMIT_PANE(), onIdle(), showDisabledState(), updateCommitButton(), and updateMessageVisibility().

◆ m_emptyLabel

◆ m_fileSelectedHandler

std::function<void( const wxString& )> GIT_COMMIT_PANE::m_fileSelectedHandler
private

Definition at line 294 of file git_commit_pane.h.

Referenced by GIT_COMMIT_PANE(), and SetFileSelectedHandler().

◆ m_frame

◆ m_hasRemote

bool GIT_COMMIT_PANE::m_hasRemote
private

◆ m_hasRepo

bool GIT_COMMIT_PANE::m_hasRepo = false
private

Whether the last completed status snapshot had a repository.

Definition at line 225 of file git_commit_pane.h.

Referenced by applyStatus(), onIdle(), showDisabledState(), syncListener(), and updateCommitButton().

◆ m_hasUnpushedCommits

bool GIT_COMMIT_PANE::m_hasUnpushedCommits
private

◆ m_headDetached

bool GIT_COMMIT_PANE::m_headDetached
private

True when HEAD is a commit rather than a branch, so nothing can be committed or pushed.

Definition at line 228 of file git_commit_pane.h.

Referenced by applyStatus(), GIT_COMMIT_PANE(), populateBranches(), setBusy(), showDisabledState(), transferCanStart(), and updateCommitButton().

◆ m_inAdvancedWindow

bool GIT_COMMIT_PANE::m_inAdvancedWindow = false
private

True on the advanced window's Changes page, false in the docked panel.

Definition at line 218 of file git_commit_pane.h.

Referenced by GIT_COMMIT_PANE(), onChecklistContextMenu(), and onSettings().

◆ m_lineStats

std::pair<int, int> GIT_COMMIT_PANE::m_lineStats
private

Lines the working tree adds and removes against HEAD, read at the last refresh.

Definition at line 302 of file git_commit_pane.h.

Referenced by applyStatus(), and updateSummary().

◆ m_listenerAttached

bool GIT_COMMIT_PANE::m_listenerAttached = false
private

True once this panel has attached its refresh listener to a session at least once.

A first attachment is not a project change, so it must not close the Advanced window.

Definition at line 274 of file git_commit_pane.h.

Referenced by syncListener().

◆ m_listenerSession

std::weak_ptr<KIGIT_COMMON> GIT_COMMIT_PANE::m_listenerSession
private

The git session this panel registered a refresh listener with, weak so it does not keep the session alive.

Used to unregister on destruction.

Definition at line 278 of file git_commit_pane.h.

Referenced by syncListener(), and ~GIT_COMMIT_PANE().

◆ m_messageChangedHandler

std::function<void()> GIT_COMMIT_PANE::m_messageChangedHandler
private

Told when the message is edited. Empty unless an owning window asked.

Definition at line 289 of file git_commit_pane.h.

Referenced by BeginAmend(), GIT_COMMIT_PANE(), onMessageChanged(), and SetMessageChangedHandler().

◆ m_minDockWidth

int GIT_COMMIT_PANE::m_minDockWidth = 0
private

The widest row's minimum width, measured before anything is hidden.

Definition at line 215 of file git_commit_pane.h.

Referenced by GetMinDockWidth(), and GIT_COMMIT_PANE().

◆ m_newBranchCheckbox

◆ m_newBranchName

◆ m_operation

GitOperation GIT_COMMIT_PANE::m_operation
private

Which operation, so the button and the explanation can name it.

Definition at line 237 of file git_commit_pane.h.

Referenced by abandonLabel(), applyStatus(), GIT_COMMIT_PANE(), operationNoun(), and showDisabledState().

◆ m_operationInProgress

bool GIT_COMMIT_PANE::m_operationInProgress
private

True while a merge or rebase is in progress. The network button then reads Abandon.

Definition at line 234 of file git_commit_pane.h.

Referenced by applyStatus(), GIT_COMMIT_PANE(), onPull(), setBusy(), showDisabledState(), transferCanStart(), and updateCommitButton().

◆ m_optionsSizer

wxStaticBoxSizer* GIT_COMMIT_PANE_BASE::m_optionsSizer
protectedinherited

◆ m_pullButton

wxButton* GIT_COMMIT_PANE_BASE::m_pullButton
protectedinherited

◆ m_recentMessages

wxChoice* GIT_COMMIT_PANE_BASE::m_recentMessages
protectedinherited

◆ m_recentMessageTexts

std::vector<wxString> GIT_COMMIT_PANE::m_recentMessageTexts
private

The full messages behind the Recent messages dropdown, in its order after the caption.

Definition at line 253 of file git_commit_pane.h.

Referenced by onRecentMessage(), and populateRecentMessages().

◆ m_refresh

KIGIT_QUERY GIT_COMMIT_PANE::m_refresh
private

Coalesce refreshes while a repository read is running, and discard stale results.

Definition at line 305 of file git_commit_pane.h.

Referenced by onIdle(), RefreshFileList(), syncListener(), and ~GIT_COMMIT_PANE().

◆ m_settingsButton

STD_BITMAP_BUTTON* GIT_COMMIT_PANE_BASE::m_settingsButton
protectedinherited

◆ m_showDiffButton

wxButton* GIT_COMMIT_PANE_BASE::m_showDiffButton
protectedinherited

◆ m_shownPaths

std::set<wxString> GIT_COMMIT_PANE::m_shownPaths
private

Paths shown in the list at the last refresh, so a refresh can tell which files the user deliberately unticked from files that are simply new, and preserve those unticks.

Definition at line 282 of file git_commit_pane.h.

Referenced by applyStatus(), showDisabledState(), syncListener(), updateCommitButton(), and updateSummary().

◆ m_signOffCheckbox

wxCheckBox* GIT_COMMIT_PANE_BASE::m_signOffCheckbox
protectedinherited

◆ m_statusText

wxString GIT_COMMIT_PANE::m_statusText
private

Unwrapped status text, kept so it can be re-wrapped on resize.

Definition at line 270 of file git_commit_pane.h.

Referenced by onSize(), and setStatusText().

◆ m_summary

◆ m_summaryAdded

wxStaticText* GIT_COMMIT_PANE::m_summaryAdded = nullptr
private

Definition at line 298 of file git_commit_pane.h.

Referenced by layoutWide(), and updateSummary().

◆ m_summaryCount

wxStaticText* GIT_COMMIT_PANE_BASE::m_summaryCount
protectedinherited

◆ m_summaryFiles

wxStaticText* GIT_COMMIT_PANE::m_summaryFiles = nullptr
private

Definition at line 297 of file git_commit_pane.h.

Referenced by layoutWide(), RefreshFileList(), and updateSummary().

◆ m_summaryRemoved

wxStaticText* GIT_COMMIT_PANE::m_summaryRemoved = nullptr
private

Definition at line 299 of file git_commit_pane.h.

Referenced by layoutWide(), and updateSummary().

◆ m_transfer

KIGIT_TRANSFER GIT_COMMIT_PANE::m_transfer
private

The push or pull this panel submitted last.

Definition at line 263 of file git_commit_pane.h.

Referenced by doCommit(), onChecklistContextMenu(), onIdle(), onPull(), runActionQuery(), SetTransferBusy(), startPull(), startPush(), transferCanStart(), and updateCommitButton().

◆ m_upstreamAhead

bool GIT_COMMIT_PANE::m_upstreamAhead
private

True when the upstream has commits this project does not, so Get Changes has work to do.

Definition at line 231 of file git_commit_pane.h.

Referenced by applyStatus(), GIT_COMMIT_PANE(), showDisabledState(), and updateCommitButton().


The documentation for this class was generated from the following files: