aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cvs
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2013-08-06 15:14:54 +0300
committerOrgad Shaneh <orgads@gmail.com>2013-08-07 17:43:58 +0200
commit35798d4ad6603c6bcbff1bbafdb07d10cfab96a9 (patch)
tree6351cde2be461e9392209241799560e2afcafec0 /src/plugins/cvs
parent92afe048ef19b77e35d2ea240d292b6d08bdf43b (diff)
VCS: Use a single filename for log
The list always contains a single entry (or none) anyway Take 2. This time it actually compiles ;-) Change-Id: I71a9822360a9b569ba79afa0f575e27918bb2e03 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins/cvs')
-rw-r--r--src/plugins/cvs/cvsplugin.cpp40
-rw-r--r--src/plugins/cvs/cvsplugin.h8
2 files changed, 26 insertions, 22 deletions
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index d0c3bd8e370..fbaeb0fdd0a 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -724,7 +724,9 @@ void CvsPlugin::diffProject()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
- cvsDiff(state.currentProjectTopLevel(), state.relativeCurrentProject());
+ const QString relativeProject = state.relativeCurrentProject();
+ cvsDiff(state.currentProjectTopLevel(),
+ relativeProject.isEmpty() ? QStringList() : QStringList(relativeProject));
}
void CvsPlugin::diffCurrentFile()
@@ -738,7 +740,7 @@ void CvsPlugin::startCommitCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
- startCommit(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
+ startCommit(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void CvsPlugin::startCommitAll()
@@ -751,7 +753,7 @@ void CvsPlugin::startCommitAll()
/* Start commit of files of a single repository by displaying
* template and files in a submit editor. On closing, the real
* commit will start. */
-void CvsPlugin::startCommit(const QString &workingDir, const QStringList &files)
+void CvsPlugin::startCommit(const QString &workingDir, const QString &file)
{
if (raiseSubmitEditor())
return;
@@ -770,9 +772,9 @@ void CvsPlugin::startCommit(const QString &workingDir, const QStringList &files)
// Get list of added/modified/deleted files and purge out undesired ones
// (do not run status with relative arguments as it will omit the directories)
StateList statusOutput = parseStatusOutput(QString(), response.stdOut);
- if (!files.isEmpty()) {
+ if (!file.isEmpty()) {
for (StateList::iterator it = statusOutput.begin(); it != statusOutput.end() ; ) {
- if (files.contains(it->second))
+ if (file == it->second)
++it;
else
it = statusOutput.erase(it);
@@ -821,7 +823,7 @@ void CvsPlugin::filelogCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
- filelog(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), true);
+ filelog(state.currentFileTopLevel(), state.relativeCurrentFile(), true);
}
void CvsPlugin::logProject()
@@ -839,16 +841,16 @@ void CvsPlugin::logRepository()
}
void CvsPlugin::filelog(const QString &workingDir,
- const QStringList &files,
+ const QString &file,
bool enableAnnotationContextMenu)
{
- QTextCodec *codec = VcsBaseEditorWidget::getCodec(workingDir, files);
+ QTextCodec *codec = VcsBaseEditorWidget::getCodec(workingDir, QStringList(file));
// no need for temp file
- const QString id = VcsBaseEditorWidget::getTitleId(workingDir, files);
- const QString source = VcsBaseEditorWidget::getSource(workingDir, files);
+ const QString id = VcsBaseEditorWidget::getTitleId(workingDir, QStringList(file));
+ const QString source = VcsBaseEditorWidget::getSource(workingDir, file);
QStringList args;
args << QLatin1String("log");
- args.append(files);
+ args.append(file);
const CvsResponse response =
runCvs(workingDir, args, m_settings.timeOutMS(),
SshPasswordPrompt, codec);
@@ -857,7 +859,7 @@ void CvsPlugin::filelog(const QString &workingDir,
// Re-use an existing view if possible to support
// the common usage pattern of continuously changing and diffing a file
- const QString tag = VcsBaseEditorWidget::editorTag(LogOutput, workingDir, files);
+ const QString tag = VcsBaseEditorWidget::editorTag(LogOutput, workingDir, QStringList(file));
if (Core::IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) {
editor->document()->setContents(response.stdOut.toUtf8());
Core::EditorManager::activateEditor(editor);
@@ -877,11 +879,12 @@ void CvsPlugin::updateProject()
update(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
-bool CvsPlugin::update(const QString &topLevel, const QStringList &files)
+bool CvsPlugin::update(const QString &topLevel, const QString &file)
{
QStringList args(QLatin1String("update"));
args.push_back(QLatin1String("-dR"));
- args.append(files);
+ if (!file.isEmpty())
+ args.append(file);
const CvsResponse response =
runCvs(topLevel, args, m_settings.longTimeOutMS(),
SshPasswordPrompt|ShowStdOutInLogWindow);
@@ -1012,10 +1015,11 @@ void CvsPlugin::annotate(const QString &workingDir, const QString &file,
}
}
-bool CvsPlugin::status(const QString &topLevel, const QStringList &files, const QString &title)
+bool CvsPlugin::status(const QString &topLevel, const QString &file, const QString &title)
{
QStringList args(QLatin1String("status"));
- args.append(files);
+ if (!file.isEmpty())
+ args.append(file);
const CvsResponse response =
runCvs(topLevel, args, m_settings.timeOutMS(), 0);
const bool ok = response.result == CvsResponse::Ok;
@@ -1049,14 +1053,14 @@ void CvsPlugin::statusRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- status(state.topLevel(), QStringList(), tr("Repository status"));
+ status(state.topLevel(), QString(), tr("Repository status"));
}
void CvsPlugin::updateRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
- update(state.topLevel(), QStringList());
+ update(state.topLevel(), QString());
}
diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h
index 09b8a435220..9608cd2e1bd 100644
--- a/src/plugins/cvs/cvsplugin.h
+++ b/src/plugins/cvs/cvsplugin.h
@@ -150,16 +150,16 @@ private:
bool describe(const QString &toplevel, const QString &source, const QString &changeNr, QString *errorMessage);
bool describe(const QString &repository, QList<CvsLogEntry> entries, QString *errorMessage);
void filelog(const QString &workingDir,
- const QStringList &files = QStringList(),
+ const QString &file = QString(),
bool enableAnnotationContextMenu = false);
bool unedit(const QString &topLevel, const QStringList &files);
- bool status(const QString &topLevel, const QStringList &files, const QString &title);
- bool update(const QString &topLevel, const QStringList &files);
+ bool status(const QString &topLevel, const QString &file, const QString &title);
+ bool update(const QString &topLevel, const QString &file);
bool checkCVSDirectory(const QDir &directory) const;
// Quick check if files are modified
bool diffCheckModified(const QString &topLevel, const QStringList &files, bool *modified);
QString findTopLevelForDirectoryI(const QString &directory) const;
- void startCommit(const QString &workingDir, const QStringList &files = QStringList());
+ void startCommit(const QString &workingDir, const QString &file = QString());
bool commit(const QString &messageFile, const QStringList &subVersionFileList);
void cleanCommitMessageFile();
inline CvsControl *cvsVersionControl() const;