forked from qt-creator/qt-creator
Subversion: More direct access to client singleton
Change-Id: I4263b07da9970101dbbc798dbf64359c1da5199b Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -291,6 +291,12 @@ void SubversionClient::describe(const FilePath &workingDirectory, int changeNumb
|
|||||||
controller->requestReload();
|
controller->requestReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SubversionClient &subversionClient()
|
||||||
|
{
|
||||||
|
static SubversionClient theSubversionClient;
|
||||||
|
return theSubversionClient;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Subversion
|
} // namespace Subversion
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ private:
|
|||||||
mutable QString m_svnVersion;
|
mutable QString m_svnVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SubversionClient &subversionClient();
|
||||||
|
|
||||||
Utils::CommandLine &operator<<(Utils::CommandLine &command, SubversionClient::AddAuthOptions);
|
Utils::CommandLine &operator<<(Utils::CommandLine &command, SubversionClient::AddAuthOptions);
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -189,9 +189,6 @@ public:
|
|||||||
|
|
||||||
bool isVcsDirectory(const Utils::FilePath &fileName) const;
|
bool isVcsDirectory(const Utils::FilePath &fileName) const;
|
||||||
|
|
||||||
///
|
|
||||||
SubversionClient *client();
|
|
||||||
|
|
||||||
SubversionSubmitEditor *openSubversionSubmitEditor(const QString &fileName);
|
SubversionSubmitEditor *openSubversionSubmitEditor(const QString &fileName);
|
||||||
|
|
||||||
// IVersionControl
|
// IVersionControl
|
||||||
@@ -252,7 +249,6 @@ private:
|
|||||||
|
|
||||||
const QStringList m_svnDirectories;
|
const QStringList m_svnDirectories;
|
||||||
|
|
||||||
SubversionClient *m_client = nullptr;
|
|
||||||
QString m_commitMessageFileName;
|
QString m_commitMessageFileName;
|
||||||
FilePath m_commitRepository;
|
FilePath m_commitRepository;
|
||||||
|
|
||||||
@@ -301,7 +297,6 @@ static SubversionPluginPrivate *dd = nullptr;
|
|||||||
SubversionPluginPrivate::~SubversionPluginPrivate()
|
SubversionPluginPrivate::~SubversionPluginPrivate()
|
||||||
{
|
{
|
||||||
cleanCommitMessageFile();
|
cleanCommitMessageFile();
|
||||||
delete m_client;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubversionPluginPrivate::cleanCommitMessageFile()
|
void SubversionPluginPrivate::cleanCommitMessageFile()
|
||||||
@@ -324,8 +319,6 @@ SubversionPluginPrivate::SubversionPluginPrivate()
|
|||||||
{
|
{
|
||||||
dd = this;
|
dd = this;
|
||||||
|
|
||||||
m_client = new SubversionClient();
|
|
||||||
|
|
||||||
setTopicCache(new SubversionTopicCache(this));
|
setTopicCache(new SubversionTopicCache(this));
|
||||||
|
|
||||||
using namespace Constants;
|
using namespace Constants;
|
||||||
@@ -509,11 +502,6 @@ bool SubversionPluginPrivate::isVcsDirectory(const FilePath &fileName) const
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SubversionClient *SubversionPluginPrivate::client()
|
|
||||||
{
|
|
||||||
return m_client;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SubversionPluginPrivate::activateCommit()
|
bool SubversionPluginPrivate::activateCommit()
|
||||||
{
|
{
|
||||||
if (!isCommitEditorOpen())
|
if (!isCommitEditorOpen())
|
||||||
@@ -536,7 +524,7 @@ bool SubversionPluginPrivate::activateCommit()
|
|||||||
if (!fileList.empty()) {
|
if (!fileList.empty()) {
|
||||||
// get message & commit
|
// get message & commit
|
||||||
closeEditor = DocumentManager::saveDocument(editorDocument)
|
closeEditor = DocumentManager::saveDocument(editorDocument)
|
||||||
&& m_client->doCommit(m_commitRepository, fileList, m_commitMessageFileName);
|
&& subversionClient().doCommit(m_commitRepository, fileList, m_commitMessageFileName);
|
||||||
if (closeEditor)
|
if (closeEditor)
|
||||||
cleanCommitMessageFile();
|
cleanCommitMessageFile();
|
||||||
}
|
}
|
||||||
@@ -545,7 +533,7 @@ bool SubversionPluginPrivate::activateCommit()
|
|||||||
|
|
||||||
void SubversionPluginPrivate::diffCommitFiles(const QStringList &files)
|
void SubversionPluginPrivate::diffCommitFiles(const QStringList &files)
|
||||||
{
|
{
|
||||||
m_client->showDiffEditor(m_commitRepository, files);
|
subversionClient().showDiffEditor(m_commitRepository, files);
|
||||||
}
|
}
|
||||||
|
|
||||||
SubversionSubmitEditor *SubversionPluginPrivate::openSubversionSubmitEditor(const QString &fileName)
|
SubversionSubmitEditor *SubversionPluginPrivate::openSubversionSubmitEditor(const QString &fileName)
|
||||||
@@ -663,7 +651,7 @@ void SubversionPluginPrivate::diffProject()
|
|||||||
const VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasProject(), return);
|
QTC_ASSERT(state.hasProject(), return);
|
||||||
const QString relativeProject = state.relativeCurrentProject();
|
const QString relativeProject = state.relativeCurrentProject();
|
||||||
m_client->showDiffEditor(state.currentProjectTopLevel(),
|
subversionClient().showDiffEditor(state.currentProjectTopLevel(),
|
||||||
relativeProject.isEmpty() ? QStringList()
|
relativeProject.isEmpty() ? QStringList()
|
||||||
: QStringList(relativeProject));
|
: QStringList(relativeProject));
|
||||||
}
|
}
|
||||||
@@ -672,7 +660,7 @@ void SubversionPluginPrivate::diffCurrentFile()
|
|||||||
{
|
{
|
||||||
const VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasFile(), return);
|
QTC_ASSERT(state.hasFile(), return);
|
||||||
m_client->showDiffEditor(state.currentFileTopLevel(), {state.relativeCurrentFile()});
|
subversionClient().showDiffEditor(state.currentFileTopLevel(), {state.relativeCurrentFile()});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubversionPluginPrivate::startCommitCurrentFile()
|
void SubversionPluginPrivate::startCommitCurrentFile()
|
||||||
@@ -769,7 +757,7 @@ void SubversionPluginPrivate::diffRepository()
|
|||||||
{
|
{
|
||||||
const VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return);
|
QTC_ASSERT(state.hasTopLevel(), return);
|
||||||
m_client->showDiffEditor(state.topLevel());
|
subversionClient().showDiffEditor(state.topLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubversionPluginPrivate::statusRepository()
|
void SubversionPluginPrivate::statusRepository()
|
||||||
@@ -801,7 +789,7 @@ void SubversionPluginPrivate::filelog(const FilePath &workingDir,
|
|||||||
const QString &file,
|
const QString &file,
|
||||||
bool enableAnnotationContextMenu)
|
bool enableAnnotationContextMenu)
|
||||||
{
|
{
|
||||||
m_client->log(workingDir, QStringList(file), QStringList(), enableAnnotationContextMenu,
|
subversionClient().log(workingDir, QStringList(file), QStringList(), enableAnnotationContextMenu,
|
||||||
[](CommandLine &command) { command << SubversionClient::AddAuthOptions(); });
|
[](CommandLine &command) { command << SubversionClient::AddAuthOptions(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,7 +886,7 @@ void SubversionPluginPrivate::vcsDescribe(const FilePath &source, const QString
|
|||||||
|
|
||||||
const QString title = QString::fromLatin1("svn describe %1#%2").arg(fi.fileName(), changeNr);
|
const QString title = QString::fromLatin1("svn describe %1#%2").arg(fi.fileName(), changeNr);
|
||||||
|
|
||||||
m_client->describe(topLevel, number, title);
|
subversionClient().describe(topLevel, number, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubversionPluginPrivate::slotDescribe()
|
void SubversionPluginPrivate::slotDescribe()
|
||||||
@@ -926,7 +914,7 @@ CommandResult SubversionPluginPrivate::runSvn(const FilePath &workingDir,
|
|||||||
return CommandResult(ProcessResult::StartFailed, Tr::tr("No subversion executable specified."));
|
return CommandResult(ProcessResult::StartFailed, Tr::tr("No subversion executable specified."));
|
||||||
|
|
||||||
const int timeoutS = settings().timeout() * timeoutMutiplier;
|
const int timeoutS = settings().timeout() * timeoutMutiplier;
|
||||||
return m_client->vcsSynchronousExec(workingDir, command, flags, timeoutS, outputCodec);
|
return subversionClient().vcsSynchronousExec(workingDir, command, flags, timeoutS, outputCodec);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEditor *SubversionPluginPrivate::showOutputInEditor(const QString &title, const QString &output,
|
IEditor *SubversionPluginPrivate::showOutputInEditor(const QString &title, const QString &output,
|
||||||
@@ -975,7 +963,7 @@ QString SubversionPluginPrivate::monitorFile(const FilePath &repository) const
|
|||||||
|
|
||||||
QString SubversionPluginPrivate::synchronousTopic(const FilePath &repository) const
|
QString SubversionPluginPrivate::synchronousTopic(const FilePath &repository) const
|
||||||
{
|
{
|
||||||
return m_client->synchronousTopic(repository);
|
return subversionClient().synchronousTopic(repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubversionPluginPrivate::vcsAdd(const FilePath &workingDir, const QString &rawFileName)
|
bool SubversionPluginPrivate::vcsAdd(const FilePath &workingDir, const QString &rawFileName)
|
||||||
@@ -1167,7 +1155,7 @@ VcsCommand *SubversionPluginPrivate::createInitialCheckoutCommand(const QString
|
|||||||
args << SubversionClient::AddAuthOptions();
|
args << SubversionClient::AddAuthOptions();
|
||||||
args << Subversion::Constants::NON_INTERACTIVE_OPTION << extraArgs << url << localName;
|
args << Subversion::Constants::NON_INTERACTIVE_OPTION << extraArgs << url << localName;
|
||||||
|
|
||||||
auto command = VcsBaseClient::createVcsCommand(baseDirectory, m_client->processEnvironment());
|
auto command = VcsBaseClient::createVcsCommand(baseDirectory, subversionClient().processEnvironment());
|
||||||
command->addJob(args, -1);
|
command->addJob(args, -1);
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user