File indexing completed on 2025-01-19 04:22:43
0001 /* 0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "abstractcommand.h" 0010 #include "libkommit_export.h" 0011 0012 namespace Git 0013 { 0014 0015 class LIBKOMMIT_EXPORT CommandMerge : public AbstractCommand 0016 { 0017 Q_OBJECT 0018 0019 public: 0020 enum Strategy { 0021 Default, 0022 Ort, 0023 Recursive, 0024 Resolve, 0025 Octopus, 0026 Ours, 0027 Subtree, 0028 }; 0029 Q_ENUM(Strategy) 0030 enum DiffAlgorithm { Patience, Minimal, Histogram, Myers }; 0031 Q_ENUM(DiffAlgorithm) 0032 0033 explicit CommandMerge(Manager *git); 0034 Q_REQUIRED_RESULT QStringList generateArgs() const override; 0035 0036 Q_REQUIRED_RESULT OptionalBool commit() const; 0037 void setCommit(OptionalBool newCommit); 0038 0039 Q_REQUIRED_RESULT OptionalBool allowUnrelatedHistories() const; 0040 void setAllowUnrelatedHistories(OptionalBool newAllowUnrelatedHistories); 0041 0042 FastForwardType ff() const; 0043 void setFf(FastForwardType newFf); 0044 0045 Q_REQUIRED_RESULT OptionalBool squash() const; 0046 void setSquash(OptionalBool newSquash); 0047 0048 Q_REQUIRED_RESULT const QString &fromBranch() const; 0049 void setFromBranch(const QString &newFromBranch); 0050 0051 Q_REQUIRED_RESULT const Strategy &strategy() const; 0052 void setStrategy(Git::CommandMerge::Strategy newStrategy); 0053 0054 Q_REQUIRED_RESULT bool ignoreSpaceChange() const; 0055 void setIgnoreSpaceChange(bool newIgnoreSpaceChange); 0056 Q_REQUIRED_RESULT bool ignoreAllSpace() const; 0057 void setIgnoreAllSpace(bool newIgnoreAllSpace); 0058 Q_REQUIRED_RESULT bool ignoreSpaceAtEol() const; 0059 void setIgnoreSpaceAtEol(bool newIgnoreSpaceAtEol); 0060 Q_REQUIRED_RESULT bool ignoreCrAtEol() const; 0061 void setIgnoreCrAtEol(bool newIgnoreCrAtEol); 0062 Q_REQUIRED_RESULT bool renormalize() const; 0063 void setRenormalize(bool newRenormalize); 0064 Q_REQUIRED_RESULT bool noRenames() const; 0065 void setNoRenames(bool newNoRenames); 0066 Q_REQUIRED_RESULT DiffAlgorithm diffAlgorithm() const; 0067 void setDiffAlgorithm(DiffAlgorithm newDiffAlgorithm); 0068 0069 Q_REQUIRED_RESULT bool ours() const; 0070 void setOurs(bool newOurs); 0071 0072 Q_REQUIRED_RESULT bool theirs() const; 0073 void setTheirs(bool newTheirs); 0074 0075 private: 0076 QString mFromBranch; 0077 0078 OptionalBool mCommit{OptionalBool::Unset}; 0079 OptionalBool mAllowUnrelatedHistories{OptionalBool::Unset}; 0080 OptionalBool mSquash{false}; 0081 0082 FastForwardType mFf{FastForwardType::Unset}; 0083 Strategy mStrategy{Default}; 0084 DiffAlgorithm mDiffAlgorithm{Histogram}; 0085 0086 bool mIgnoreSpaceChange{false}; 0087 bool mIgnoreAllSpace{false}; 0088 bool mIgnoreSpaceAtEol{false}; 0089 bool mIgnoreCrAtEol{false}; 0090 bool mRenormalize{false}; 0091 bool mNoRenames{false}; 0092 bool mOurs{false}; 0093 bool mTheirs{false}; 0094 }; 0095 0096 }