Commit b8a0838d authored by Christian Loose's avatar Christian Loose

Give non-concurrent cvs job a special name

svn path=/trunk/kdesdk/cervisia/; revision=198986
parent 1e5db63a
......@@ -32,26 +32,46 @@ struct CvsJob::Private
QString rsh;
QString directory;
bool isRunning;
void init();
};
CvsJob::CvsJob(unsigned jobId, const QString& rsh, const QString& server,
const QString& directory)
CvsJob::CvsJob(unsigned jobNum)
: QObject()
, DCOPObject()
, d(new Private)
{
// initialize private data
d->server = server;
d->rsh = rsh;
d->directory = directory;
d->isRunning = false;
d->init();
QString objId("CvsJob" + QString::number(jobNum));
setObjId(objId.local8Bit());
}
QString objId("CvsJob" + QString::number(jobId));
CvsJob::CvsJob(const QString& objId)
: QObject()
, DCOPObject()
, d(new Private)
{
// initialize private data
d->init();
setObjId(objId.local8Bit());
}
void CvsJob::Private::init()
{
// initialize private data
server = QString::null;
rsh = QString::null;
directory = QString::null;
isRunning = false;
d->childproc = new KProcess;
d->childproc->setUseShell(true, "/bin/sh");
childproc = new KProcess;
childproc->setUseShell(true, "/bin/sh");
}
......
......@@ -34,9 +34,8 @@ class CvsJob : public QObject, public DCOPObject
K_DCOP
public:
CvsJob(unsigned jobId, const QString& rsh = QString::null,
const QString& server = QString::null,
const QString& directory = QString::null);
CvsJob(unsigned jobNum);
CvsJob(const QString& objId);
~CvsJob();
void clearCvsCommand();
......
......@@ -39,6 +39,8 @@
#include "repository.h"
static const char* SINGLE_JOB_ID = "NonConcurrentJob";
struct CvsService::Private
{
CvsJob* singleCvsJob; // non-concurrent cvs job, like update or commit
......@@ -60,12 +62,10 @@ CvsService::CvsService()
, d(new Private)
{
// initialize private data
d->lastJobId = 0;
d->repository = 0;
d->appId = kapp->dcopClient()->appId();
++d->lastJobId;
d->singleCvsJob = new CvsJob(d->lastJobId);
d->lastJobId = 0;
d->repository = 0;
d->appId = kapp->dcopClient()->appId();
d->singleCvsJob = new CvsJob(SINGLE_JOB_ID);
d->cvsJobs.setAutoDelete(true);
......@@ -91,11 +91,11 @@ CvsService::~CvsService()
bool CvsService::setWorkingCopy(const QString& dirName)
{
QFileInfo fi(dirName);
const QFileInfo fi(dirName);
QString path = fi.absFilePath();
// is this really a cvs-controlled directory?
QFileInfo cvsDirInfo(path + "/CVS");
const QFileInfo cvsDirInfo(path + "/CVS");
if( !cvsDirInfo.exists() || !cvsDirInfo.isDir() )
return false;
......@@ -144,7 +144,7 @@ DCOPRef CvsService::annotate(const QString& fileName, const QString& revision)
QString cvsClient = d->repository->cvsClient();
*job << "(" << cvsClient << "log" << quotedName << "&&"
<< cvsClient << "annotate";
<< cvsClient << "annotate";
if( !revision.isEmpty() )
*job << "-r" << revision;
......@@ -342,10 +342,13 @@ CvsJob* CvsService::Private::createCvsJob()
++lastJobId;
// create a cvs job
CvsJob* job = new CvsJob(lastJobId, repository->rsh(), repository->server(),
workingCopy);
CvsJob* job = new CvsJob(lastJobId);
cvsJobs.insert(lastJobId, job);
job->setRSH(repository->rsh());
job->setServer(repository->server());
job->setDirectory(workingCopy);
return job;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment