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 #ifdef GIT_GUI
0012 namespace Ui
0013 {
0014 class CommandPullWidget;
0015 }
0016 #endif
0017 
0018 namespace Git
0019 {
0020 
0021 class LIBKOMMIT_EXPORT CommandPull : public AbstractCommand
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     enum Rebase {
0027         None,
0028         False,
0029         True,
0030         Preserve,
0031         Merge,
0032     };
0033     Q_ENUM(Rebase)
0034 
0035     enum FastForward {
0036         Unset,
0037         Yes,
0038         No,
0039         OnlyFastForward,
0040     };
0041     Q_ENUM(FastForward)
0042 
0043     CommandPull();
0044     ~CommandPull() override;
0045     Q_REQUIRED_RESULT QStringList generateArgs() const override;
0046 
0047     Q_REQUIRED_RESULT bool squash() const;
0048     void setSquash(bool newSquash);
0049 
0050     Q_REQUIRED_RESULT bool noCommit() const;
0051     void setNoCommit(bool newNoCommit);
0052 
0053     Q_REQUIRED_RESULT bool prune() const;
0054     void setPrune(bool newPrune);
0055 
0056     Q_REQUIRED_RESULT bool tags() const;
0057     void setTags(bool newTags);
0058 
0059     void parseOutputSection(const QByteArray &output, const QByteArray &errorOutput) override;
0060     bool supportWidget() const override;
0061     QWidget *createWidget() override;
0062 
0063     Q_REQUIRED_RESULT const QString &remote() const;
0064     void setRemote(const QString &newRemote);
0065 
0066     Q_REQUIRED_RESULT const QString &branch() const;
0067     void setBranch(const QString &newBranch);
0068 
0069     Q_REQUIRED_RESULT Rebase rebase() const;
0070     void setRebase(Rebase newRebase);
0071 
0072     Q_REQUIRED_RESULT FastForward fastForward() const;
0073     void setFastForward(FastForward newFastForward);
0074 
0075 private:
0076     bool mSquash{false};
0077     bool mNoCommit{false};
0078     bool mPrune{false};
0079     bool mTags{false};
0080     QString mRemote;
0081     QString mBranch;
0082     Rebase mRebase{None};
0083     FastForward mFastForward{Unset};
0084 
0085 #ifdef GIT_GUI
0086     QWidget *mWidget;
0087     Ui::CommandPullWidget *mUi;
0088 #endif
0089 };
0090 
0091 } // namespace Git