File indexing completed on 2024-04-28 16:01:32

0001 /******************************************************************************
0002  * This file is part of the libqgit2 library
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public
0015  * License along with this library; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0017  */
0018 
0019 #ifndef LIBQGIT2_MERGEOPTIONS_H
0020 #define LIBQGIT2_MERGEOPTIONS_H
0021 
0022 #include "git2.h"
0023 
0024 #include <QtGlobal>
0025 
0026 #include "libqgit2_export.h"
0027 
0028 namespace LibQGit2
0029 {
0030     /**
0031      * Options that specify how a merge operation is performed.
0032      *
0033      * @ingroup LibQGit2
0034      * @{
0035      */
0036     class LIBQGIT2_EXPORT MergeOptions
0037     {
0038     public:
0039         /**
0040          * Strategy to handle conflicting regions when merging a file.
0041          */
0042         enum FavorType {
0043             Normal,       ///< Record a conflict in the index, inserting conflict markers in the working directory file.
0044             Ours,         ///< Use "ours" side version for the conflicting regions.
0045             Theirs,       ///< Use "theirs" side version for the conflicting regions.
0046             Union         ///< Combine lines from both "ours" and "theirs" side for the conflicting regions.
0047         };
0048 
0049         /**
0050          * Options specifying details about how a checkout is performed.
0051          */
0052         enum Flag {
0053             FindRenames = 1u << 0   ///< Enables merging between a renamed and modified file
0054         };
0055         Q_DECLARE_FLAGS(Flags, Flag)
0056 
0057         /**
0058          * Construct a new MergeOptions.
0059          * @param flags Set details about the merge process.
0060          * @param favor How conflicting regions in files should be handled.
0061          */
0062         MergeOptions(FavorType favor = Normal, Flags flags = Flags());
0063 
0064         const git_merge_options* data() const;
0065 
0066     private:
0067         git_merge_options d;
0068     };
0069 
0070     Q_DECLARE_OPERATORS_FOR_FLAGS(MergeOptions::Flags)
0071 
0072     /** @} */
0073 
0074 }
0075 
0076 #endif // LIBQGIT2_MERGEOPTIONS_H