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_REBASE_H 0020 #define LIBQGIT2_REBASE_H 0021 0022 #include "qgitsignature.h" 0023 0024 namespace LibQGit2 0025 { 0026 0027 class OId; 0028 0029 /** 0030 * @brief Wrapper class for git_rebase. 0031 * Represents a Git rebase. 0032 * 0033 * @ingroup LibQGit2 0034 * @{ 0035 */ 0036 class LIBQGIT2_EXPORT Rebase 0037 { 0038 public: 0039 /** 0040 * Create a wrapper for a libgit2 rebase object. Constructed object 0041 * takes ownership of \a rebase and frees it in the destructor. 0042 * @param rebase Raw pointer to the libgit2 rebase object 0043 */ 0044 explicit Rebase(git_rebase *rebase); 0045 0046 /** 0047 * Aborts a rebase that is currently in progress, resetting the repository 0048 * and working directory to their state before rebase began. 0049 * 0050 * @throws LibQGit2::Exception 0051 */ 0052 void abort(); 0053 0054 /** 0055 * Finishes a rebase that is currently in progress once all patches have 0056 * been applied. 0057 * 0058 * @param signature The identity that is finishing the rebase 0059 * @throws LibQGit2::Exception 0060 */ 0061 void finish(const Signature &signature = Signature()); 0062 0063 /** 0064 * Performs the next rebase operation by applying the patch and updating the index 0065 * and working directory with the changes. If there are conflicts, those will need 0066 * to be addressed before committing the changes. 0067 * 0068 * @throws LibQGit2::Exception 0069 */ 0070 bool next(); 0071 0072 /** 0073 * Commits the current patch. You must have resolved any conflicts that 0074 * were introduced during the patch application from the `LibQGit2::Rebase::next` 0075 * invocation. 0076 * 0077 * @param committer The committer of the rebase 0078 * @param author The author of the updated commit, or \a null to keep the 0079 * author from the original commit 0080 * @param message The message for this commit, or \a null to use the message 0081 * from the original commit. 0082 * @return OID of the newly created commit 0083 * @throws LibQGit2::Exception 0084 */ 0085 OId commit(const Signature &committer, const Signature &author = Signature(), const QString &message = QString()); 0086 0087 git_rebase *data() const; 0088 git_rebase *constData() const; 0089 0090 private: 0091 struct Private; 0092 QSharedPointer<Private> d_ptr; 0093 }; 0094 /** @} */ 0095 } 0096 #endif // LIBQGIT2_REBASE_H