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 #include "abstractcommand.h" 0009 #include "libkommit_export.h" 0010 0011 namespace Git 0012 { 0013 0014 class LIBKOMMIT_EXPORT CommandSwitchBranch : public AbstractCommand 0015 { 0016 Q_OBJECT 0017 0018 public: 0019 explicit CommandSwitchBranch(Manager *git); 0020 void parseOutputSection(const QByteArray &output, const QByteArray &errorOutput) override; 0021 0022 enum Mode { Unknown, NewBranch, ExistingBranch, Tag, RemoteBranch }; 0023 0024 Q_REQUIRED_RESULT const QString &target() const; 0025 void setTarget(const QString &newTarget); 0026 0027 Q_REQUIRED_RESULT Mode mode() const; 0028 void setMode(Mode newMode); 0029 0030 Q_REQUIRED_RESULT QStringList generateArgs() const override; 0031 0032 Q_REQUIRED_RESULT bool force() const; 0033 void setForce(bool newForce); 0034 0035 Q_REQUIRED_RESULT QString remoteBranch() const; 0036 void setRemoteBranch(const QString &newRemoteBranch); 0037 0038 private: 0039 bool mForce{false}; 0040 Mode mMode{Unknown}; 0041 QString mTarget; 0042 QString mRemoteBranch; 0043 }; 0044 0045 } // namespace Git