KiCad PCB EDA Suite
|
#include <kicad_git_common.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 | |
KIGIT_COMMON (git_repository *aRepo) | |
KIGIT_COMMON (const KIGIT_COMMON &aOther) | |
~KIGIT_COMMON () | |
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 () const |
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 |
void | ResetNextKey () |
wxString | GetNextPublicKey () |
void | SetRemote (const wxString &aRemote) |
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) |
Static Public Member Functions | |
static wxString | GetLastGitError () |
Protected Attributes | |
git_repository * | m_repo |
GIT_CONN_TYPE | m_connType |
wxString | m_remote |
wxString | m_hostname |
wxString | m_username |
wxString | m_password |
unsigned | m_testedTypes |
std::mutex | m_gitActionMutex |
Private Member Functions | |
void | updatePublicKeys () |
void | updateConnectionType () |
Private Attributes | |
std::vector< wxString > | m_publicKeys |
int | m_nextPublicKey |
std::atomic< bool > | m_cancel |
Static Private Attributes | |
static const unsigned | KIGIT_CREDENTIAL_SSH_AGENT = 1 << sizeof( m_testedTypes - 1 ) |
Friends | |
class | GIT_PUSH_HANDLER |
class | GIT_PULL_HANDLER |
class | GIT_CLONE_HANDLER |
class | PROJECT_TREE_PANE |
Definition at line 36 of file kicad_git_common.h.
|
strong |
Enumerator | |
---|---|
GIT_CONN_HTTPS | |
GIT_CONN_SSH | |
GIT_CONN_LOCAL | |
GIT_CONN_LAST |
Definition at line 84 of file kicad_git_common.h.
|
strong |
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.
KIGIT_COMMON::KIGIT_COMMON | ( | git_repository * | aRepo | ) |
Definition at line 41 of file kicad_git_common.cpp.
KIGIT_COMMON::KIGIT_COMMON | ( | const KIGIT_COMMON & | aOther | ) |
Definition at line 46 of file kicad_git_common.cpp.
KIGIT_COMMON::~KIGIT_COMMON | ( | ) |
Definition at line 62 of file kicad_git_common.cpp.
std::vector< wxString > KIGIT_COMMON::GetBranchNames | ( | ) | const |
Definition at line 103 of file kicad_git_common.cpp.
References m_repo, and traceGit.
Referenced by KIGIT_REPO_MIXIN::GetBranchNames(), PROJECT_TREE_PANE::onGitSwitchBranch(), and PROJECT_TREE_PANE::onRight().
KIGIT_COMMON::GIT_CONN_TYPE KIGIT_COMMON::GetConnType | ( | ) | const |
Definition at line 665 of file kicad_git_common.cpp.
References GetRemotename(), GIT_CONN_HTTPS, GIT_CONN_LOCAL, GIT_CONN_SSH, and m_remote.
Referenced by KIGIT_REPO_MIXIN::GetConnType().
wxString KIGIT_COMMON::GetCurrentBranchName | ( | ) | const |
Definition at line 71 of file kicad_git_common.cpp.
References m_repo, and traceGit.
Referenced by KIGIT_REPO_MIXIN::GetCurrentBranchName().
std::pair< std::set< wxString >, std::set< wxString > > KIGIT_COMMON::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.
Definition at line 234 of file kicad_git_common.cpp.
References delta, GetLastGitError(), m_repo, and traceGit.
Referenced by KIGIT_REPO_MIXIN::GetDifferentFiles(), and PROJECT_TREE_PANE::updateGitStatusIconMap().
wxString KIGIT_COMMON::GetGitRootDirectory | ( | ) | const |
Definition at line 558 of file kicad_git_common.cpp.
Referenced by KIGIT_REPO_MIXIN::GetGitRootDirectory(), and PROJECT_TREE_PANE::onRight().
|
inlinestatic |
Definition at line 140 of file kicad_git_common.h.
Referenced by KIGIT::PROJECT_GIT_UTILS::CreateBranch(), credentials_cb(), GIT_CONFIG_HANDLER::GetConfigString(), GIT_STATUS_HANDLER::GetCurrentBranchName(), getDefaultAuthorAndEmail(), GetDifferentFiles(), GIT_STATUS_HANDLER::GetFileStatus(), GetProjectDirs(), GetRemotename(), KIGIT::PROJECT_GIT_UTILS::GetRepositoryForFile(), GIT_PULL_HANDLER::handleRebase(), HandleSSHAgentAuthentication(), HandleSSHKeyAuthentication(), GIT_STATUS_HANDLER::HasChangedFiles(), HasLocalCommits(), GIT_INIT_HANDLER::InitializeRepository(), KIGIT_PCB_MERGE::Merge(), DIALOG_GIT_REPOSITORY::OnTestClick(), GIT_COMMIT_HANDLER::PerformCommit(), GIT_PULL_HANDLER::PerformFetch(), GIT_PUSH_HANDLER::PerformPush(), GIT_INIT_HANDLER::SetupRemote(), and GIT_BRANCH_HANDLER::SwitchToBranch().
|
inline |
Definition at line 120 of file kicad_git_common.h.
References m_nextPublicKey, and m_publicKeys.
Referenced by KIGIT_REPO_MIXIN::GetNextPublicKey(), and HandleSSHKeyAuthentication().
|
inline |
Definition at line 93 of file kicad_git_common.h.
References m_password.
Referenced by KIGIT_REPO_MIXIN::GetPassword(), HandlePlaintextAuthentication(), and HandleSSHKeyAuthentication().
std::vector< wxString > KIGIT_COMMON::GetProjectDirs | ( | ) |
Return a vector of project files in the repository.
Sorted by the depth of the project file in the directory tree
Definition at line 166 of file kicad_git_common.cpp.
References GetLastGitError(), m_repo, and traceGit.
Referenced by KIGIT_REPO_MIXIN::GetProjectDirs().
wxString KIGIT_COMMON::GetRemotename | ( | ) | const |
Definition at line 477 of file kicad_git_common.cpp.
References GetLastGitError(), m_repo, and traceGit.
Referenced by GetConnType(), KIGIT_REPO_MIXIN::GetRemotename(), and UpdateCurrentBranchInfo().
git_repository * KIGIT_COMMON::GetRepo | ( | ) | const |
Definition at line 66 of file kicad_git_common.cpp.
References m_repo.
Referenced by KIGIT_REPO_MIXIN::GetRepo(), and GIT_COMMIT_HANDLER::PerformCommit().
|
inline |
Definition at line 92 of file kicad_git_common.h.
References m_username.
Referenced by KIGIT_REPO_MIXIN::GetUsername().
int KIGIT_COMMON::HandlePlaintextAuthentication | ( | git_cred ** | aOut, |
const wxString & | aUsername | ||
) |
Definition at line 786 of file kicad_git_common.cpp.
References GetPassword(), and m_testedTypes.
Referenced by credentials_cb().
int KIGIT_COMMON::HandleSSHAgentAuthentication | ( | git_cred ** | aOut, |
const wxString & | aUsername | ||
) |
Definition at line 796 of file kicad_git_common.cpp.
References GetLastGitError(), KIGIT_CREDENTIAL_SSH_AGENT, m_testedTypes, and traceGit.
Referenced by HandleSSHKeyAuthentication().
int KIGIT_COMMON::HandleSSHKeyAuthentication | ( | git_cred ** | aOut, |
const wxString & | aUsername | ||
) |
Definition at line 754 of file kicad_git_common.cpp.
References GetLastGitError(), GetNextPublicKey(), GetPassword(), HandleSSHAgentAuthentication(), KIGIT_CREDENTIAL_SSH_AGENT, m_testedTypes, and traceGit.
Referenced by credentials_cb().
bool KIGIT_COMMON::HasLocalCommits | ( | ) | const |
Definition at line 388 of file kicad_git_common.cpp.
References GetLastGitError(), m_repo, and traceGit.
Referenced by PROJECT_TREE_PANE::onRight().
bool KIGIT_COMMON::HasPushAndPullRemote | ( | ) | const |
Definition at line 449 of file kicad_git_common.cpp.
References m_repo, and traceGit.
Referenced by PROJECT_TREE_PANE::onRight().
|
inline |
Definition at line 150 of file kicad_git_common.h.
References m_cancel.
Referenced by progress_cb(), and transfer_progress_cb().
|
inline |
Definition at line 118 of file kicad_git_common.h.
References m_nextPublicKey.
Referenced by KIGIT_REPO_MIXIN::ResetNextKey().
|
inline |
Definition at line 155 of file kicad_git_common.h.
References m_cancel.
Referenced by PROJECT_TREE_PANE::EmptyTreePrj(), GIT_PULL_HANDLER::PerformFetch(), and GIT_PUSH_HANDLER::PerformPush().
|
inline |
Definition at line 97 of file kicad_git_common.h.
References m_password.
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), KIGIT_REPO_MIXIN::SetPassword(), and GIT_INIT_HANDLER::SetupRemote().
|
inline |
Definition at line 128 of file kicad_git_common.h.
References m_remote, and updateConnectionType().
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick().
|
inline |
Definition at line 46 of file kicad_git_common.h.
References m_repo.
Referenced by GIT_INIT_HANDLER::InitializeRepository(), and GIT_CLONE_HANDLER::PerformClone().
void KIGIT_COMMON::SetSSHKey | ( | const wxString & | aSSHKey | ) |
Definition at line 547 of file kicad_git_common.cpp.
References m_publicKeys.
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), PROJECT_TREE_PANE::ReCreateTreePrj(), KIGIT_REPO_MIXIN::SetSSHKey(), GIT_INIT_HANDLER::SetupRemote(), and updatePublicKeys().
|
inline |
Definition at line 96 of file kicad_git_common.h.
References m_username.
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), PROJECT_TREE_PANE::ReCreateTreePrj(), GIT_INIT_HANDLER::SetupRemote(), and KIGIT_REPO_MIXIN::SetUsername().
|
inline |
Definition at line 103 of file kicad_git_common.h.
References m_testedTypes.
Referenced by KIGIT_REPO_MIXIN::TestedTypes().
|
private |
Definition at line 685 of file kicad_git_common.cpp.
References GIT_CONN_HTTPS, GIT_CONN_LOCAL, GIT_CONN_SSH, m_connType, m_hostname, m_password, m_remote, and m_username.
Referenced by SetRemote(), and UpdateCurrentBranchInfo().
void KIGIT_COMMON::UpdateCurrentBranchInfo | ( | ) |
Definition at line 638 of file kicad_git_common.cpp.
References GetRemotename(), KIPLATFORM::SECRETS::GetSecret(), m_password, m_remote, m_repo, m_username, updateConnectionType(), and updatePublicKeys().
Referenced by PROJECT_TREE_PANE::ReCreateTreePrj().
|
private |
Definition at line 569 of file kicad_git_common.cpp.
References m_hostname, m_publicKeys, and SetSSHKey().
Referenced by UpdateCurrentBranchInfo().
|
friend |
Definition at line 176 of file kicad_git_common.h.
|
friend |
Definition at line 175 of file kicad_git_common.h.
|
friend |
Definition at line 174 of file kicad_git_common.h.
|
friend |
Definition at line 177 of file kicad_git_common.h.
|
staticprivate |
Definition at line 190 of file kicad_git_common.h.
Referenced by HandleSSHAgentAuthentication(), and HandleSSHKeyAuthentication().
|
private |
Definition at line 186 of file kicad_git_common.h.
Referenced by IsCancelled(), and SetCancelled().
|
protected |
Definition at line 163 of file kicad_git_common.h.
Referenced by updateConnectionType().
|
protected |
Definition at line 171 of file kicad_git_common.h.
Referenced by PROJECT_TREE_PANE::EmptyTreePrj().
|
protected |
Definition at line 165 of file kicad_git_common.h.
Referenced by updateConnectionType(), and updatePublicKeys().
|
private |
Definition at line 184 of file kicad_git_common.h.
Referenced by GetNextPublicKey(), and ResetNextKey().
|
protected |
Definition at line 167 of file kicad_git_common.h.
Referenced by GetPassword(), SetPassword(), updateConnectionType(), and UpdateCurrentBranchInfo().
|
private |
Definition at line 183 of file kicad_git_common.h.
Referenced by GetNextPublicKey(), SetSSHKey(), and updatePublicKeys().
|
protected |
Definition at line 164 of file kicad_git_common.h.
Referenced by GetConnType(), GIT_CLONE_HANDLER::PerformClone(), GIT_CLONE_HANDLER::SetRemote(), SetRemote(), updateConnectionType(), and UpdateCurrentBranchInfo().
|
protected |
Definition at line 161 of file kicad_git_common.h.
Referenced by GetBranchNames(), GetCurrentBranchName(), GetDifferentFiles(), GetGitRootDirectory(), GetProjectDirs(), GetRemotename(), GetRepo(), HasLocalCommits(), HasPushAndPullRemote(), SetRepo(), and UpdateCurrentBranchInfo().
|
protected |
Definition at line 169 of file kicad_git_common.h.
Referenced by HandlePlaintextAuthentication(), HandleSSHAgentAuthentication(), HandleSSHKeyAuthentication(), and TestedTypes().
|
protected |
Definition at line 166 of file kicad_git_common.h.
Referenced by GetUsername(), SetUsername(), updateConnectionType(), and UpdateCurrentBranchInfo().