File indexing completed on 2025-03-09 05:11:40

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 {
0023         Unknown,
0024         NewBranch,
0025         ExistingBranch,
0026         Tag,
0027         RemoteBranch,
0028     };
0029 
0030     Q_REQUIRED_RESULT const QString &target() const;
0031     void setTarget(const QString &newTarget);
0032 
0033     Q_REQUIRED_RESULT Mode mode() const;
0034     void setMode(Mode newMode);
0035 
0036     Q_REQUIRED_RESULT QStringList generateArgs() const override;
0037 
0038     Q_REQUIRED_RESULT bool force() const;
0039     void setForce(bool newForce);
0040 
0041     Q_REQUIRED_RESULT QString remoteBranch() const;
0042     void setRemoteBranch(const QString &newRemoteBranch);
0043 
0044 private:
0045     bool mForce{false};
0046     Mode mMode{Unknown};
0047     QString mTarget;
0048     QString mRemoteBranch;
0049 };
0050 
0051 } // namespace Git