Example #1
0
void HgBackoutDialog::done(int r)
{
    if (r == QDialog::Accepted) {
        HgWrapper *hgw = HgWrapper::instance();
        QStringList args;
        args << QLatin1String("--rev");
        args << m_baseRevision->text();

        if (!m_parentRevision->text().isEmpty()) {
            args << QLatin1String("--parent");
            args << m_parentRevision->text();
        }

        if (m_optMerge->checkState() == Qt::Checked) {
            args << QLatin1String("--merge");
        }

        if (hgw->executeCommandTillFinished(QLatin1String("backout"), args)) {
            KMessageBox::information(this, hgw->readAllStandardOutput());
            QDialog::done(r);
        }
        else {
            KMessageBox::error(this, hgw->readAllStandardError());
        }
    }
    else {
        QDialog::done(r);
    }
}
Example #2
0
void HgMergeDialog::done(int r)
{
    if (r == KDialog::Accepted) {
        HgWrapper *hgw = HgWrapper::instance();

        QListWidgetItem *currentItem = m_commitInfoWidget->currentItem();
        if (currentItem == 0) {
            KMessageBox::error(this,
                    i18nc("@message", "No head selected for merge!"));
            return;
        }

        QString changeset = m_commitInfoWidget->selectedChangeset();
        QStringList args;

        args << QLatin1String("-r");
        args << changeset;

        if (hgw->executeCommandTillFinished(QLatin1String("merge"), args)) {
            KMessageBox::information(this, hgw->readAllStandardOutput());
            KDialog::done(r);
        }
        else {
            KMessageBox::error(this, hgw->readAllStandardError());
            return;
        }
    }
    else {
        KDialog::done(r);
    }
}