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);
    }
}
Example #3
0
void HgImportDialog::done(int r)
{
    if (r == QDialog::Accepted) {
        QStringList args;
        if (m_optForce->checkState() == Qt::Checked) {
            args << QLatin1String("--force");
        }

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

        if (m_optNoCommit->checkState() == Qt::Checked) {
            args << QLatin1String("--no-commit");
        }
        if (m_optExact->checkState() == Qt::Checked) {
            args << QLatin1String("--exact");
        }

        int countRows = m_patchList->count();
        for (int i=0; i<countRows; i++) {
            QListWidgetItem *item = m_patchList->item(i);
            args << item->data(Qt::UserRole + 5).toString();
        }

        HgWrapper *hgw = HgWrapper::instance();
        if (hgw->executeCommandTillFinished(QLatin1String("import"), args)) {
            QDialog::done(r);
        }
        else {
            KMessageBox::error(this, hgw->readAllStandardError());
        }
    }
    else {
        QDialog::done(r);
    }
}