KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kigit_pcb_merge.h
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#ifndef KIGIT_PCB_MERGE_H
21#define KIGIT_PCB_MERGE_H
22#include <git2.h>
23#include <git2/sys/merge.h>
24
25#include <wx/string.h>
26
27#include <board.h>
28
30{
31 std::vector<BOARD_ITEM*> m_added;
32 std::vector<BOARD_ITEM*> m_removed;
33 std::vector<BOARD_ITEM*> m_changed;
35
37{
38 public:
39 KIGIT_PCB_MERGE( git_merge_driver_source* aSource, git_buf* aBuf ) : m_mergeDriver( aSource ), m_result( aBuf )
40 {}
41
42 virtual ~KIGIT_PCB_MERGE() = default;
43
44 int Merge();
45
51 static int Apply( const git_merge_driver_source* aSrc, const char** aPathOut,
52 unsigned int* aModeOut, git_buf* aMergedOut );
53
54 std::set<BOARD_ITEM*>& GetWeModifiedTheyDeleted()
55 {
57 }
58
59 std::set<BOARD_ITEM*>& GetTheyModifiedWeDeleted()
60 {
62 }
63
64 std::set<BOARD_ITEM*>& GetBothModified()
65 {
66 return both_modified;
67 }
68
69 protected:
71 void findSetDifferences( const BOARD_ITEM_SET& aAncestorSet, const BOARD_ITEM_SET& aOtherSet,
72 std::vector<BOARD_ITEM*>& aAdded, std::vector<BOARD_ITEM*>& aRemoved,
73 std::vector<BOARD_ITEM*>& aChanged );
74
75 private:
76
77 git_merge_driver_source* m_mergeDriver;
78 git_buf* m_result;
79
80 std::set<BOARD_ITEM*> we_modified_they_deleted;
81 std::set<BOARD_ITEM*> they_modified_we_deleted;
82 std::set<BOARD_ITEM*> both_modified;
83};
84
85
86
87#endif // KIGIT_PCB_MERGE_H
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
Definition board.h:356
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
std::set< BOARD_ITEM * > both_modified
void findSetDifferences(const BOARD_ITEM_SET &aAncestorSet, const BOARD_ITEM_SET &aOtherSet, std::vector< BOARD_ITEM * > &aAdded, std::vector< BOARD_ITEM * > &aRemoved, std::vector< BOARD_ITEM * > &aChanged)
std::set< BOARD_ITEM * > & GetWeModifiedTheyDeleted()
git_merge_driver_source * m_mergeDriver
KIGIT_PCB_MERGE_DIFFERENCES compareBoards(BOARD *aAncestor, BOARD *aOther)
KIGIT_PCB_MERGE(git_merge_driver_source *aSource, git_buf *aBuf)
std::set< BOARD_ITEM * > & GetBothModified()
virtual ~KIGIT_PCB_MERGE()=default
std::set< BOARD_ITEM * > they_modified_we_deleted
static int Apply(const git_merge_driver_source *aSrc, const char **aPathOut, unsigned int *aModeOut, git_buf *aMergedOut)
libgit2 merge-driver apply callback shim.
std::set< BOARD_ITEM * > we_modified_they_deleted
std::set< BOARD_ITEM * > & GetTheyModifiedWeDeleted()
std::vector< BOARD_ITEM * > m_removed
std::vector< BOARD_ITEM * > m_changed
std::vector< BOARD_ITEM * > m_added