|
KiCad PCB EDA Suite
|
#include <git_commit_handler.h>
Public Types | |
| enum class | GIT_STATUS { GIT_STATUS_UNTRACKED , GIT_STATUS_CURRENT , GIT_STATUS_MODIFIED , GIT_STATUS_ADDED , GIT_STATUS_DELETED , GIT_STATUS_BEHIND , GIT_STATUS_AHEAD , GIT_STATUS_CONFLICTED , GIT_STATUS_IGNORED , GIT_STATUS_LAST } |
| enum class | GIT_CONN_TYPE { GIT_CONN_HTTPS = 0 , GIT_CONN_SSH , GIT_CONN_LOCAL , GIT_CONN_LAST } |
Public Member Functions | |
| GIT_COMMIT_HANDLER (git_repository *aRepo) | |
| virtual | ~GIT_COMMIT_HANDLER () |
| CommitResult | PerformCommit (const std::vector< wxString > &aFiles, const wxString &aMessage, const wxString &aAuthorName, const wxString &aAuthorEmail) |
| CommitResult | PerformAmend (const std::vector< wxString > &aFiles, const wxString &aMessage, const wxString &aAuthorName, const wxString &aAuthorEmail) |
| wxString | GetErrorString () const |
| git_repository * | GetRepo () const |
| void | SetRepo (git_repository *aRepo) |
| wxString | GetCurrentBranchName () const |
| std::vector< wxString > | GetBranchNames () const |
| std::vector< wxString > | GetProjectDirs () |
| Return a vector of project files in the repository. | |
| std::pair< std::set< wxString >, std::set< wxString > > | GetDifferentFiles () const |
| Return a pair of sets of files that differ locally from the remote repository The first set is files that have been committed locally but not pushed The second set is files that have been committed remotely but not pulled. | |
| wxString | GetUsername () const |
| wxString | GetPassword () |
| GIT_CONN_TYPE | GetConnType () const |
| void | SetUsername (const wxString &aUsername) |
| void | SetPassword (const wxString &aPassword) |
| void | SetSSHKey (const wxString &aSSHKey) |
| unsigned & | TestedTypes () |
| bool | HasLocalCommits () const |
| bool | HasPushAndPullRemote () const |
| void | UpdateCurrentBranchInfo () |
| wxString | GetGitRootDirectory () const |
| wxString | GetRemotename () const |
| wxString | GetRemoteNameOrDefault () const |
| Returns GetRemotename() when non-empty, otherwise "origin". | |
| wxString | GetUpstreamShorthand () const |
| Returns the upstream shorthand for the current branch (e.g. | |
| void | SetProjectDir (const wxString &aProjectDir) |
| Set the project directory path, preserving any symlinks in the path. | |
| wxString | GetProjectDir () const |
| Get the project directory path. | |
| void | ResetNextKey () |
| wxString | GetNextPublicKey () |
| void | SetRemote (const wxString &aRemote) |
| const wxString & | GetRemote () const |
| int | HandleSSHKeyAuthentication (git_cred **aOut, const wxString &aUsername) |
| int | HandlePlaintextAuthentication (git_cred **aOut, const wxString &aUsername) |
| int | HandleSSHAgentAuthentication (git_cred **aOut, const wxString &aUsername) |
| bool | IsCancelled () const |
| void | SetCancelled (bool aCancel) |
| bool | WasAuthFailure () const |
| void | ClearAuthFailure () |
| void | SetAuthFailure () |
Static Public Member Functions | |
| static wxString | GetLastGitError () |
Protected Attributes | |
| git_repository * | m_repo |
| wxString | m_projectDir |
| GIT_CONN_TYPE | m_connType |
| wxString | m_remote |
| wxString | m_hostname |
| wxString | m_username |
| wxString | m_password |
| unsigned | m_testedTypes |
| bool | m_authFailed = false |
| std::mutex | m_gitActionMutex |
Private Member Functions | |
| void | AddErrorString (const wxString &aErrorString) |
| void | updatePublicKeys () |
| void | updateConnectionType () |
Private Attributes | |
| wxString | m_errorString |
| std::vector< wxString > | m_publicKeys |
| int | m_nextPublicKey |
| bool | m_secretFetched |
| std::atomic< bool > | m_cancel |
Static Private Attributes | |
| static const unsigned | KIGIT_CREDENTIAL_SSH_AGENT = 1 << sizeof( m_testedTypes - 1 ) |
Friends | |
| class | LIBGIT_BACKEND |
Definition at line 36 of file git_commit_handler.h.
|
stronginherited |
| Enumerator | |
|---|---|
| GIT_CONN_HTTPS | |
| GIT_CONN_SSH | |
| GIT_CONN_LOCAL | |
| GIT_CONN_LAST | |
Definition at line 84 of file kicad_git_common.h.
|
stronginherited |
| Enumerator | |
|---|---|
| GIT_STATUS_UNTRACKED | |
| GIT_STATUS_CURRENT | |
| GIT_STATUS_MODIFIED | |
| GIT_STATUS_ADDED | |
| GIT_STATUS_DELETED | |
| GIT_STATUS_BEHIND | |
| GIT_STATUS_AHEAD | |
| GIT_STATUS_CONFLICTED | |
| GIT_STATUS_IGNORED | |
| GIT_STATUS_LAST | |
Definition at line 70 of file kicad_git_common.h.
| GIT_COMMIT_HANDLER::GIT_COMMIT_HANDLER | ( | git_repository * | aRepo | ) |
Definition at line 23 of file git_commit_handler.cpp.
References KIGIT_COMMON::KIGIT_COMMON().
|
virtual |
Definition at line 28 of file git_commit_handler.cpp.
|
private |
Definition at line 55 of file git_commit_handler.cpp.
References m_errorString.
Referenced by LIBGIT_BACKEND::Amend(), LIBGIT_BACKEND::Commit(), and LIBGIT_BACKEND.
|
inlineinherited |
Definition at line 185 of file kicad_git_common.h.
References m_authFailed.
Referenced by PROJECT_TREE_PANE::onGitFetch(), PROJECT_TREE_PANE::onGitInitializeProject(), PROJECT_TREE_PANE::onGitPullProject(), PROJECT_TREE_PANE::onGitPushProject(), and promptForGitCredentials().
|
inherited |
Definition at line 177 of file kicad_git_common.cpp.
|
inherited |
Definition at line 792 of file kicad_git_common.cpp.
References GetRemotename(), GIT_CONN_HTTPS, GIT_CONN_LOCAL, GIT_CONN_SSH, and m_remote.
Referenced by promptForGitCredentials().
|
inherited |
Definition at line 126 of file kicad_git_common.cpp.
References m_repo, and traceGit.
Referenced by TEXT_EVAL_VCS::GetBranch(), PROJECT_TREE_PANE::onGitPullProject(), and PROJECT_TREE_PANE::onGitPushProject().
|
inherited |
Return a pair of sets of files that differ locally from the remote repository The first set is files that have been committed locally but not pushed The second set is files that have been committed remotely but not pulled.
Definition at line 308 of file kicad_git_common.cpp.
References KIGIT::CollectDiffDeltas(), GetLastGitError(), IsCancelled(), m_repo, and traceGit.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| wxString GIT_COMMIT_HANDLER::GetErrorString | ( | ) | const |
Definition at line 49 of file git_commit_handler.cpp.
References m_errorString.
Referenced by BOOST_AUTO_TEST_CASE(), PROJECT_TREE_PANE::onGitAmendCommit(), and PROJECT_TREE_PANE::onGitCommit().
|
inherited |
Definition at line 677 of file kicad_git_common.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
inlinestaticinherited |
Definition at line 164 of file kicad_git_common.h.
Referenced by LIBGIT_BACKEND::Amend(), LIBGIT_BACKEND::Clone(), LIBGIT_BACKEND::Commit(), KIGIT::CompareRefs(), LIBGIT_BACKEND::CreateBranch(), credentials_cb(), ensureMergeDriverConfig(), LIBGIT_BACKEND::GetConfigString(), LIBGIT_BACKEND::GetCurrentBranchName(), getDefaultAuthorAndEmail(), GetDifferentFiles(), LIBGIT_BACKEND::GetFileStatus(), GetProjectDirs(), GetRemotename(), LIBGIT_BACKEND::GetRepositoryForFile(), LIBGIT_BACKEND::handleMerge(), LIBGIT_BACKEND::handleRebase(), HandleSSHAgentAuthentication(), HandleSSHKeyAuthentication(), LIBGIT_BACKEND::HasChangedFiles(), HasLocalCommits(), LIBGIT_BACKEND::hasUnstagedChanges(), LIBGIT_BACKEND::InitializeRepository(), DIALOG_GIT_REPOSITORY::OnTestClick(), LIBGIT_BACKEND::PerformFetch(), LIBGIT_BACKEND::Push(), LIBGIT_BACKEND::RebaseOntoUpstream(), KIGIT::RegisterMergeDriver(), LIBGIT_BACKEND::ResetToUpstream(), KIGIT::ResolveRefToTree(), setConfigIfMissing(), LIBGIT_BACKEND::SetupRemote(), and LIBGIT_BACKEND::SwitchToBranch().
|
inlineinherited |
Definition at line 140 of file kicad_git_common.h.
References m_nextPublicKey, and m_publicKeys.
Referenced by HandleSSHKeyAuthentication().
|
inherited |
Definition at line 158 of file kicad_git_common.cpp.
References KIPLATFORM::SECRETS::GetSecret(), GIT_CONN_LOCAL, m_connType, m_password, m_remote, m_secretFetched, and m_username.
Referenced by HandlePlaintextAuthentication(), and HandleSSHKeyAuthentication().
|
inherited |
Get the project directory path.
If a symlink-preserving path was set via SetProjectDir(), returns that path. Otherwise falls back to git_repository_workdir().
Definition at line 73 of file kicad_git_common.cpp.
References m_projectDir, and m_repo.
|
inherited |
Return a vector of project files in the repository.
Sorted by the depth of the project file in the directory tree
Definition at line 240 of file kicad_git_common.cpp.
References GetLastGitError(), m_repo, and traceGit.
|
inlineinherited |
Definition at line 156 of file kicad_git_common.h.
References m_remote.
Referenced by promptForGitCredentials().
|
inherited |
Definition at line 579 of file kicad_git_common.cpp.
References GetLastGitError(), m_repo, and traceGit.
Referenced by GetConnType(), GetRemoteNameOrDefault(), and UpdateCurrentBranchInfo().
|
inherited |
Returns GetRemotename() when non-empty, otherwise "origin".
Centralizes the fallback policy used by push/pull/fetch paths.
Definition at line 568 of file kicad_git_common.cpp.
References GetRemotename().
Referenced by GetUpstreamShorthand(), HasPushAndPullRemote(), lookup_upstream_ref(), PROJECT_TREE_PANE::onGitFetch(), LIBGIT_BACKEND::PerformFetch(), LIBGIT_BACKEND::PerformPull(), and LIBGIT_BACKEND::Push().
|
inherited |
Definition at line 67 of file kicad_git_common.cpp.
References m_repo.
Referenced by LIBGIT_BACKEND::AddToIndex(), LIBGIT_BACKEND::Amend(), LIBGIT_BACKEND::Commit(), PROJECT_TREE_PANE::onGitRemoteSettings(), LIBGIT_BACKEND::PerformAddToIndex(), LIBGIT_BACKEND::PerformRemoveFromIndex(), and LIBGIT_BACKEND::RemoveFromIndex().
|
inherited |
Returns the upstream shorthand for the current branch (e.g.
"origin/master"), or an empty string when there is no current branch.
Definition at line 90 of file kicad_git_common.cpp.
References GetRemoteNameOrDefault(), and m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), PROJECT_TREE_PANE::onGitPullProject(), and PROJECT_TREE_PANE::onGitPushProject().
|
inlineinherited |
Definition at line 92 of file kicad_git_common.h.
References m_username.
Referenced by promptForGitCredentials().
|
inherited |
Definition at line 921 of file kicad_git_common.cpp.
References GetPassword(), and m_testedTypes.
Referenced by credentials_cb().
|
inherited |
Definition at line 932 of file kicad_git_common.cpp.
References GetLastGitError(), KIGIT_CREDENTIAL_SSH_AGENT, m_testedTypes, and traceGit.
Referenced by HandleSSHKeyAuthentication().
|
inherited |
Definition at line 885 of file kicad_git_common.cpp.
References GetLastGitError(), GetNextPublicKey(), GetPassword(), HandleSSHAgentAuthentication(), KIGIT_CREDENTIAL_SSH_AGENT, m_testedTypes, and traceGit.
Referenced by credentials_cb().
|
inherited |
Definition at line 452 of file kicad_git_common.cpp.
References GetLastGitError(), m_repo, and traceGit.
Referenced by PROJECT_TREE_PANE::onRight().
|
inherited |
Definition at line 513 of file kicad_git_common.cpp.
References GetRemoteNameOrDefault(), m_repo, and traceGit.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PROJECT_TREE_PANE::onRight().
|
inlineinherited |
Definition at line 174 of file kicad_git_common.h.
References m_cancel.
Referenced by GetDifferentFiles(), PROJECT_TREE_PANE::gitStatusTimerHandler(), PROJECT_TREE_PANE::onGitSyncTimer(), progress_cb(), and transfer_progress_cb().
| CommitResult GIT_COMMIT_HANDLER::PerformAmend | ( | const std::vector< wxString > & | aFiles, |
| const wxString & | aMessage, | ||
| const wxString & | aAuthorName, | ||
| const wxString & | aAuthorEmail ) |
Definition at line 42 of file git_commit_handler.cpp.
References GIT_BACKEND::Amend(), and GetGitBackend().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PROJECT_TREE_PANE::onGitAmendCommit().
| CommitResult GIT_COMMIT_HANDLER::PerformCommit | ( | const std::vector< wxString > & | aFiles, |
| const wxString & | aMessage, | ||
| const wxString & | aAuthorName, | ||
| const wxString & | aAuthorEmail ) |
Definition at line 33 of file git_commit_handler.cpp.
References GIT_BACKEND::Commit(), and GetGitBackend().
Referenced by PROJECT_TREE_PANE::onGitCommit().
|
inlineinherited |
Definition at line 138 of file kicad_git_common.h.
References m_nextPublicKey.
Referenced by promptForGitCredentials().
|
inlineinherited |
Definition at line 186 of file kicad_git_common.h.
References m_authFailed.
Referenced by credentials_cb().
|
inlineinherited |
Definition at line 179 of file kicad_git_common.h.
References m_cancel.
Referenced by PROJECT_TREE_PANE::EmptyTreePrj(), KICAD_MANAGER_CONTROL::NewFromRepository(), LIBGIT_BACKEND::PerformFetch(), and LIBGIT_BACKEND::Push().
|
inlineinherited |
Definition at line 97 of file kicad_git_common.h.
References m_password, and m_secretFetched.
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), promptForGitCredentials(), and LIBGIT_BACKEND::SetupRemote().
|
inlineinherited |
Set the project directory path, preserving any symlinks in the path.
This is used to ensure git status paths match the paths used in the project tree.
Definition at line 130 of file kicad_git_common.h.
References m_projectDir.
|
inlineinherited |
Definition at line 148 of file kicad_git_common.h.
References m_password, m_remote, m_secretFetched, and updateConnectionType().
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), GIT_CLONE_HANDLER::SetRemote(), and LIBGIT_BACKEND::SetupRemote().
|
inlineinherited |
Definition at line 46 of file kicad_git_common.h.
References m_repo.
Referenced by LIBGIT_BACKEND::Clone(), and LIBGIT_BACKEND::InitializeRepository().
|
inherited |
Definition at line 666 of file kicad_git_common.cpp.
References m_publicKeys.
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), promptForGitCredentials(), LIBGIT_BACKEND::SetupRemote(), and updatePublicKeys().
|
inlineinherited |
Definition at line 96 of file kicad_git_common.h.
References m_secretFetched, and m_username.
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), promptForGitCredentials(), and LIBGIT_BACKEND::SetupRemote().
|
inlineinherited |
Definition at line 103 of file kicad_git_common.h.
References m_testedTypes.
Referenced by promptForGitCredentials().
|
privateinherited |
Definition at line 813 of file kicad_git_common.cpp.
References GIT_CONN_HTTPS, GIT_CONN_LOCAL, GIT_CONN_SSH, m_connType, m_hostname, m_password, m_remote, m_secretFetched, and m_username.
Referenced by PROJECT_TREE_PANE, SetRemote(), and UpdateCurrentBranchInfo().
|
inherited |
Definition at line 763 of file kicad_git_common.cpp.
References GetRemotename(), m_password, m_remote, m_repo, m_secretFetched, updateConnectionType(), and updatePublicKeys().
Referenced by PROJECT_TREE_PANE::onGitRemoteSettings().
|
privateinherited |
Definition at line 694 of file kicad_git_common.cpp.
References m_hostname, m_publicKeys, and SetSSHKey().
Referenced by PROJECT_TREE_PANE, and UpdateCurrentBranchInfo().
|
inlineinherited |
Definition at line 184 of file kicad_git_common.h.
References m_authFailed.
Referenced by PROJECT_TREE_PANE::onGitFetch(), PROJECT_TREE_PANE::onGitInitializeProject(), PROJECT_TREE_PANE::onGitPullProject(), and PROJECT_TREE_PANE::onGitPushProject().
|
friend |
Definition at line 53 of file git_commit_handler.h.
References AddErrorString(), and LIBGIT_BACKEND.
Referenced by LIBGIT_BACKEND.
|
staticprivateinherited |
Definition at line 224 of file kicad_git_common.h.
Referenced by HandleSSHAgentAuthentication(), and HandleSSHKeyAuthentication().
|
protectedinherited |
Definition at line 201 of file kicad_git_common.h.
Referenced by ClearAuthFailure(), SetAuthFailure(), and WasAuthFailure().
|
privateinherited |
Definition at line 220 of file kicad_git_common.h.
Referenced by IsCancelled(), and SetCancelled().
|
protectedinherited |
Definition at line 193 of file kicad_git_common.h.
Referenced by GetPassword(), KIGIT_COMMON(), KIGIT_COMMON(), and updateConnectionType().
|
private |
Definition at line 56 of file git_commit_handler.h.
Referenced by AddErrorString(), and GetErrorString().
|
protectedinherited |
Definition at line 203 of file kicad_git_common.h.
Referenced by LIBGIT_BACKEND::Clone(), PROJECT_TREE_PANE::EmptyTreePrj(), KIGIT_COMMON(), LIBGIT_BACKEND::PerformFetch(), LIBGIT_BACKEND::PerformPull(), LIBGIT_BACKEND::Push(), LIBGIT_BACKEND::RebaseOntoUpstream(), and LIBGIT_BACKEND::ResetToUpstream().
|
protectedinherited |
Definition at line 195 of file kicad_git_common.h.
Referenced by KIGIT_COMMON(), updateConnectionType(), and updatePublicKeys().
|
privateinherited |
Definition at line 217 of file kicad_git_common.h.
Referenced by GetNextPublicKey(), KIGIT_COMMON(), KIGIT_COMMON(), and ResetNextKey().
|
protectedinherited |
Definition at line 197 of file kicad_git_common.h.
Referenced by GetPassword(), KIGIT_COMMON(), SetPassword(), SetRemote(), updateConnectionType(), and UpdateCurrentBranchInfo().
|
protectedinherited |
Definition at line 191 of file kicad_git_common.h.
Referenced by GetProjectDir(), KIGIT_COMMON(), and SetProjectDir().
|
privateinherited |
Definition at line 216 of file kicad_git_common.h.
Referenced by GetNextPublicKey(), KIGIT_COMMON(), SetSSHKey(), and updatePublicKeys().
|
protectedinherited |
Definition at line 194 of file kicad_git_common.h.
Referenced by LIBGIT_BACKEND::Clone(), GetConnType(), GetPassword(), GetRemote(), KIGIT_COMMON(), SetRemote(), updateConnectionType(), and UpdateCurrentBranchInfo().
|
protectedinherited |
Definition at line 189 of file kicad_git_common.h.
Referenced by GetBranchNames(), GetCurrentBranchName(), GetDifferentFiles(), GetGitRootDirectory(), GetProjectDir(), GetProjectDirs(), GetRemotename(), GetRepo(), GetUpstreamShorthand(), HasLocalCommits(), HasPushAndPullRemote(), KIGIT_COMMON(), KIGIT_COMMON(), SetRepo(), and UpdateCurrentBranchInfo().
|
privateinherited |
Definition at line 218 of file kicad_git_common.h.
Referenced by GetPassword(), KIGIT_COMMON(), KIGIT_COMMON(), SetPassword(), SetRemote(), SetUsername(), updateConnectionType(), and UpdateCurrentBranchInfo().
|
protectedinherited |
Definition at line 199 of file kicad_git_common.h.
Referenced by HandlePlaintextAuthentication(), HandleSSHAgentAuthentication(), HandleSSHKeyAuthentication(), KIGIT_COMMON(), KIGIT_COMMON(), and TestedTypes().
|
protectedinherited |
Definition at line 196 of file kicad_git_common.h.
Referenced by GetPassword(), GetUsername(), KIGIT_COMMON(), SetUsername(), and updateConnectionType().