KDevelop AppWizard - DVCS fix for empty project

Backstory

Few days ago I wanted to play with Falkon and create some basic Qml plugin. (What else to do to play, Python support is broken and C++ is for built-in plugins).

I started KDevelop (the big IDE I use) and went to create new Empty project because as I am not big Qml lover I did not create template for it yet. But I was met with errors which made me change my focus and fix the tool I use (KDevelop) before playing with Qml and Falkon.

Man must shape his tools lest they shape him. - Arthur Miller

Problem

During the project creation AppWizard is trying add files and than commit changes into new DVCS (Decentralized Version Control System) repository. When there are no files to add there will naturally be nothing to commit which results in error message from DVCS and the project creation is stopped and project removed.

Solution

Lets dive into KDevelop code and check what can be done about it. My humble solution relays on checking the state of the DVCS repository before commit. To achieve this I am trying to get actual status of the repository from VCS (Version Control System) and then checking if the result contains some items.

The KDevPlatform provides nice API to work with VCSs and thus I only need to call few method to get all the data.

Actual code is truly simple and works for me. (only my changes)

qCDebug(PLUGIN_APPWIZARD) << "Checking for valid files in the DVCS repository:" << dest;
job = dvcs->status({dest}, KDevelop::IBasicVersionControl::Recursive);
if (!job || !job->exec() || job->status() != VcsJob::JobSucceeded)
{
    vcsError(i18n("Could not check status of the DVCS repository"), scratchArea, dest);
    return false;
}

if (job->fetchResults().toList().isEmpty())
{
    qCDebug(PLUGIN_APPWIZARD) << "No files to add, skipping commit in the DVCS repository:" << dest;
    return true;
}

Brief description

  • Print notice into debug output
  • Prepare job with status command to run
  • Execute the job and check for failure
    • If failed put notice in debug output
  • Check if the response contains some items
    • If not put notice in debug output
    • Skip add files & commit by returning true
  • Test many times and done.

Results

KDevelop is able to create Empty project from template with initialized DVCS repository which is really helpful when one wish to start a project from scratch.

Git

Works just fine.

Bazaar

The world is never perfect and there is always a room for improvements.

The merge request is waiting for review at invent.kde.org !73.

Articles from blogs I follow:

Why is your open source project still hosted on GitHub?

Perhaps the younger generation don't know anything about the past "evils" of Microsoft and naively believe that Microsoft is now the good friend to open source, but the truth is that all Microsoft acquisitions of open source projects is a busi…

via unixdigest.com May 22, 2025

StarFive VisionFive v2 and FreeBSD

This week I powered up the StarFive VisionFive v2 board that I have. I figured I would give FreeBSD another whirl on it, in the vague hope that RISC-V boards are a more cohesive family than ARM boards were five years ago. tl;dr: I didn’t get it to work as…

via [bobulate] May 20, 2025

Steve Ballmer was an underrated CEO

There's a common narrative that Microsoft was moribund under Steve Ballmer and then later saved by the miraculous leadership of Satya Nadella. This is the dominant narrative in every online discussion about the topic I've seen and it's a commo…

via danluu.com October 28, 2024

Generated by openring