KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
KIGIT_COMMON Class Reference

#include <kicad_git_common.h>

Inheritance diagram for KIGIT_COMMON:
GIT_COMMIT_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)
 

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
 

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
 

Detailed Description

Definition at line 35 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 83 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 69 of file kicad_git_common.h.

Constructor & Destructor Documentation

◆ KIGIT_COMMON() [1/2]

KIGIT_COMMON::KIGIT_COMMON ( git_repository *  aRepo)

Definition at line 41 of file kicad_git_common.cpp.

◆ KIGIT_COMMON() [2/2]

KIGIT_COMMON::KIGIT_COMMON ( const KIGIT_COMMON aOther)

Definition at line 46 of file kicad_git_common.cpp.

◆ ~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

◆ 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.

Referenced by KIGIT_REPO_MIXIN::GetCurrentBranchName().

◆ 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.

Referenced by KIGIT_REPO_MIXIN::GetDifferentFiles(), and PROJECT_TREE_PANE::updateGitStatusIconMap().

◆ GetGitRootDirectory()

wxString KIGIT_COMMON::GetGitRootDirectory ( ) const

Definition at line 558 of file kicad_git_common.cpp.

References m_repo, and path.

Referenced by KIGIT_REPO_MIXIN::GetGitRootDirectory(), and PROJECT_TREE_PANE::onRight().

◆ GetLastGitError()

◆ GetNextPublicKey()

wxString KIGIT_COMMON::GetNextPublicKey ( )
inline

◆ GetPassword()

wxString KIGIT_COMMON::GetPassword ( ) const
inline

◆ 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.

Referenced by KIGIT_REPO_MIXIN::GetProjectDirs().

◆ GetRemotename()

wxString KIGIT_COMMON::GetRemotename ( ) const

◆ GetRepo()

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

◆ GetUsername()

wxString KIGIT_COMMON::GetUsername ( ) const
inline

Definition at line 91 of file kicad_git_common.h.

References m_username.

Referenced by KIGIT_REPO_MIXIN::GetUsername().

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

◆ ResetNextKey()

void KIGIT_COMMON::ResetNextKey ( )
inline

Definition at line 117 of file kicad_git_common.h.

References m_nextPublicKey.

Referenced by KIGIT_REPO_MIXIN::ResetNextKey().

◆ SetPassword()

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

◆ SetRemote()

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

Definition at line 127 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 45 of file kicad_git_common.h.

References m_repo.

Referenced by GIT_CLONE_HANDLER::PerformClone().

◆ SetSSHKey()

◆ SetUsername()

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

◆ TestedTypes()

unsigned & KIGIT_COMMON::TestedTypes ( )
inline

Definition at line 102 of file kicad_git_common.h.

References m_testedTypes.

Referenced by KIGIT_REPO_MIXIN::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 UpdateCurrentBranchInfo().

Friends And Related Function Documentation

◆ GIT_CLONE_HANDLER

friend class GIT_CLONE_HANDLER
friend

Definition at line 165 of file kicad_git_common.h.

◆ GIT_PULL_HANDLER

friend class GIT_PULL_HANDLER
friend

Definition at line 164 of file kicad_git_common.h.

◆ GIT_PUSH_HANDLER

friend class GIT_PUSH_HANDLER
friend

Definition at line 163 of file kicad_git_common.h.

Member Data Documentation

◆ KIGIT_CREDENTIAL_SSH_AGENT

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

Definition at line 176 of file kicad_git_common.h.

Referenced by HandleSSHAgentAuthentication(), and HandleSSHKeyAuthentication().

◆ m_connType

GIT_CONN_TYPE KIGIT_COMMON::m_connType
protected

Definition at line 152 of file kicad_git_common.h.

Referenced by updateConnectionType().

◆ m_gitActionMutex

std::mutex KIGIT_COMMON::m_gitActionMutex
protected

Definition at line 160 of file kicad_git_common.h.

◆ m_hostname

wxString KIGIT_COMMON::m_hostname
protected

Definition at line 154 of file kicad_git_common.h.

Referenced by updateConnectionType(), and updatePublicKeys().

◆ m_nextPublicKey

int KIGIT_COMMON::m_nextPublicKey
private

Definition at line 172 of file kicad_git_common.h.

Referenced by GetNextPublicKey(), and ResetNextKey().

◆ m_password

wxString KIGIT_COMMON::m_password
protected

◆ m_publicKeys

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

Definition at line 171 of file kicad_git_common.h.

Referenced by GetNextPublicKey(), 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: