forked from qt-creator/qt-creator
Git: Replace findRepository with VcsManager::findTopLevel
Take advantage of its cache Change-Id: Ibf3b3b59821a92cd4475c6f8d6dd8212983d5c96 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
166c1f51a4
commit
0544f9dd05
@@ -33,6 +33,8 @@
|
|||||||
#include "gitclient.h"
|
#include "gitclient.h"
|
||||||
#include "ui_changeselectiondialog.h"
|
#include "ui_changeselectiondialog.h"
|
||||||
|
|
||||||
|
#include <coreplugin/vcsmanager.h>
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@@ -142,7 +144,7 @@ QString ChangeSelectionDialog::workingDirectory() const
|
|||||||
if (workingDir.isEmpty() || !QDir(workingDir).exists())
|
if (workingDir.isEmpty() || !QDir(workingDir).exists())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
return GitPlugin::instance()->gitClient()->findRepositoryForDirectory(workingDir);
|
return Core::VcsManager::findTopLevelForDirectory(workingDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeCommand ChangeSelectionDialog::command() const
|
ChangeCommand ChangeSelectionDialog::command() const
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
|||||||
QString repository;
|
QString repository;
|
||||||
bool verifiedRepository = false;
|
bool verifiedRepository = false;
|
||||||
if (!m_dialog.isNull() && !m_parameters.isNull() && QFile::exists(m_dialog->repositoryPath()))
|
if (!m_dialog.isNull() && !m_parameters.isNull() && QFile::exists(m_dialog->repositoryPath()))
|
||||||
repository = client->findRepositoryForDirectory(m_dialog->repositoryPath());
|
repository = Core::VcsManager::findTopLevelForDirectory(m_dialog->repositoryPath());
|
||||||
|
|
||||||
if (!repository.isEmpty()) {
|
if (!repository.isEmpty()) {
|
||||||
// Check if remote from a working dir is the same as remote from patch
|
// Check if remote from a working dir is the same as remote from patch
|
||||||
|
|||||||
@@ -2215,7 +2215,7 @@ QProcessEnvironment GitClient::processEnvironment() const
|
|||||||
bool GitClient::beginStashScope(const QString &workingDirectory, const QString &command,
|
bool GitClient::beginStashScope(const QString &workingDirectory, const QString &command,
|
||||||
StashFlag flag, PushAction pushAction)
|
StashFlag flag, PushAction pushAction)
|
||||||
{
|
{
|
||||||
const QString repoDirectory = findRepositoryForDirectory(workingDirectory);
|
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
|
||||||
QTC_ASSERT(!repoDirectory.isEmpty(), return false);
|
QTC_ASSERT(!repoDirectory.isEmpty(), return false);
|
||||||
StashInfo &stashInfo = m_stashInfo[repoDirectory];
|
StashInfo &stashInfo = m_stashInfo[repoDirectory];
|
||||||
return stashInfo.init(repoDirectory, command, flag, pushAction);
|
return stashInfo.init(repoDirectory, command, flag, pushAction);
|
||||||
@@ -2223,14 +2223,14 @@ bool GitClient::beginStashScope(const QString &workingDirectory, const QString &
|
|||||||
|
|
||||||
GitClient::StashInfo &GitClient::stashInfo(const QString &workingDirectory)
|
GitClient::StashInfo &GitClient::stashInfo(const QString &workingDirectory)
|
||||||
{
|
{
|
||||||
const QString repoDirectory = findRepositoryForDirectory(workingDirectory);
|
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
|
||||||
QTC_CHECK(m_stashInfo.contains(repoDirectory));
|
QTC_CHECK(m_stashInfo.contains(repoDirectory));
|
||||||
return m_stashInfo[repoDirectory];
|
return m_stashInfo[repoDirectory];
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::endStashScope(const QString &workingDirectory)
|
void GitClient::endStashScope(const QString &workingDirectory)
|
||||||
{
|
{
|
||||||
const QString repoDirectory = findRepositoryForDirectory(workingDirectory);
|
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
|
||||||
QTC_ASSERT(m_stashInfo.contains(repoDirectory), return);
|
QTC_ASSERT(m_stashInfo.contains(repoDirectory), return);
|
||||||
m_stashInfo[repoDirectory].end();
|
m_stashInfo[repoDirectory].end();
|
||||||
}
|
}
|
||||||
@@ -2694,7 +2694,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
|||||||
commitData.clear();
|
commitData.clear();
|
||||||
|
|
||||||
// Find repo
|
// Find repo
|
||||||
const QString repoDirectory = GitClient::findRepositoryForDirectory(workingDirectory);
|
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
|
||||||
if (repoDirectory.isEmpty()) {
|
if (repoDirectory.isEmpty()) {
|
||||||
*errorMessage = msgRepositoryNotFound(workingDirectory);
|
*errorMessage = msgRepositoryNotFound(workingDirectory);
|
||||||
return false;
|
return false;
|
||||||
@@ -2949,7 +2949,7 @@ GitClient::RevertResult GitClient::revertI(QStringList files,
|
|||||||
*ptrToIsDirectory = isDirectory;
|
*ptrToIsDirectory = isDirectory;
|
||||||
const QString workingDirectory = isDirectory ? firstFile.absoluteFilePath() : firstFile.absolutePath();
|
const QString workingDirectory = isDirectory ? firstFile.absoluteFilePath() : firstFile.absolutePath();
|
||||||
|
|
||||||
const QString repoDirectory = GitClient::findRepositoryForDirectory(workingDirectory);
|
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
|
||||||
if (repoDirectory.isEmpty()) {
|
if (repoDirectory.isEmpty()) {
|
||||||
*errorMessage = msgRepositoryNotFound(workingDirectory);
|
*errorMessage = msgRepositoryNotFound(workingDirectory);
|
||||||
return RevertFailed;
|
return RevertFailed;
|
||||||
@@ -3090,7 +3090,8 @@ void GitClient::synchronousAbortCommand(const QString &workingDir, const QString
|
|||||||
// Abort to clean if something goes wrong
|
// Abort to clean if something goes wrong
|
||||||
if (abortCommand.isEmpty()) {
|
if (abortCommand.isEmpty()) {
|
||||||
// no abort command - checkout index to clean working copy.
|
// no abort command - checkout index to clean working copy.
|
||||||
synchronousCheckoutFiles(findRepositoryForDirectory(workingDir), QStringList(), QString(), 0, false);
|
synchronousCheckoutFiles(VcsManager::findTopLevelForDirectory(workingDir),
|
||||||
|
QStringList(), QString(), 0, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
|
VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
|
||||||
|
|||||||
Reference in New Issue
Block a user