forked from qt-creator/qt-creator
SVN: Show conflicted files in submit editor
So far, they didn't show up in the submit editor, so they could be forgotten during a commit. Unlike Git, these files don't prohibit the commit, but at least are shown in the list of modified files and can be diffed. Change-Id: Ia5cac7befb870321d2048622c1fac022d979c745 Reviewed-by: Hugues Delorme <delorme.hugues@fougue.pro> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
5d3823ac47
commit
a5b7ba58f0
@@ -133,7 +133,7 @@ static inline QString debugCodec(const QTextCodec *c)
|
||||
return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
|
||||
}
|
||||
|
||||
// Parse "svn status" output for added/modified/deleted files
|
||||
// Parse "svn status" output for added/conflicted/deleted/modified files
|
||||
// "M<7blanks>file"
|
||||
typedef QList<SubversionSubmitEditor::StatusFilePair> StatusList;
|
||||
|
||||
@@ -145,8 +145,9 @@ StatusList parseStatusOutput(const QString &output)
|
||||
foreach (const QString &l, list) {
|
||||
const QString line =l.trimmed();
|
||||
if (line.size() > 8) {
|
||||
const QChar state = line.at(0);
|
||||
if (state == QLatin1Char('A') || state == QLatin1Char('D') || state == QLatin1Char('M')) {
|
||||
const QString state = line.left(1);
|
||||
if (state == FileAddedC || state == FileConflictedC
|
||||
|| state == FileDeletedC || state == FileModifiedC) {
|
||||
const QString fileName = line.mid(7); // Column 8 starting from svn 1.6
|
||||
changeSet.push_back(SubversionSubmitEditor::StatusFilePair(QString(state), fileName.trimmed()));
|
||||
}
|
||||
|
||||
@@ -57,6 +57,11 @@ struct SubversionResponse
|
||||
QString message;
|
||||
};
|
||||
|
||||
const char FileAddedC[] = "A";
|
||||
const char FileConflictedC[] = "C";
|
||||
const char FileDeletedC[] = "D";
|
||||
const char FileModifiedC[] = "M";
|
||||
|
||||
class SubversionPlugin : public VcsBase::VcsBasePlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -24,16 +24,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "subversionsubmiteditor.h"
|
||||
#include "subversionplugin.h"
|
||||
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <vcsbase/submiteditorwidget.h>
|
||||
#include <vcsbase/submitfilemodel.h>
|
||||
|
||||
static const char FileAddedC[] = "A";
|
||||
static const char FileConflictedC[] = "C";
|
||||
static const char FileDeletedC[] = "D";
|
||||
static const char FileModifiedC[] = "M";
|
||||
|
||||
using namespace Subversion::Internal;
|
||||
|
||||
SubversionSubmitEditor::SubversionSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *parameters) :
|
||||
@@ -45,7 +41,6 @@ SubversionSubmitEditor::SubversionSubmitEditor(const VcsBase::VcsBaseSubmitEdito
|
||||
|
||||
void SubversionSubmitEditor::setStatusList(const QList<StatusFilePair> &statusOutput)
|
||||
{
|
||||
typedef QList<StatusFilePair>::const_iterator ConstIterator;
|
||||
auto model = new VcsBase::SubmitFileModel(this);
|
||||
// Hack to allow completion in "description" field : completion needs a root repository, the
|
||||
// checkScriptWorkingDirectory property is fine (at this point it was set by SubversionPlugin)
|
||||
@@ -64,9 +59,11 @@ void SubversionSubmitEditor::setStatusList(const QList<StatusFilePair> &statusOu
|
||||
return VcsBase::SubmitFileModel::FileStatusUnknown;
|
||||
} );
|
||||
|
||||
const ConstIterator cend = statusOutput.constEnd();
|
||||
for (ConstIterator it = statusOutput.constBegin(); it != cend; ++it)
|
||||
model->addFile(it->second, it->first);
|
||||
for (const StatusFilePair &pair : statusOutput) {
|
||||
const VcsBase::CheckMode checkMode =
|
||||
(pair.first == FileConflictedC) ? VcsBase::Uncheckable : VcsBase::Unchecked;
|
||||
model->addFile(pair.second, pair.first, checkMode);
|
||||
}
|
||||
setFileModel(model);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
static QString fileFromStatusLine(const QString &statusLine);
|
||||
|
||||
// A list of ( 'A','M','D') status indicators and file names.
|
||||
// A list of ( 'A','C','D','M') status indicators and file names.
|
||||
typedef QPair<QString, QString> StatusFilePair;
|
||||
|
||||
void setStatusList(const QList<StatusFilePair> &statusOutput);
|
||||
|
||||
Reference in New Issue
Block a user