Commit a6e0e06e authored by Christian Loose's avatar Christian Loose
Browse files

Respect the remote shell client configuration option and

the current working copy directory.

svn path=/trunk/kdesdk/cervisia/; revision=197187
parent 049b439b
......@@ -28,23 +28,29 @@ struct CvsJob::Private
{
KProcess* childproc;
QString cvsCommand;
QString rsh;
QString directory;
bool isRunning;
};
CvsJob::CvsJob(unsigned jobId, const QString& cvsCommand)
CvsJob::CvsJob(unsigned jobId, const QString& cvsCommand, const QString& rsh,
const QString& directory)
: QObject()
, DCOPObject()
, d(new Private)
{
// initialize private data
d->cvsCommand = cvsCommand;
d->rsh = rsh;
d->directory = directory;
d->isRunning = false;
QString objId("CvsJob" + QString::number(jobId));
setObjId(objId.local8Bit());
d->childproc = new KProcess;
d->childproc->setUseShell(true, "/bin/sh");
d->cvsCommand = cvsCommand;
d->isRunning = false;
}
......@@ -61,6 +67,18 @@ void CvsJob::setCvsCommand(const QString& cvsCommand)
}
void CvsJob::setRSH(const QString& rsh)
{
d->rsh = rsh;
}
void CvsJob::setDirectory(const QString& directory)
{
d->directory = directory;
}
bool CvsJob::isRunning() const
{
return d->isRunning;
......@@ -75,6 +93,12 @@ QString CvsJob::cvsCommand() const
bool CvsJob::execute()
{
if( !d->rsh.isEmpty() )
d->childproc->setEnvironment("CVS_RSH", d->rsh);
if( !d->directory.isEmpty() )
d->childproc->setWorkingDirectory(d->directory);
*d->childproc << d->cvsCommand;
connect(d->childproc, SIGNAL(processExited(KProcess*)),
......
......@@ -22,9 +22,9 @@
#define CVSJOB_H
#include <qobject.h>
#include <qstring.h>
#include <dcopobject.h>
class QString;
class KProcess;
......@@ -34,17 +34,25 @@ class CvsJob : public QObject, public DCOPObject
K_DCOP
public:
CvsJob(unsigned jobId, const QString& cvsCommand);
CvsJob(unsigned jobId, const QString& cvsCommand, const QString& rsh = QString::null,
const QString& directory = QString::null);
~CvsJob();
void setCvsCommand(const QString& cvsCommand);
void setRSH(const QString& rsh);
void setDirectory(const QString& directory);
k_dcop:
bool execute();
void cancel();
bool isRunning() const;
/**
* Current cvs command.
*
* @return The current cvs command. Can be null if not set.
*/
QString cvsCommand() const;
k_dcop_signals:
......
......@@ -50,6 +50,8 @@ struct CvsService::Private
QString workingCopy;
Repository* repository;
DCOPRef createCvsJob(const QString& cmdline);
};
......@@ -156,11 +158,7 @@ DCOPRef CvsService::annotate(const QString& fileName, const QString& revision)
cmdline += " ) 2>&1";
// create a cvs job
++d->lastJobId;
CvsJob* job = new CvsJob(d->lastJobId, cmdline);
d->cvsJobs.insert(d->lastJobId, job);
return DCOPRef(d->appId, job->objId());
return d->createCvsJob(cmdline);
}
......@@ -179,11 +177,7 @@ DCOPRef CvsService::log(const QString& fileName)
cmdline += KProcess::quote(fileName);
// create a cvs job
++d->lastJobId;
CvsJob* job = new CvsJob(d->lastJobId, cmdline);
d->cvsJobs.insert(d->lastJobId, job);
return DCOPRef(d->appId, job->objId());
return d->createCvsJob(cmdline);
}
......@@ -213,11 +207,7 @@ DCOPRef CvsService::status(const QString& files, bool recursive)
cmdline += " 2>&1";
// create a cvs job
++d->lastJobId;
CvsJob* job = new CvsJob(d->lastJobId, cmdline);
d->cvsJobs.insert(d->lastJobId, job);
return DCOPRef(d->appId, job->objId());
return d->createCvsJob(cmdline);
}
......@@ -243,6 +233,8 @@ DCOPRef CvsService::status(const QString& files, bool recursive, bool tagInfo)
cmdline += files;
d->singleCvsJob->setCvsCommand(cmdline);
d->singleCvsJob->setRSH(d->repository->rsh());
d->singleCvsJob->setDirectory(d->workingCopy);
return DCOPRef(d->appId, d->singleCvsJob->objId());
}
......@@ -265,4 +257,16 @@ void CvsService::slotConfigDirty(const QString& fileName)
}
DCOPRef CvsService::Private::createCvsJob(const QString& cmdline)
{
++lastJobId;
// create a cvs job
CvsJob* job = new CvsJob(lastJobId, cmdline, repository->rsh(),
workingCopy);
cvsJobs.insert(lastJobId, job);
return DCOPRef(appId, job->objId());
}
#include "cvsservice.moc"
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