KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kicad_git_errors.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#include "config.h"
21
24#include <git/kigit_failure.h>
25
26
27void KIGIT_ERRORS::AddError( const wxString& aSummary, const wxString& aDetails )
28{
29 m_errorStrings.emplace_back( KIGIT::StripEmbeddedUserinfo( aSummary ) );
30 m_errorDetails.emplace_back( KIGIT::StripEmbeddedUserinfo( aDetails ) );
31}
32
33
34void KIGIT_ERRORS::AddGitError( const wxString& aSummary )
35{
37}
38
39
40// None of these values are currently used, but Seth says they may be used in the future,
41// so for now, just surpress the warning that is generated by the fact they exist and aren't
42// used anywhere.
43#ifdef HAVE_WUNUSED_CONST_VARIABLE
44 _Pragma( "GCC diagnostic push" ) \
45 _Pragma( "GCC diagnostic ignored \"-Wunused-const-variable\"" )
46#endif
47
48namespace KIGIT_ERROR
49{
50#undef _
51#define _(a) a
52
53// General errors
54const char* const kInvalidRepository = _( "Invalid repository." );
55const char* const kCommitFailed = _( "Failed to commit changes." );
56const char* const kMergeFailed = _( "Failed to merge branches." );
57
58// Clone errors
59const char* const kCloneFailed = _( "Failed to clone repository." );
60const char* const kRemoteNotFound = _( "Remote repository not found." );
61const char* const kAuthenticationFailed = _( "Authentication failed for remote repository." );
62
63// Branch errors
64const char* const kBranchNotFound = _( "Branch not found." );
65const char* const kBranchCreationFailed = _( "Failed to create branch." );
66const char* const kBranchDeletionFailed = _( "Failed to delete branch." );
67
68// Checkout errors
69const char* const kCheckoutFailed = _( "Failed to perform checkout operation." );
70const char* const kFileNotFoundInCheckout = _( "File not found during checkout operation." );
71
72// Conflict errors
73const char* const kMergeConflict = _( "Merge conflict encountered." );
74const char* const kRebaseConflict = _( "Rebase conflict encountered." );
75
76// Pull/Push errors
77const char* const kPullFailed = _( "Failed to pull changes from remote repository." );
78const char* const kPushFailed = _( "Failed to push changes to remote repository." );
79const char* const kNoUpstreamBranch = _( "No upstream branch configured." );
80const char* const kRemoteConnectionError =
81 _( "Failed to establish connection with remote repository." );
82
83// Tag errors
84const char* const kTagNotFound = _( "Tag not found." );
85const char* const kTagCreationFailed = _( "Failed to create tag." );
86const char* const kTagDeletionFailed = _( "Failed to delete tag." );
87
88const char* const kUnknownError = _( "Unknown error." );
89const char* const kNoError = _( "No error." );
90}
91
92#ifdef HAVE_WUNUSED_CONST_VARIABLE
93 _Pragma( "GCC diagnostic pop" )
94#endif
static wxString GetLastGitError()
libgit2's last message, without credentials from any URL it quotes, so it is safe to show or trace.
void AddError(const wxString &aSummary, const wxString &aDetails)
A summary the user can act on, with the raw text that explains it kept apart for the details.
void AddGitError(const wxString &aSummary)
Queue the summary with libgit2's last error as its details.
std::vector< wxString > m_errorDetails
One per entry in m_errorStrings.
std::vector< wxString > m_errorStrings
#define _(s)
const char *const kRemoteNotFound
const char *const kCommitFailed
const char *const kInvalidRepository
const char *const kBranchCreationFailed
const char *const kRebaseConflict
const char *const kFileNotFoundInCheckout
const char *const kTagCreationFailed
const char *const kCloneFailed
const char *const kCheckoutFailed
const char *const kPullFailed
const char *const kMergeConflict
const char *const kNoError
const char *const kPushFailed
const char *const kTagDeletionFailed
const char *const kMergeFailed
const char *const kTagNotFound
const char *const kRemoteConnectionError
const char *const kBranchDeletionFailed
const char *const kAuthenticationFailed
const char *const kBranchNotFound
const char *const kUnknownError
const char *const kNoUpstreamBranch
APIEXPORT wxString StripEmbeddedUserinfo(const wxString &aText)
Remove the user and password from every URL quoted in a message, since the remote's can carry a passw...