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

#include <kicad_git_common.h>

Inheritance diagram for KIGIT_COMMON:
GIT_ADD_TO_INDEX_HANDLER GIT_COMMIT_HANDLER GIT_REMOVE_FROM_INDEX_HANDLER

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 LIBGIT_BACKEND
 
class PROJECT_TREE_PANE
 

Detailed Description

Definition at line 39 of file kicad_git_common.h.

Member Enumeration Documentation

◆ GIT_CONN_TYPE

enum class KIGIT_COMMON::GIT_CONN_TYPE
strong
Enumerator
GIT_CONN_HTTPS 
GIT_CONN_SSH 
GIT_CONN_LOCAL 
GIT_CONN_LAST 

Definition at line 87 of file kicad_git_common.h.

◆ GIT_STATUS

enum class KIGIT_COMMON::GIT_STATUS
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 73 of file kicad_git_common.h.

Constructor & Destructor Documentation

◆ KIGIT_COMMON() [1/2]

◆ KIGIT_COMMON() [2/2]

KIGIT_COMMON::KIGIT_COMMON ( const KIGIT_COMMON & aOther)

◆ ~KIGIT_COMMON()

KIGIT_COMMON::~KIGIT_COMMON ( )

Definition at line 62 of file kicad_git_common.cpp.

Member Function Documentation

◆ GetBranchNames()

std::vector< wxString > KIGIT_COMMON::GetBranchNames ( ) const

Definition at line 103 of file kicad_git_common.cpp.

References m_repo, and traceGit.

◆ GetConnType()

KIGIT_COMMON::GIT_CONN_TYPE KIGIT_COMMON::GetConnType ( ) const

◆ GetCurrentBranchName()

wxString KIGIT_COMMON::GetCurrentBranchName ( ) const

Definition at line 71 of file kicad_git_common.cpp.

References m_repo, and traceGit.

◆ GetDifferentFiles()

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.

◆ GetGitRootDirectory()

wxString KIGIT_COMMON::GetGitRootDirectory ( ) const

Definition at line 558 of file kicad_git_common.cpp.

References m_repo, and path.

Referenced by PROJECT_TREE_PANE::onRight().

◆ GetLastGitError()

◆ GetNextPublicKey()

wxString KIGIT_COMMON::GetNextPublicKey ( )
inline

Definition at line 123 of file kicad_git_common.h.

References m_nextPublicKey, and m_publicKeys.

Referenced by HandleSSHKeyAuthentication().

◆ GetPassword()

wxString KIGIT_COMMON::GetPassword ( ) const
inline

Definition at line 96 of file kicad_git_common.h.

References m_password.

Referenced by HandlePlaintextAuthentication(), and HandleSSHKeyAuthentication().

◆ GetProjectDirs()

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

Returns
std::vector<wxString> of project files

Definition at line 166 of file kicad_git_common.cpp.

References GetLastGitError(), m_repo, and traceGit.

◆ GetRemotename()

wxString KIGIT_COMMON::GetRemotename ( ) const

Definition at line 477 of file kicad_git_common.cpp.

References GetLastGitError(), m_repo, and traceGit.

Referenced by GetConnType(), and UpdateCurrentBranchInfo().

◆ GetRepo()

◆ GetUsername()

wxString KIGIT_COMMON::GetUsername ( ) const
inline

Definition at line 95 of file kicad_git_common.h.

References m_username.

◆ HandlePlaintextAuthentication()

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().

◆ HandleSSHAgentAuthentication()

int KIGIT_COMMON::HandleSSHAgentAuthentication ( git_cred ** aOut,
const wxString & aUsername )

◆ HandleSSHKeyAuthentication()

int KIGIT_COMMON::HandleSSHKeyAuthentication ( git_cred ** aOut,
const wxString & aUsername )

◆ HasLocalCommits()

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().

◆ HasPushAndPullRemote()

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().

◆ IsCancelled()

bool KIGIT_COMMON::IsCancelled ( ) const
inline

Definition at line 153 of file kicad_git_common.h.

References m_cancel.

Referenced by progress_cb(), and transfer_progress_cb().

◆ ResetNextKey()

void KIGIT_COMMON::ResetNextKey ( )
inline

Definition at line 121 of file kicad_git_common.h.

References m_nextPublicKey.

◆ SetCancelled()

void KIGIT_COMMON::SetCancelled ( bool aCancel)
inline

Definition at line 158 of file kicad_git_common.h.

References m_cancel.

Referenced by LIBGIT_BACKEND::PerformFetch(), and LIBGIT_BACKEND::Push().

◆ SetPassword()

void KIGIT_COMMON::SetPassword ( const wxString & aPassword)
inline

Definition at line 100 of file kicad_git_common.h.

References m_password.

Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), and LIBGIT_BACKEND::SetupRemote().

◆ SetRemote()

void KIGIT_COMMON::SetRemote ( const wxString & aRemote)
inline

Definition at line 131 of file kicad_git_common.h.

References m_remote, and updateConnectionType().

Referenced by DIALOG_GIT_REPOSITORY::OnTestClick().

◆ SetRepo()

void KIGIT_COMMON::SetRepo ( git_repository * aRepo)
inline

Definition at line 49 of file kicad_git_common.h.

References m_repo.

Referenced by LIBGIT_BACKEND::Clone(), and LIBGIT_BACKEND::InitializeRepository().

◆ SetSSHKey()

void KIGIT_COMMON::SetSSHKey ( const wxString & aSSHKey)

◆ SetUsername()

void KIGIT_COMMON::SetUsername ( const wxString & aUsername)
inline

Definition at line 99 of file kicad_git_common.h.

References m_username.

Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), and LIBGIT_BACKEND::SetupRemote().

◆ TestedTypes()

unsigned & KIGIT_COMMON::TestedTypes ( )
inline

Definition at line 106 of file kicad_git_common.h.

References m_testedTypes.

◆ updateConnectionType()

void KIGIT_COMMON::updateConnectionType ( )
private

◆ UpdateCurrentBranchInfo()

void KIGIT_COMMON::UpdateCurrentBranchInfo ( )

◆ updatePublicKeys()

void KIGIT_COMMON::updatePublicKeys ( )
private

Definition at line 569 of file kicad_git_common.cpp.

References m_hostname, m_publicKeys, and SetSSHKey().

Referenced by PROJECT_TREE_PANE, and UpdateCurrentBranchInfo().

Friends And Related Symbol Documentation

◆ GIT_CLONE_HANDLER

friend class GIT_CLONE_HANDLER
friend

Definition at line 179 of file kicad_git_common.h.

References GIT_CLONE_HANDLER.

Referenced by GIT_CLONE_HANDLER.

◆ GIT_PULL_HANDLER

friend class GIT_PULL_HANDLER
friend

Definition at line 178 of file kicad_git_common.h.

References GIT_PULL_HANDLER.

Referenced by GIT_PULL_HANDLER.

◆ GIT_PUSH_HANDLER

friend class GIT_PUSH_HANDLER
friend

Definition at line 177 of file kicad_git_common.h.

References GIT_PUSH_HANDLER.

Referenced by GIT_PUSH_HANDLER.

◆ LIBGIT_BACKEND

friend class LIBGIT_BACKEND
friend

Definition at line 180 of file kicad_git_common.h.

References LIBGIT_BACKEND.

Referenced by LIBGIT_BACKEND.

◆ PROJECT_TREE_PANE

friend class PROJECT_TREE_PANE
friend

Definition at line 181 of file kicad_git_common.h.

References PROJECT_TREE_PANE, updateConnectionType(), and updatePublicKeys().

Referenced by PROJECT_TREE_PANE.

Member Data Documentation

◆ KIGIT_CREDENTIAL_SSH_AGENT

const unsigned KIGIT_COMMON::KIGIT_CREDENTIAL_SSH_AGENT = 1 << sizeof( m_testedTypes - 1 )
staticprivate

Definition at line 194 of file kicad_git_common.h.

Referenced by HandleSSHAgentAuthentication(), and HandleSSHKeyAuthentication().

◆ m_cancel

std::atomic<bool> KIGIT_COMMON::m_cancel
private

Definition at line 190 of file kicad_git_common.h.

Referenced by IsCancelled(), and SetCancelled().

◆ m_connType

GIT_CONN_TYPE KIGIT_COMMON::m_connType
protected

Definition at line 166 of file kicad_git_common.h.

Referenced by KIGIT_COMMON(), KIGIT_COMMON(), and updateConnectionType().

◆ m_gitActionMutex

std::mutex KIGIT_COMMON::m_gitActionMutex
protected

◆ m_hostname

wxString KIGIT_COMMON::m_hostname
protected

Definition at line 168 of file kicad_git_common.h.

Referenced by KIGIT_COMMON(), updateConnectionType(), and updatePublicKeys().

◆ m_nextPublicKey

int KIGIT_COMMON::m_nextPublicKey
private

Definition at line 188 of file kicad_git_common.h.

Referenced by GetNextPublicKey(), KIGIT_COMMON(), KIGIT_COMMON(), and ResetNextKey().

◆ m_password

wxString KIGIT_COMMON::m_password
protected

◆ m_publicKeys

std::vector<wxString> KIGIT_COMMON::m_publicKeys
private

Definition at line 187 of file kicad_git_common.h.

Referenced by GetNextPublicKey(), KIGIT_COMMON(), SetSSHKey(), and updatePublicKeys().

◆ m_remote

◆ m_repo

◆ m_testedTypes

unsigned KIGIT_COMMON::m_testedTypes
protected

◆ m_username

wxString KIGIT_COMMON::m_username
protected

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