forked from qt-creator/qt-creator
ClearCasePlugin: Introduce s_verboseRun helper
Change-Id: I08abc4f45ee17574e9a642f5b971fc8278e02ab0 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -128,6 +128,9 @@ static const char CMD_ID_UPDATE_VIEW[] = "ClearCase.UpdateView";
|
|||||||
static const char CMD_ID_CHECKIN_ALL[] = "ClearCase.CheckInAll";
|
static const char CMD_ID_CHECKIN_ALL[] = "ClearCase.CheckInAll";
|
||||||
static const char CMD_ID_STATUS[] = "ClearCase.Status";
|
static const char CMD_ID_STATUS[] = "ClearCase.Status";
|
||||||
|
|
||||||
|
const int s_silentRun = ShellCommand::NoOutput | ShellCommand::FullySynchronously;
|
||||||
|
const int s_verboseRun = ShellCommand::ShowStdOut | ShellCommand::FullySynchronously;
|
||||||
|
|
||||||
class ClearCaseResponse
|
class ClearCaseResponse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -173,7 +176,6 @@ static QString debugCodec(const QTextCodec *c)
|
|||||||
class ClearCasePluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
class ClearCasePluginPrivate final : public VcsBase::VcsBasePluginPrivate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
enum { SilentRun = ShellCommand::NoOutput | ShellCommand::FullySynchronously };
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClearCasePluginPrivate();
|
ClearCasePluginPrivate();
|
||||||
@@ -415,7 +417,7 @@ QStringList ClearCasePluginPrivate::getVobList() const
|
|||||||
QStringList args(QLatin1String("lsvob"));
|
QStringList args(QLatin1String("lsvob"));
|
||||||
args << QLatin1String("-s");
|
args << QLatin1String("-s");
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(currentState().topLevel(), args, m_settings.timeOutS, SilentRun);
|
runCleartool(currentState().topLevel(), args, m_settings.timeOutS, s_silentRun);
|
||||||
|
|
||||||
return response.stdOut.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
|
return response.stdOut.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
|
||||||
}
|
}
|
||||||
@@ -539,7 +541,7 @@ QString ClearCasePluginPrivate::ccManagesDirectory(const FilePath &directory) co
|
|||||||
{
|
{
|
||||||
QStringList args(QLatin1String("pwv"));
|
QStringList args(QLatin1String("pwv"));
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(directory, args, m_settings.timeOutS, SilentRun);
|
runCleartool(directory, args, m_settings.timeOutS, s_silentRun);
|
||||||
|
|
||||||
if (response.error)
|
if (response.error)
|
||||||
return QString();
|
return QString();
|
||||||
@@ -587,7 +589,7 @@ QString ClearCasePluginPrivate::ccViewRoot(const FilePath &directory) const
|
|||||||
QStringList args(QLatin1String("pwv"));
|
QStringList args(QLatin1String("pwv"));
|
||||||
args << QLatin1String("-root");
|
args << QLatin1String("-root");
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(directory, args, m_settings.timeOutS, SilentRun);
|
runCleartool(directory, args, m_settings.timeOutS, s_silentRun);
|
||||||
|
|
||||||
QString root = response.stdOut.trimmed();
|
QString root = response.stdOut.trimmed();
|
||||||
|
|
||||||
@@ -864,7 +866,7 @@ QString ClearCasePluginPrivate::ccGetPredecessor(const QString &version) const
|
|||||||
QStringList args(QLatin1String("describe"));
|
QStringList args(QLatin1String("describe"));
|
||||||
args << QLatin1String("-fmt") << QLatin1String("%En@@%PSn") << version;
|
args << QLatin1String("-fmt") << QLatin1String("%En@@%PSn") << version;
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(currentState().topLevel(), args, m_settings.timeOutS, SilentRun);
|
runCleartool(currentState().topLevel(), args, m_settings.timeOutS, s_silentRun);
|
||||||
if (response.error || response.stdOut.endsWith(QLatin1Char('@'))) // <name-unknown>@@
|
if (response.error || response.stdOut.endsWith(QLatin1Char('@'))) // <name-unknown>@@
|
||||||
return QString();
|
return QString();
|
||||||
else
|
else
|
||||||
@@ -880,7 +882,7 @@ QStringList ClearCasePluginPrivate::ccGetActiveVobs() const
|
|||||||
const QString theViewRoot = viewRoot();
|
const QString theViewRoot = viewRoot();
|
||||||
|
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(FilePath::fromString(theViewRoot), args, m_settings.timeOutS, SilentRun);
|
runCleartool(FilePath::fromString(theViewRoot), args, m_settings.timeOutS, s_silentRun);
|
||||||
if (response.error)
|
if (response.error)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
@@ -932,7 +934,7 @@ QString ClearCasePluginPrivate::ccGetFileActivity(const FilePath &workingDir, co
|
|||||||
args << QLatin1String("-fmt") << QLatin1String("%[activity]p");
|
args << QLatin1String("-fmt") << QLatin1String("%[activity]p");
|
||||||
args << file;
|
args << file;
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(workingDir, args, m_settings.timeOutS, SilentRun);
|
runCleartool(workingDir, args, m_settings.timeOutS, s_silentRun);
|
||||||
return response.stdOut;
|
return response.stdOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1107,8 +1109,7 @@ bool ClearCasePluginPrivate::vcsUndoCheckOut(const FilePath &workingDir, const Q
|
|||||||
args << QDir::toNativeSeparators(fileName);
|
args << QDir::toNativeSeparators(fileName);
|
||||||
|
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(workingDir, args, m_settings.timeOutS,
|
runCleartool(workingDir, args, m_settings.timeOutS, s_verboseRun);
|
||||||
ShellCommand::ShowStdOut | ShellCommand::FullySynchronously);
|
|
||||||
|
|
||||||
if (!response.error) {
|
if (!response.error) {
|
||||||
const QString absPath = workingDir.pathAppended(fileName).toString();
|
const QString absPath = workingDir.pathAppended(fileName).toString();
|
||||||
@@ -1140,7 +1141,7 @@ bool ClearCasePluginPrivate::vcsUndoHijack(const FilePath &workingDir, const QSt
|
|||||||
args << QDir::toNativeSeparators(fileName);
|
args << QDir::toNativeSeparators(fileName);
|
||||||
|
|
||||||
const ClearCaseResponse response = runCleartool(workingDir, args, m_settings.timeOutS,
|
const ClearCaseResponse response = runCleartool(workingDir, args, m_settings.timeOutS,
|
||||||
ShellCommand::ShowStdOut | ShellCommand::FullySynchronously);
|
s_verboseRun);
|
||||||
if (!response.error && !m_settings.disableIndexer) {
|
if (!response.error && !m_settings.disableIndexer) {
|
||||||
const QString absPath = workingDir.pathAppended(fileName).toString();
|
const QString absPath = workingDir.pathAppended(fileName).toString();
|
||||||
setStatus(absPath, FileStatus::CheckedIn);
|
setStatus(absPath, FileStatus::CheckedIn);
|
||||||
@@ -1247,7 +1248,7 @@ QStringList ClearCasePluginPrivate::ccGetActivityVersions(const FilePath &workin
|
|||||||
QStringList args(QLatin1String("lsactivity"));
|
QStringList args(QLatin1String("lsactivity"));
|
||||||
args << QLatin1String("-fmt") << QLatin1String("%[versions]Cp") << activity;
|
args << QLatin1String("-fmt") << QLatin1String("%[versions]Cp") << activity;
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(workingDir, args, m_settings.timeOutS, SilentRun);
|
runCleartool(workingDir, args, m_settings.timeOutS, s_silentRun);
|
||||||
if (response.error)
|
if (response.error)
|
||||||
return QStringList();
|
return QStringList();
|
||||||
QStringList versions = response.stdOut.split(QLatin1String(", "));
|
QStringList versions = response.stdOut.split(QLatin1String(", "));
|
||||||
@@ -1647,7 +1648,7 @@ void ClearCasePluginPrivate::commitFromEditor()
|
|||||||
QString ClearCasePluginPrivate::runCleartoolSync(const FilePath &workingDir,
|
QString ClearCasePluginPrivate::runCleartoolSync(const FilePath &workingDir,
|
||||||
const QStringList &arguments) const
|
const QStringList &arguments) const
|
||||||
{
|
{
|
||||||
return runCleartool(workingDir, arguments, m_settings.timeOutS, SilentRun).stdOut;
|
return runCleartool(workingDir, arguments, m_settings.timeOutS, s_silentRun).stdOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearCaseResponse
|
ClearCaseResponse
|
||||||
@@ -1794,9 +1795,7 @@ bool ClearCasePluginPrivate::vcsOpen(const FilePath &workingDir, const QString &
|
|||||||
}
|
}
|
||||||
args << file;
|
args << file;
|
||||||
ClearCaseResponse response = runCleartool(topLevel, args, m_settings.timeOutS,
|
ClearCaseResponse response = runCleartool(topLevel, args, m_settings.timeOutS,
|
||||||
ShellCommand::ShowStdOut
|
s_verboseRun | ShellCommand::SuppressStdErr);
|
||||||
| ShellCommand::SuppressStdErr
|
|
||||||
| ShellCommand::FullySynchronously);
|
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
if (response.stdErr.contains(QLatin1String("Versions other than the selected version"))) {
|
if (response.stdErr.contains(QLatin1String("Versions other than the selected version"))) {
|
||||||
VersionSelector selector(file, response.stdErr);
|
VersionSelector selector(file, response.stdErr);
|
||||||
@@ -1805,8 +1804,7 @@ bool ClearCasePluginPrivate::vcsOpen(const FilePath &workingDir, const QString &
|
|||||||
ccUpdate(workingDir, QStringList(file));
|
ccUpdate(workingDir, QStringList(file));
|
||||||
else
|
else
|
||||||
args.removeOne(QLatin1String("-query"));
|
args.removeOne(QLatin1String("-query"));
|
||||||
response = runCleartool(topLevel, args, m_settings.timeOutS,
|
response = runCleartool(topLevel, args, m_settings.timeOutS, s_verboseRun);
|
||||||
ShellCommand::ShowStdOut | ShellCommand::FullySynchronously);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
VcsOutputWindow::append(response.stdOut);
|
VcsOutputWindow::append(response.stdOut);
|
||||||
@@ -1884,8 +1882,7 @@ bool ClearCasePluginPrivate::vcsCheckIn(const FilePath &messageFile, const QStri
|
|||||||
blockers.append(fcb);
|
blockers.append(fcb);
|
||||||
}
|
}
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(m_checkInView, args, m_settings.longTimeOutS(),
|
runCleartool(m_checkInView, args, m_settings.longTimeOutS(), ShellCommand::ShowStdOut);
|
||||||
ShellCommand::ShowStdOut);
|
|
||||||
const QRegularExpression checkedIn("Checked in \\\"([^\"]*)\\\"");
|
const QRegularExpression checkedIn("Checked in \\\"([^\"]*)\\\"");
|
||||||
QRegularExpressionMatch match = checkedIn.match(response.stdOut);
|
QRegularExpressionMatch match = checkedIn.match(response.stdOut);
|
||||||
bool anySucceeded = false;
|
bool anySucceeded = false;
|
||||||
@@ -1953,7 +1950,7 @@ bool ClearCasePluginPrivate::ccFileOp(const FilePath &workingDir, const QString
|
|||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("checkout") << commentArg << dirName;
|
args << QLatin1String("checkout") << commentArg << dirName;
|
||||||
const ClearCaseResponse coResponse = runCleartool(workingDir, args, m_settings.timeOutS,
|
const ClearCaseResponse coResponse = runCleartool(workingDir, args, m_settings.timeOutS,
|
||||||
ShellCommand::ShowStdOut | ShellCommand::FullySynchronously);
|
s_verboseRun);
|
||||||
if (coResponse.error) {
|
if (coResponse.error) {
|
||||||
if (coResponse.stdErr.contains(QLatin1String("already checked out")))
|
if (coResponse.stdErr.contains(QLatin1String("already checked out")))
|
||||||
noCheckout = true;
|
noCheckout = true;
|
||||||
@@ -1967,7 +1964,7 @@ bool ClearCasePluginPrivate::ccFileOp(const FilePath &workingDir, const QString
|
|||||||
if (!file2.isEmpty())
|
if (!file2.isEmpty())
|
||||||
args << QDir::toNativeSeparators(file2);
|
args << QDir::toNativeSeparators(file2);
|
||||||
const ClearCaseResponse opResponse = runCleartool(workingDir, args, m_settings.timeOutS,
|
const ClearCaseResponse opResponse = runCleartool(workingDir, args, m_settings.timeOutS,
|
||||||
ShellCommand::ShowStdOut | ShellCommand::FullySynchronously);
|
s_verboseRun);
|
||||||
if (opResponse.error) {
|
if (opResponse.error) {
|
||||||
// on failure - undo checkout for the directory
|
// on failure - undo checkout for the directory
|
||||||
if (!noCheckout)
|
if (!noCheckout)
|
||||||
@@ -1980,7 +1977,7 @@ bool ClearCasePluginPrivate::ccFileOp(const FilePath &workingDir, const QString
|
|||||||
args.clear();
|
args.clear();
|
||||||
args << QLatin1String("checkin") << commentArg << dirName;
|
args << QLatin1String("checkin") << commentArg << dirName;
|
||||||
const ClearCaseResponse ciResponse = runCleartool(workingDir, args, m_settings.timeOutS,
|
const ClearCaseResponse ciResponse = runCleartool(workingDir, args, m_settings.timeOutS,
|
||||||
ShellCommand::ShowStdOut | ShellCommand::FullySynchronously);
|
s_verboseRun);
|
||||||
return !ciResponse.error;
|
return !ciResponse.error;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -2263,7 +2260,7 @@ QString ClearCasePluginPrivate::getFile(const QString &nativeFile, const QString
|
|||||||
QStringList args(QLatin1String("get"));
|
QStringList args(QLatin1String("get"));
|
||||||
args << QLatin1String("-to") << tempFile << nativeFile;
|
args << QLatin1String("-to") << tempFile << nativeFile;
|
||||||
const ClearCaseResponse response =
|
const ClearCaseResponse response =
|
||||||
runCleartool(m_topLevel, args, m_settings.timeOutS, SilentRun);
|
runCleartool(m_topLevel, args, m_settings.timeOutS, s_silentRun);
|
||||||
if (response.error)
|
if (response.error)
|
||||||
return QString();
|
return QString();
|
||||||
QFile::setPermissions(tempFile, QFile::ReadOwner | QFile::ReadUser |
|
QFile::setPermissions(tempFile, QFile::ReadOwner | QFile::ReadUser |
|
||||||
|
Reference in New Issue
Block a user