Commit 0544f9dd authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Replace findRepository with VcsManager::findTopLevel



Take advantage of its cache

Change-Id: Ibf3b3b59821a92cd4475c6f8d6dd8212983d5c96
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 166c1f51
......@@ -33,6 +33,8 @@
#include "gitclient.h"
#include "ui_changeselectiondialog.h"
#include <coreplugin/vcsmanager.h>
#include <QProcess>
#include <QFormLayout>
#include <QHBoxLayout>
......@@ -142,7 +144,7 @@ QString ChangeSelectionDialog::workingDirectory() const
if (workingDir.isEmpty() || !QDir(workingDir).exists())
return QString();
return GitPlugin::instance()->gitClient()->findRepositoryForDirectory(workingDir);
return Core::VcsManager::findTopLevelForDirectory(workingDir);
}
ChangeCommand ChangeSelectionDialog::command() const
......
......@@ -432,7 +432,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
QString repository;
bool verifiedRepository = false;
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()) {
// 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,
StashFlag flag, PushAction pushAction)
{
const QString repoDirectory = findRepositoryForDirectory(workingDirectory);
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
QTC_ASSERT(!repoDirectory.isEmpty(), return false);
StashInfo &stashInfo = m_stashInfo[repoDirectory];
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)
{
const QString repoDirectory = findRepositoryForDirectory(workingDirectory);
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
QTC_CHECK(m_stashInfo.contains(repoDirectory));
return m_stashInfo[repoDirectory];
}
void GitClient::endStashScope(const QString &workingDirectory)
{
const QString repoDirectory = findRepositoryForDirectory(workingDirectory);
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
QTC_ASSERT(m_stashInfo.contains(repoDirectory), return);
m_stashInfo[repoDirectory].end();
}
......@@ -2694,7 +2694,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
commitData.clear();
// Find repo
const QString repoDirectory = GitClient::findRepositoryForDirectory(workingDirectory);
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
if (repoDirectory.isEmpty()) {
*errorMessage = msgRepositoryNotFound(workingDirectory);
return false;
......@@ -2949,7 +2949,7 @@ GitClient::RevertResult GitClient::revertI(QStringList files,
*ptrToIsDirectory = isDirectory;
const QString workingDirectory = isDirectory ? firstFile.absoluteFilePath() : firstFile.absolutePath();
const QString repoDirectory = GitClient::findRepositoryForDirectory(workingDirectory);
const QString repoDirectory = VcsManager::findTopLevelForDirectory(workingDirectory);
if (repoDirectory.isEmpty()) {
*errorMessage = msgRepositoryNotFound(workingDirectory);
return RevertFailed;
......@@ -3090,7 +3090,8 @@ void GitClient::synchronousAbortCommand(const QString &workingDir, const QString
// Abort to clean if something goes wrong
if (abortCommand.isEmpty()) {
// 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;
}
VcsBase::VcsBaseOutputWindow *outwin = VcsBase::VcsBaseOutputWindow::instance();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment