forked from qt-creator/qt-creator
Subversion: Add vcsTopic
This partially addresses QTCREATORBUG-12929 which is about svn commit no longer showing output which does include the revision number Change-Id: I149f1fea05a63cc80625ba5e02c10edbce471e1a Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -209,6 +209,25 @@ QStringList SubversionClient::addAuthenticationOptions(const QStringList &args,
|
||||
return rc;
|
||||
}
|
||||
|
||||
QString SubversionClient::synchronousTopic(const QString &repository)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("info");
|
||||
|
||||
QByteArray stdOut;
|
||||
if (!vcsFullySynchronousExec(repository, args, &stdOut))
|
||||
return QString();
|
||||
|
||||
const QString revisionString = QLatin1String("Revision: ");
|
||||
// stdOut is ASCII only (at least in those areas we care about).
|
||||
QString output = SynchronousProcess::normalizeNewlines(QString::fromLocal8Bit(stdOut));
|
||||
foreach (const QString &line, output.split(QLatin1Char('\n'))) {
|
||||
if (line.startsWith(revisionString))
|
||||
return QString::fromLatin1("r") + line.mid(revisionString.count());
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
void SubversionClient::diff(const QString &workingDir, const QStringList &files,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
|
||||
@@ -81,6 +81,8 @@ public:
|
||||
const QString &userName = QString(),
|
||||
const QString &password = QString());
|
||||
|
||||
QString synchronousTopic(const QString &repository);
|
||||
|
||||
protected:
|
||||
Core::Id vcsEditorKind(VcsCommandTag cmd) const;
|
||||
VcsBase::VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir,
|
||||
|
||||
@@ -36,13 +36,35 @@
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace Subversion;
|
||||
using namespace Subversion::Internal;
|
||||
namespace Subversion {
|
||||
namespace Internal {
|
||||
|
||||
class SubversionTopicCache : public Core::IVersionControl::TopicCache
|
||||
{
|
||||
public:
|
||||
SubversionTopicCache(SubversionPlugin *plugin) :
|
||||
m_plugin(plugin)
|
||||
{ }
|
||||
|
||||
protected:
|
||||
QString trackFile(const QString &repository)
|
||||
{
|
||||
return m_plugin->monitorFile(repository);
|
||||
}
|
||||
|
||||
QString refreshTopic(const QString &repository)
|
||||
{
|
||||
return m_plugin->synchronousTopic(repository);
|
||||
}
|
||||
|
||||
private:
|
||||
SubversionPlugin *m_plugin;
|
||||
};
|
||||
|
||||
SubversionControl::SubversionControl(SubversionPlugin *plugin) :
|
||||
Core::IVersionControl(new SubversionTopicCache(plugin)),
|
||||
m_plugin(plugin)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
QString SubversionControl::displayName() const
|
||||
{
|
||||
@@ -153,3 +175,6 @@ void SubversionControl::emitConfigurationChanged()
|
||||
{
|
||||
emit configurationChanged();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Subversion
|
||||
|
||||
@@ -1074,6 +1074,25 @@ SubversionPlugin *SubversionPlugin::instance()
|
||||
return m_subversionPluginInstance;
|
||||
}
|
||||
|
||||
QString SubversionPlugin::monitorFile(const QString &repository) const
|
||||
{
|
||||
QTC_ASSERT(!repository.isEmpty(), return QString());
|
||||
QDir repoDir(repository);
|
||||
foreach (const QString &svnDir, m_svnDirectories) {
|
||||
if (repoDir.exists(svnDir)) {
|
||||
QFileInfo fi(repoDir.absoluteFilePath(svnDir + QLatin1String("/wc.db")));
|
||||
if (fi.exists() && fi.isFile())
|
||||
return fi.absoluteFilePath();
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString SubversionPlugin::synchronousTopic(const QString &repository) const
|
||||
{
|
||||
return m_client->synchronousTopic(repository);
|
||||
}
|
||||
|
||||
bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
|
||||
{
|
||||
const QString file = QDir::toNativeSeparators(rawFileName);
|
||||
|
||||
@@ -91,6 +91,9 @@ public:
|
||||
|
||||
static SubversionPlugin *instance();
|
||||
|
||||
QString monitorFile(const QString &repository) const;
|
||||
QString synchronousTopic(const QString &repository) const;
|
||||
|
||||
public slots:
|
||||
void vcsAnnotate(const QString &workingDir, const QString &file,
|
||||
const QString &revision = QString(), int lineNumber = -1);
|
||||
|
||||
Reference in New Issue
Block a user