forked from qt-creator/qt-creator
ClearCasePlugin: Remove runCleartoolSync()
Replace it with runCleartoolProc(). Change-Id: I04172aa1506cbe20e9c8d870b697b899cfcca7bf Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -254,7 +254,6 @@ private:
|
|||||||
QString findTopLevel(const FilePath &directory) const;
|
QString findTopLevel(const FilePath &directory) const;
|
||||||
IEditor *showOutputInEditor(const QString& title, const QString &output, Id id,
|
IEditor *showOutputInEditor(const QString& title, const QString &output, Id id,
|
||||||
const QString &source, QTextCodec *codec) const;
|
const QString &source, QTextCodec *codec) const;
|
||||||
QString runCleartoolSync(const FilePath &workingDir, const QStringList &arguments) const;
|
|
||||||
CommandResult runCleartoolProc(const FilePath &workingDir,
|
CommandResult runCleartoolProc(const FilePath &workingDir,
|
||||||
const QStringList &arguments) const;
|
const QStringList &arguments) const;
|
||||||
CommandResult runCleartool(const FilePath &workingDir, const QStringList &arguments,
|
CommandResult runCleartool(const FilePath &workingDir, const QStringList &arguments,
|
||||||
@@ -428,12 +427,8 @@ FileStatus::Status ClearCasePluginPrivate::getFileStatus(const QString &fileName
|
|||||||
QTC_CHECK(!fileName.isEmpty());
|
QTC_CHECK(!fileName.isEmpty());
|
||||||
|
|
||||||
const QDir viewRootDir = QFileInfo(fileName).dir();
|
const QDir viewRootDir = QFileInfo(fileName).dir();
|
||||||
const QString viewRoot = viewRootDir.path();
|
const QString buffer = runCleartoolProc(FilePath::fromString(viewRootDir.path()),
|
||||||
|
{"ls", fileName}).cleanedStdOut();
|
||||||
QStringList args(QLatin1String("ls"));
|
|
||||||
args << fileName;
|
|
||||||
QString buffer = runCleartoolSync(FilePath::fromString(viewRoot), args);
|
|
||||||
|
|
||||||
const int atatpos = buffer.indexOf(QLatin1String("@@"));
|
const int atatpos = buffer.indexOf(QLatin1String("@@"));
|
||||||
if (atatpos != -1) { // probably a managed file
|
if (atatpos != -1) { // probably a managed file
|
||||||
const QString absFile =
|
const QString absFile =
|
||||||
@@ -1142,8 +1137,8 @@ void ClearCasePluginPrivate::undoHijackCurrent()
|
|||||||
bool keep = false;
|
bool keep = false;
|
||||||
bool askKeep = true;
|
bool askKeep = true;
|
||||||
if (m_settings.extDiffAvailable) {
|
if (m_settings.extDiffAvailable) {
|
||||||
QString diffres = diffExternal(ccGetFileVersion(state.topLevel(), fileName), fileName);
|
const QString result = diffExternal(ccGetFileVersion(state.topLevel(), fileName), fileName);
|
||||||
if (diffres.at(0) == QLatin1Char('F')) // Files are identical
|
if (!result.isEmpty() && result.front() == QLatin1Char('F')) // Files are identical
|
||||||
askKeep = false;
|
askKeep = false;
|
||||||
}
|
}
|
||||||
if (askKeep) {
|
if (askKeep) {
|
||||||
@@ -1165,9 +1160,7 @@ void ClearCasePluginPrivate::undoHijackCurrent()
|
|||||||
|
|
||||||
QString ClearCasePluginPrivate::ccGetFileVersion(const FilePath &workingDir, const QString &file) const
|
QString ClearCasePluginPrivate::ccGetFileVersion(const FilePath &workingDir, const QString &file) const
|
||||||
{
|
{
|
||||||
QStringList args(QLatin1String("ls"));
|
return runCleartoolProc(workingDir, {"ls", "-short", file}).cleanedStdOut().trimmed();
|
||||||
args << QLatin1String("-short") << file;
|
|
||||||
return runCleartoolSync(workingDir, args).trimmed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearCasePluginPrivate::ccDiffWithPred(const FilePath &workingDir, const QStringList &files)
|
void ClearCasePluginPrivate::ccDiffWithPred(const FilePath &workingDir, const QStringList &files)
|
||||||
@@ -1625,12 +1618,6 @@ void ClearCasePluginPrivate::commitFromEditor()
|
|||||||
EditorManager::closeDocuments({submitEditor()->document()});
|
EditorManager::closeDocuments({submitEditor()->document()});
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ClearCasePluginPrivate::runCleartoolSync(const FilePath &workingDir,
|
|
||||||
const QStringList &arguments) const
|
|
||||||
{
|
|
||||||
return runCleartoolProc(workingDir, arguments).cleanedStdOut();
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandResult ClearCasePluginPrivate::runCleartoolProc(const FilePath &workingDir,
|
CommandResult ClearCasePluginPrivate::runCleartoolProc(const FilePath &workingDir,
|
||||||
const QStringList &arguments) const
|
const QStringList &arguments) const
|
||||||
{
|
{
|
||||||
@@ -2007,10 +1994,8 @@ bool ClearCasePluginPrivate::managesDirectory(const FilePath &directory, FilePat
|
|||||||
|
|
||||||
QString ClearCasePluginPrivate::ccGetCurrentActivity() const
|
QString ClearCasePluginPrivate::ccGetCurrentActivity() const
|
||||||
{
|
{
|
||||||
QStringList args(QLatin1String("lsactivity"));
|
return runCleartoolProc(currentState().topLevel(), {"lsactivity", "-cact", "-fmt", "%n"})
|
||||||
args << QLatin1String("-cact");
|
.cleanedStdOut();
|
||||||
args << QLatin1String("-fmt") << QLatin1String("%n");
|
|
||||||
return runCleartoolSync(currentState().topLevel(), args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QStringPair> ClearCasePluginPrivate::ccGetActivities() const
|
QList<QStringPair> ClearCasePluginPrivate::ccGetActivities() const
|
||||||
@@ -2020,9 +2005,8 @@ QList<QStringPair> ClearCasePluginPrivate::ccGetActivities() const
|
|||||||
QStringPair rebaseAct;
|
QStringPair rebaseAct;
|
||||||
QStringPair deliverAct;
|
QStringPair deliverAct;
|
||||||
// Retrieve all activities
|
// Retrieve all activities
|
||||||
QStringList args(QLatin1String("lsactivity"));
|
const QString response = runCleartoolProc(currentState().topLevel(),
|
||||||
args << QLatin1String("-fmt") << QLatin1String("%n\\t%[headline]p\\n");
|
{"lsactivity", "-fmt", "%n\\t%[headline]p\\n"}).cleanedStdOut();
|
||||||
const QString response = runCleartoolSync(currentState().topLevel(), args);
|
|
||||||
const QStringList acts = response.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
|
const QStringList acts = response.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
|
||||||
for (const QString &activity : acts) {
|
for (const QString &activity : acts) {
|
||||||
QStringList act = activity.split(QLatin1Char('\t'));
|
QStringList act = activity.split(QLatin1Char('\t'));
|
||||||
@@ -2102,10 +2086,8 @@ bool ClearCasePluginPrivate::newActivity()
|
|||||||
// check if the view is UCM
|
// check if the view is UCM
|
||||||
bool ClearCasePluginPrivate::ccCheckUcm(const QString &viewname, const FilePath &workingDir) const
|
bool ClearCasePluginPrivate::ccCheckUcm(const QString &viewname, const FilePath &workingDir) const
|
||||||
{
|
{
|
||||||
QStringList catcsArgs(QLatin1String("catcs"));
|
const QString catcsData = runCleartoolProc(workingDir,
|
||||||
catcsArgs << QLatin1String("-tag") << viewname;
|
{"catcs", "-tag", viewname}).cleanedStdOut();
|
||||||
QString catcsData = runCleartoolSync(workingDir, catcsArgs);
|
|
||||||
|
|
||||||
// check output for the word "ucm"
|
// check output for the word "ucm"
|
||||||
return catcsData.indexOf(QRegularExpression("(^|\\n)ucm\\n")) != -1;
|
return catcsData.indexOf(QRegularExpression("(^|\\n)ucm\\n")) != -1;
|
||||||
}
|
}
|
||||||
@@ -2124,9 +2106,7 @@ ViewData ClearCasePluginPrivate::ccGetView(const FilePath &workingDir) const
|
|||||||
bool inCache = viewCache.contains(workingDir);
|
bool inCache = viewCache.contains(workingDir);
|
||||||
ViewData &res = viewCache[workingDir];
|
ViewData &res = viewCache[workingDir];
|
||||||
if (!inCache) {
|
if (!inCache) {
|
||||||
QStringList args(QLatin1String("lsview"));
|
const QString data = runCleartoolProc(workingDir, {"lsview", "-cview"}).cleanedStdOut();
|
||||||
args << QLatin1String("-cview");
|
|
||||||
QString data = runCleartoolSync(workingDir, args);
|
|
||||||
res.isDynamic = !data.isEmpty() && (data.at(0) == QLatin1Char('*'));
|
res.isDynamic = !data.isEmpty() && (data.at(0) == QLatin1Char('*'));
|
||||||
res.name = data.mid(2, data.indexOf(QLatin1Char(' '), 2) - 2);
|
res.name = data.mid(2, data.indexOf(QLatin1Char(' '), 2) - 2);
|
||||||
res.isUcm = ccCheckUcm(res.name, workingDir);
|
res.isUcm = ccCheckUcm(res.name, workingDir);
|
||||||
@@ -2138,20 +2118,17 @@ ViewData ClearCasePluginPrivate::ccGetView(const FilePath &workingDir) const
|
|||||||
|
|
||||||
QString ClearCasePluginPrivate::ccGetComment(const FilePath &workingDir, const QString &fileName) const
|
QString ClearCasePluginPrivate::ccGetComment(const FilePath &workingDir, const QString &fileName) const
|
||||||
{
|
{
|
||||||
QStringList args(QLatin1String("describe"));
|
return runCleartoolProc(workingDir, {"describe", "-fmt", "%c", fileName}).cleanedStdOut();
|
||||||
args << QLatin1String("-fmt") << QLatin1String("%c") << fileName;
|
|
||||||
return runCleartoolSync(workingDir, args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearCasePluginPrivate::updateStreamAndView()
|
void ClearCasePluginPrivate::updateStreamAndView()
|
||||||
{
|
{
|
||||||
QStringList args(QLatin1String("lsstream"));
|
const QString result = runCleartoolProc(m_topLevel,
|
||||||
args << QLatin1String("-fmt") << QLatin1String("%n\\t%[def_deliver_tgt]Xp");
|
{"lsstream", "-fmt", "%n\\t%[def_deliver_tgt]Xp"}).cleanedStdOut();
|
||||||
const QString sresponse = runCleartoolSync(m_topLevel, args);
|
const int tabPos = result.indexOf(QLatin1Char('\t'));
|
||||||
int tabPos = sresponse.indexOf(QLatin1Char('\t'));
|
m_stream = result.left(tabPos);
|
||||||
m_stream = sresponse.left(tabPos);
|
|
||||||
const QRegularExpression intStreamExp("stream:([^@]*)");
|
const QRegularExpression intStreamExp("stream:([^@]*)");
|
||||||
const QRegularExpressionMatch match = intStreamExp.match(sresponse.mid(tabPos + 1));
|
const QRegularExpressionMatch match = intStreamExp.match(result.mid(tabPos + 1));
|
||||||
if (match.hasMatch())
|
if (match.hasMatch())
|
||||||
m_intStream = match.captured(1);
|
m_intStream = match.captured(1);
|
||||||
m_viewData = ccGetView(m_topLevel);
|
m_viewData = ccGetView(m_topLevel);
|
||||||
|
Reference in New Issue
Block a user