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 (C) 2023 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, you may find one here:
18 * http://www.gnu.org/licenses/gpl-3.0.html
19 * or you may search the http://www.gnu.org website for the version 3 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef KIGIT_PCB_MERGE_H
25#define KIGIT_PCB_MERGE_H
26#include <git2.h>
27#include <git2/sys/merge.h>
28
29#include <memory>
30#include <wx/string.h>
31
32#include <board.h>
33
35{
36 std::vector<BOARD_ITEM*> m_added;
37 std::vector<BOARD_ITEM*> m_removed;
38 std::vector<BOARD_ITEM*> m_changed;
40
42{
43 public:
44 KIGIT_PCB_MERGE( git_merge_driver_source* aSource, git_buf* aBuf ) : m_mergeDriver( aSource ), m_result( aBuf )
45 {}
46
48
49 int Merge();
50
51 std::set<BOARD_ITEM*>& GetWeModifiedTheyDeleted()
52 {
54 }
55
56 std::set<BOARD_ITEM*>& GetTheyModifiedWeDeleted()
57 {
59 }
60
61 std::set<BOARD_ITEM*>& GetBothModified()
62 {
63 return both_modified;
64 }
65
66 protected:
67 std::unique_ptr<BOARD> readBoard( wxString& aFilename );
69 void findSetDifferences( const BOARD_ITEM_SET& aAncestorSet, const BOARD_ITEM_SET& aOtherSet,
70 std::vector<BOARD_ITEM*>& aAdded, std::vector<BOARD_ITEM*>& aRemoved,
71 std::vector<BOARD_ITEM*>& aChanged );
72
73 private:
74
75 git_merge_driver_source* m_mergeDriver;
76 git_buf* m_result;
77
78 std::set<BOARD_ITEM*> we_modified_they_deleted;
79 std::set<BOARD_ITEM*> they_modified_we_deleted;
80 std::set<BOARD_ITEM*> both_modified;
81};
82
83
84
85#endif // KIGIT_PCB_MERGE_H
std::set< BOARD_ITEM *, CompareByUuid > BOARD_ITEM_SET
Set of BOARD_ITEMs ordered by UUID.
Definition: board.h:274
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
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_buf * m_result
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()
std::unique_ptr< BOARD > readBoard(wxString &aFilename)
virtual ~KIGIT_PCB_MERGE()
std::set< BOARD_ITEM * > they_modified_we_deleted
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