| 940 | } |
| 941 | |
| 942 | void Repository::rebaseContinue(const QString &commitMessage) { |
| 943 | |
| 944 | Rebase r = rebaseOpen(); |
| 945 | if (!r.isValid()) { |
| 946 | // rebase anymore available. maybe rebased externally |
| 947 | return; |
| 948 | } |
| 949 | |
| 950 | if (r.currentIndex() != GIT_REBASE_NO_OPERATION) { |
| 951 | // Rebase::next() was already called at leas once |
| 952 | // externally or by a previous call of rebaseContinue |
| 953 | |
| 954 | // Check if it can be committed |
| 955 | git::Commit c = r.commit(commitMessage); |
| 956 | if (!c.isValid()) { |
| 957 | emit d->notifier->rebaseConflict(r); |
| 958 | return; |
| 959 | } else { |
| 960 | emit d->notifier->rebaseCommitSuccess(r, c, r.commitToRebase(), |
| 961 | r.currentIndex() + 1); |
| 962 | // Go on with the next rebase operation below |
| 963 | } |
| 964 | } |
| 965 | // Loop over rebase operations. |
| 966 | while (r.hasNext()) { |
| 967 | git::Commit before = r.next(); |
| 968 | if (!before.isValid()) { |
| 969 | emit d->notifier->rebaseCommitInvalid(r); |
| 970 | rebaseAbort(); |
| 971 | return; |
| 972 | } |
| 973 | int currCommit = |
| 974 | r.currentIndex() + |
| 975 | 1; // for showing to user it makes more sense starting from 1 |
| 976 | emit d->notifier->rebaseAboutToRebase(r, before, currCommit); |
| 977 | |
| 978 | QString message = before.message(); // use original message |
| 979 | git::Commit after = r.commit(message); |
| 980 | if (!after.isValid()) { |
| 981 | emit d->notifier->rebaseConflict(r); |
| 982 | return; // before ongoing, the user has to fix the conflicts. |
| 983 | } |
| 984 | |
| 985 | emit d->notifier->rebaseCommitSuccess(r, after, before, currCommit); |
| 986 | } |
| 987 | |
| 988 | if (r.finish()) |
| 989 | emit d->notifier->rebaseFinished(r); |
| 990 | // TODO: implement |
| 991 | // else |
| 992 | // emit error |
| 993 | } |
| 994 | |
| 995 | bool Repository::rebaseOngoing() { |
| 996 | Rebase r = rebaseOpen(); |
no test coverage detected