forked from qt-creator/qt-creator
Vcs: Use more FilePath for file paths
Change-Id: I855cde65d034a9647972a7fddf1e8266d7ccfa88 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -109,9 +109,9 @@ BazaarClient::BazaarClient(BazaarSettings *settings) : VcsBaseClient(settings)
|
||||
});
|
||||
}
|
||||
|
||||
BranchInfo BazaarClient::synchronousBranchQuery(const QString &repositoryRoot) const
|
||||
BranchInfo BazaarClient::synchronousBranchQuery(const FilePath &repositoryRoot) const
|
||||
{
|
||||
QFile branchConfFile(repositoryRoot + QLatin1Char('/') +
|
||||
QFile branchConfFile(repositoryRoot.toString() + QLatin1Char('/') +
|
||||
QLatin1String(Constants::BAZAARREPO) +
|
||||
QLatin1String("/branch/branch.conf"));
|
||||
if (!branchConfFile.open(QIODevice::ReadOnly))
|
||||
@@ -135,11 +135,11 @@ BranchInfo BazaarClient::synchronousBranchQuery(const QString &repositoryRoot) c
|
||||
}
|
||||
if (isBranchBound.simplified().toLower() == QLatin1String("true"))
|
||||
return BranchInfo(branchLocation, true);
|
||||
return BranchInfo(repositoryRoot, false);
|
||||
return BranchInfo(repositoryRoot.toString(), false);
|
||||
}
|
||||
|
||||
//! Removes the last committed revision(s)
|
||||
bool BazaarClient::synchronousUncommit(const QString &workingDir,
|
||||
bool BazaarClient::synchronousUncommit(const FilePath &workingDir,
|
||||
const QString &revision,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ bool BazaarClient::synchronousUncommit(const QString &workingDir,
|
||||
return proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
}
|
||||
|
||||
void BazaarClient::commit(const QString &repositoryRoot, const QStringList &files,
|
||||
void BazaarClient::commit(const FilePath &repositoryRoot, const QStringList &files,
|
||||
const QString &commitMessageFile, const QStringList &extraOptions)
|
||||
{
|
||||
VcsBaseClient::commit(repositoryRoot, files, commitMessageFile,
|
||||
@@ -164,17 +164,17 @@ void BazaarClient::commit(const QString &repositoryRoot, const QStringList &file
|
||||
}
|
||||
|
||||
VcsBaseEditorWidget *BazaarClient::annotate(
|
||||
const QString &workingDir, const QString &file, const QString &revision,
|
||||
const FilePath &workingDir, const QString &file, const QString &revision,
|
||||
int lineNumber, const QStringList &extraOptions)
|
||||
{
|
||||
return VcsBaseClient::annotate(workingDir, file, revision, lineNumber,
|
||||
QStringList(extraOptions) << QLatin1String("--long"));
|
||||
}
|
||||
|
||||
bool BazaarClient::isVcsDirectory(const FilePath &fileName) const
|
||||
bool BazaarClient::isVcsDirectory(const FilePath &filePath) const
|
||||
{
|
||||
return fileName.isDir()
|
||||
&& !fileName.fileName().compare(Constants::BAZAARREPO, HostOsInfo::fileNameCaseSensitivity());
|
||||
return filePath.isDir()
|
||||
&& !filePath.fileName().compare(Constants::BAZAARREPO, HostOsInfo::fileNameCaseSensitivity());
|
||||
}
|
||||
|
||||
FilePath BazaarClient::findTopLevelForFile(const FilePath &file) const
|
||||
@@ -184,7 +184,7 @@ FilePath BazaarClient::findTopLevelForFile(const FilePath &file) const
|
||||
return VcsBase::findRepositoryForFile(file, repositoryCheckFile);
|
||||
}
|
||||
|
||||
bool BazaarClient::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool BazaarClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QStringList args(QLatin1String("status"));
|
||||
args << fileName;
|
||||
|
||||
@@ -41,20 +41,20 @@ class BazaarClient : public VcsBase::VcsBaseClient
|
||||
public:
|
||||
explicit BazaarClient(BazaarSettings *settings);
|
||||
|
||||
BranchInfo synchronousBranchQuery(const QString &repositoryRoot) const;
|
||||
bool synchronousUncommit(const QString &workingDir,
|
||||
const QString& revision = QString(),
|
||||
const QStringList &extraOptions = QStringList());
|
||||
void commit(const QString &repositoryRoot, const QStringList &files,
|
||||
const QString &commitMessageFile, const QStringList &extraOptions = QStringList()) override;
|
||||
BranchInfo synchronousBranchQuery(const Utils::FilePath &repositoryRoot) const;
|
||||
bool synchronousUncommit(const Utils::FilePath &workingDir,
|
||||
const QString &revision = {},
|
||||
const QStringList &extraOptions = {});
|
||||
void commit(const Utils::FilePath &repositoryRoot, const QStringList &files,
|
||||
const QString &commitMessageFile, const QStringList &extraOptions = {}) override;
|
||||
VcsBase::VcsBaseEditorWidget *annotate(
|
||||
const QString &workingDir, const QString &file, const QString &revision = QString(),
|
||||
int lineNumber = -1, const QStringList &extraOptions = QStringList()) override;
|
||||
bool isVcsDirectory(const Utils::FilePath &fileName) const;
|
||||
const Utils::FilePath &workingDir, const QString &file, const QString &revision = {},
|
||||
int lineNumber = -1, const QStringList &extraOptions ={}) override;
|
||||
bool isVcsDirectory(const Utils::FilePath &filePath) const;
|
||||
Utils::FilePath findTopLevelForFile(const Utils::FilePath &file) const override;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const;
|
||||
void view(const QString &source, const QString &id,
|
||||
const QStringList &extraOptions = QStringList()) override;
|
||||
const QStringList &extraOptions = {}) override;
|
||||
|
||||
Utils::Id vcsEditorKind(VcsCommandTag cmd) const override;
|
||||
QString vcsCommandString(VcsCommandTag cmd) const override;
|
||||
|
||||
@@ -147,13 +147,13 @@ public:
|
||||
QString displayName() const final;
|
||||
Utils::Id id() const final;
|
||||
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const final;
|
||||
|
||||
bool managesDirectory(const Utils::FilePath &filePath, Utils::FilePath *topLevel) const final;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const final;
|
||||
bool isConfigured() const final;
|
||||
bool supportsOperation(Operation operation) const final;
|
||||
bool vcsOpen(const Utils::FilePath &fileName) final;
|
||||
bool vcsOpen(const Utils::FilePath &filePath) final;
|
||||
bool vcsAdd(const Utils::FilePath &filePath) final;
|
||||
bool vcsDelete(const Utils::FilePath &filePath) final;
|
||||
bool vcsMove(const Utils::FilePath &from, const Utils::FilePath &to) final;
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
|
||||
QAction *m_menuAction = nullptr;
|
||||
|
||||
QString m_submitRepository;
|
||||
FilePath m_submitRepository;
|
||||
bool m_submitActionTriggered = false;
|
||||
|
||||
VcsEditorFactory logEditorFactory {
|
||||
@@ -672,12 +672,11 @@ void BazaarPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusItem
|
||||
this, &BazaarPluginPrivate::diffFromEditorSelected);
|
||||
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
|
||||
|
||||
const QString msg = tr("Commit changes for \"%1\".").
|
||||
arg(QDir::toNativeSeparators(m_submitRepository));
|
||||
const QString msg = tr("Commit changes for \"%1\".").arg(m_submitRepository.toUserOutput());
|
||||
commitEditor->document()->setPreferredDisplayName(msg);
|
||||
|
||||
const BranchInfo branch = m_client.synchronousBranchQuery(m_submitRepository);
|
||||
commitEditor->setFields(m_submitRepository, branch,
|
||||
commitEditor->setFields(m_submitRepository.toString(), branch,
|
||||
m_settings.userName.value(),
|
||||
m_settings.userEmail.value(), status);
|
||||
}
|
||||
@@ -860,7 +859,7 @@ bool BazaarPluginPrivate::managesDirectory(const FilePath &directory, FilePath *
|
||||
|
||||
bool BazaarPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
return m_client.managesFile(workingDirectory.toString(), fileName);
|
||||
return m_client.managesFile(workingDirectory, fileName);
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::isConfigured() const
|
||||
@@ -899,23 +898,21 @@ bool BazaarPluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
|
||||
bool BazaarPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_client.synchronousAdd(fi.absolutePath(), fi.fileName());
|
||||
return m_client.synchronousAdd(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_client.synchronousRemove(fi.absolutePath(), fi.fileName());
|
||||
return m_client.synchronousRemove(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return m_client.synchronousMove(fromInfo.absolutePath(),
|
||||
fromInfo.absoluteFilePath(),
|
||||
toInfo.absoluteFilePath());
|
||||
return m_client.synchronousMove(from.parentDir().absoluteFilePath(),
|
||||
fromInfo.absoluteFilePath(),
|
||||
toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool BazaarPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
||||
@@ -925,14 +922,14 @@ bool BazaarPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
||||
|
||||
void BazaarPluginPrivate::vcsAnnotate(const FilePath &file, int line)
|
||||
{
|
||||
const QFileInfo fi = file.toFileInfo();
|
||||
m_client.annotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
m_client.annotate(file.parentDir(), file.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
Core::ShellCommand *BazaarPluginPrivate::createInitialCheckoutCommand(const QString &url,
|
||||
const Utils::FilePath &baseDirectory,
|
||||
const QString &localName,
|
||||
const QStringList &extraArgs)
|
||||
Core::ShellCommand *BazaarPluginPrivate::createInitialCheckoutCommand(
|
||||
const QString &url,
|
||||
const FilePath &baseDirectory,
|
||||
const QString &localName,
|
||||
const QStringList &extraArgs)
|
||||
{
|
||||
QStringList args;
|
||||
args << m_client.vcsCommandString(BazaarClient::CloneCommand)
|
||||
@@ -940,7 +937,7 @@ Core::ShellCommand *BazaarPluginPrivate::createInitialCheckoutCommand(const QStr
|
||||
|
||||
Environment env = m_client.processEnvironment();
|
||||
env.set("BZR_PROGRESS_BAR", "text");
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory.toString(), env);
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory, env);
|
||||
command->addJob({m_client.vcsBinary(), args}, -1);
|
||||
return command;
|
||||
}
|
||||
@@ -949,7 +946,7 @@ void BazaarPluginPrivate::changed(const QVariant &v)
|
||||
{
|
||||
switch (v.type()) {
|
||||
case QVariant::String:
|
||||
emit repositoryChanged(v.toString());
|
||||
emit repositoryChanged(FilePath::fromVariant(v));
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
emit filesChanged(v.toStringList());
|
||||
|
||||
@@ -207,21 +207,21 @@ public:
|
||||
QString vcsTopic(const FilePath &directory) final;
|
||||
|
||||
///
|
||||
ClearCaseSubmitEditor *openClearCaseSubmitEditor(const QString &fileName, bool isUcm);
|
||||
ClearCaseSubmitEditor *openClearCaseSubmitEditor(const FilePath &filePath, bool isUcm);
|
||||
|
||||
const ClearCaseSettings &settings() const;
|
||||
void setSettings(const ClearCaseSettings &s);
|
||||
|
||||
// IVersionControl
|
||||
bool vcsOpen(const QString &workingDir, const QString &fileName);
|
||||
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
||||
bool vcsDelete(const QString &workingDir, const QString &fileName);
|
||||
bool vcsCheckIn(const QString &workingDir, const QStringList &files, const QString &activity,
|
||||
bool vcsOpen(const FilePath &workingDir, const QString &fileName);
|
||||
bool vcsAdd(const FilePath &workingDir, const QString &fileName);
|
||||
bool vcsDelete(const FilePath &workingDir, const QString &fileName);
|
||||
bool vcsCheckIn(const FilePath &workingDir, const QStringList &files, const QString &activity,
|
||||
bool isIdentical, bool isPreserve, bool replaceActivity);
|
||||
bool vcsUndoCheckOut(const QString &workingDir, const QString &fileName, bool keep);
|
||||
bool vcsUndoHijack(const QString &workingDir, const QString &fileName, bool keep);
|
||||
bool vcsMove(const QString &workingDir, const QString &from, const QString &to);
|
||||
bool vcsSetActivity(const QString &workingDir, const QString &title, const QString &activity);
|
||||
bool vcsUndoCheckOut(const FilePath &workingDir, const QString &fileName, bool keep);
|
||||
bool vcsUndoHijack(const FilePath &workingDir, const QString &fileName, bool keep);
|
||||
bool vcsMove(const FilePath &workingDir, const QString &from, const QString &to);
|
||||
bool vcsSetActivity(const FilePath &workingDir, const QString &title, const QString &activity);
|
||||
|
||||
static ClearCasePluginPrivate *instance();
|
||||
|
||||
@@ -229,10 +229,10 @@ public:
|
||||
QList<QStringPair> activities(int *current = nullptr);
|
||||
QString ccGetPredecessor(const QString &version) const;
|
||||
QStringList ccGetActiveVobs() const;
|
||||
ViewData ccGetView(const QString &workingDir) const;
|
||||
QString ccGetComment(const QString &workingDir, const QString &fileName) const;
|
||||
bool ccFileOp(const QString &workingDir, const QString &title, const QStringList &args,
|
||||
const QString &fileName, const QString &file2 = QString());
|
||||
ViewData ccGetView(const FilePath &workingDir) const;
|
||||
QString ccGetComment(const FilePath &workingDir, const QString &fileName) const;
|
||||
bool ccFileOp(const FilePath &workingDir, const QString &title, const QStringList &args,
|
||||
const QString &fileName, const QString &file2 = {});
|
||||
FileStatus vcsStatus(const QString &file) const;
|
||||
void checkAndReIndexUnknownFile(const QString &file);
|
||||
QString currentView() const { return m_viewData.name; }
|
||||
@@ -242,20 +242,20 @@ public:
|
||||
inline bool isDynamic() const { return m_viewData.isDynamic; }
|
||||
void setStatus(const QString &file, FileStatus::Status status, bool update = true);
|
||||
|
||||
bool ccCheckUcm(const QString &viewname, const QString &workingDir) const;
|
||||
bool ccCheckUcm(const QString &viewname, const FilePath &workingDir) const;
|
||||
#ifdef WITH_TESTS
|
||||
inline void setFakeCleartool(const bool b = true) { m_fakeClearTool = b; }
|
||||
#endif
|
||||
|
||||
void vcsAnnotateHelper(const QString &workingDir, const QString &file,
|
||||
const QString &revision = QString(), int lineNumber = -1) const;
|
||||
void vcsAnnotateHelper(const FilePath &workingDir, const QString &file,
|
||||
const QString &revision = {}, int lineNumber = -1) const;
|
||||
bool newActivity();
|
||||
void updateStreamAndView();
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
QString ccGet(const QString &workingDir, const QString &file, const QString &prefix = QString());
|
||||
QString ccGet(const FilePath &workingDir, const QString &file, const QString &prefix = {});
|
||||
QList<QStringPair> ccGetActivities() const;
|
||||
|
||||
private:
|
||||
@@ -280,38 +280,38 @@ private:
|
||||
void updateIndex();
|
||||
void updateView();
|
||||
void projectChanged(ProjectExplorer::Project *project);
|
||||
void tasksFinished(Utils::Id type);
|
||||
void tasksFinished(Id type);
|
||||
void closing();
|
||||
|
||||
inline bool isCheckInEditorOpen() const;
|
||||
QStringList getVobList() const;
|
||||
QString ccManagesDirectory(const QString &directory) const;
|
||||
QString ccViewRoot(const QString &directory) const;
|
||||
QString findTopLevel(const QString &directory) const;
|
||||
QString ccManagesDirectory(const FilePath &directory) const;
|
||||
QString ccViewRoot(const FilePath &directory) const;
|
||||
QString findTopLevel(const FilePath &directory) const;
|
||||
Core::IEditor *showOutputInEditor(const QString& title, const QString &output,
|
||||
Id id, const QString &source,
|
||||
QTextCodec *codec) const;
|
||||
QString runCleartoolSync(const QString &workingDir, const QStringList &arguments) const;
|
||||
ClearCaseResponse runCleartool(const QString &workingDir, const QStringList &arguments,
|
||||
QString runCleartoolSync(const FilePath &workingDir, const QStringList &arguments) const;
|
||||
ClearCaseResponse runCleartool(const FilePath &workingDir, const QStringList &arguments,
|
||||
int timeOutS, unsigned flags,
|
||||
QTextCodec *outputCodec = nullptr) const;
|
||||
static void sync(QFutureInterface<void> &future, QStringList files);
|
||||
|
||||
void history(const QString &workingDir,
|
||||
const QStringList &file = QStringList(),
|
||||
void history(const FilePath &workingDir,
|
||||
const QStringList &file = {},
|
||||
bool enableAnnotationContextMenu = false);
|
||||
QString ccGetFileVersion(const QString &workingDir, const QString &file) const;
|
||||
void ccUpdate(const QString &workingDir, const QStringList &relativePaths = QStringList());
|
||||
void ccDiffWithPred(const QString &workingDir, const QStringList &files);
|
||||
void startCheckIn(const QString &workingDir, const QStringList &files = QStringList());
|
||||
QString ccGetFileVersion(const FilePath &workingDir, const QString &file) const;
|
||||
void ccUpdate(const FilePath &workingDir, const QStringList &relativePaths = {});
|
||||
void ccDiffWithPred(const FilePath &workingDir, const QStringList &files);
|
||||
void startCheckIn(const FilePath &workingDir, const QStringList &files = {});
|
||||
void cleanCheckInMessageFile();
|
||||
QString ccGetFileActivity(const QString &workingDir, const QString &file);
|
||||
QStringList ccGetActivityVersions(const QString &workingDir, const QString &activity);
|
||||
QString ccGetFileActivity(const FilePath &workingDir, const QString &file);
|
||||
QStringList ccGetActivityVersions(const FilePath &workingDir, const QString &activity);
|
||||
void diffGraphical(const QString &file1, const QString &file2 = QString());
|
||||
QString diffExternal(QString file1, QString file2 = QString(), bool keep = false);
|
||||
QString getFile(const QString &nativeFile, const QString &prefix);
|
||||
static void rmdir(const QString &path);
|
||||
QString runExtDiff(const QString &workingDir, const QStringList &arguments, int timeOutS,
|
||||
QString runExtDiff(const FilePath &workingDir, const QStringList &arguments, int timeOutS,
|
||||
QTextCodec *outputCodec = nullptr);
|
||||
static QString getDriveLetterOfPath(const QString &directory);
|
||||
|
||||
@@ -321,9 +321,9 @@ private:
|
||||
|
||||
ClearCaseSettings m_settings;
|
||||
|
||||
QString m_checkInMessageFileName;
|
||||
QString m_checkInView;
|
||||
QString m_topLevel;
|
||||
FilePath m_checkInMessageFilePath;
|
||||
FilePath m_checkInView;
|
||||
FilePath m_topLevel;
|
||||
QString m_stream;
|
||||
ViewData m_viewData;
|
||||
QString m_intStream;
|
||||
@@ -397,16 +397,16 @@ ClearCasePluginPrivate::~ClearCasePluginPrivate()
|
||||
|
||||
void ClearCasePluginPrivate::cleanCheckInMessageFile()
|
||||
{
|
||||
if (!m_checkInMessageFileName.isEmpty()) {
|
||||
QFile::remove(m_checkInMessageFileName);
|
||||
m_checkInMessageFileName.clear();
|
||||
if (!m_checkInMessageFilePath.isEmpty()) {
|
||||
m_checkInMessageFilePath.removeFile();
|
||||
m_checkInMessageFilePath.clear();
|
||||
m_checkInView.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::isCheckInEditorOpen() const
|
||||
{
|
||||
return !m_checkInMessageFileName.isEmpty();
|
||||
return !m_checkInMessageFilePath.isEmpty();
|
||||
}
|
||||
|
||||
/// Files in this directories are under ClearCase control
|
||||
@@ -471,7 +471,7 @@ FileStatus::Status ClearCasePluginPrivate::getFileStatus(const QString &fileName
|
||||
|
||||
QStringList args(QLatin1String("ls"));
|
||||
args << fileName;
|
||||
QString buffer = runCleartoolSync(viewRoot, args);
|
||||
QString buffer = runCleartoolSync(FilePath::fromString(viewRoot), args);
|
||||
|
||||
const int atatpos = buffer.indexOf(QLatin1String("@@"));
|
||||
if (atatpos != -1) { // probably a managed file
|
||||
@@ -535,7 +535,7 @@ FileStatus::Status ClearCasePluginPrivate::getFileStatus(const QString &fileName
|
||||
/// snapshot views.
|
||||
///
|
||||
/// \returns The ClearCase topLevel/VOB directory for this directory
|
||||
QString ClearCasePluginPrivate::ccManagesDirectory(const QString &directory) const
|
||||
QString ClearCasePluginPrivate::ccManagesDirectory(const FilePath &directory) const
|
||||
{
|
||||
QStringList args(QLatin1String("pwv"));
|
||||
const ClearCaseResponse response =
|
||||
@@ -572,8 +572,8 @@ QString ClearCasePluginPrivate::ccManagesDirectory(const QString &directory) con
|
||||
|
||||
foreach (const QString &relativeVobDir, vobs) {
|
||||
const QString vobPath = QDir::cleanPath(rootDir + QDir::fromNativeSeparators(relativeVobDir));
|
||||
const bool isManaged = (vobPath == directory)
|
||||
|| FilePath::fromString(directory).isChildOf(FilePath::fromString(vobPath));
|
||||
const bool isManaged = (vobPath == directory.toString())
|
||||
|| directory.isChildOf(FilePath::fromString(vobPath));
|
||||
if (isManaged)
|
||||
return vobPath;
|
||||
}
|
||||
@@ -582,7 +582,7 @@ QString ClearCasePluginPrivate::ccManagesDirectory(const QString &directory) con
|
||||
}
|
||||
|
||||
/// Find the root path of a clearcase view. Precondition: This is a clearcase managed dir
|
||||
QString ClearCasePluginPrivate::ccViewRoot(const QString &directory) const
|
||||
QString ClearCasePluginPrivate::ccViewRoot(const FilePath &directory) const
|
||||
{
|
||||
QStringList args(QLatin1String("pwv"));
|
||||
args << QLatin1String("-root");
|
||||
@@ -593,7 +593,7 @@ QString ClearCasePluginPrivate::ccViewRoot(const QString &directory) const
|
||||
|
||||
if (root.isEmpty()) {
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
root = getDriveLetterOfPath(directory);
|
||||
root = getDriveLetterOfPath(directory.toString());
|
||||
else
|
||||
root = QLatin1Char('/');
|
||||
}
|
||||
@@ -605,13 +605,12 @@ QString ClearCasePluginPrivate::ccViewRoot(const QString &directory) const
|
||||
*
|
||||
* Handles both dynamic views and snapshot views.
|
||||
*/
|
||||
QString ClearCasePluginPrivate::findTopLevel(const QString &directory) const
|
||||
QString ClearCasePluginPrivate::findTopLevel(const FilePath &directory) const
|
||||
{
|
||||
// Do not check again if we've already tested that the dir is managed,
|
||||
// or if it is a child of a managed dir (top level).
|
||||
if ((directory == m_topLevel) ||
|
||||
FilePath::fromString(directory).isChildOf(FilePath::fromString(m_topLevel)))
|
||||
return m_topLevel;
|
||||
if (directory == m_topLevel || directory.isChildOf(m_topLevel))
|
||||
return m_topLevel.toString();
|
||||
|
||||
return ccManagesDirectory(directory);
|
||||
}
|
||||
@@ -801,8 +800,8 @@ bool ClearCasePluginPrivate::submitEditorAboutToClose()
|
||||
|
||||
// Submit editor closing. Make it write out the check in message
|
||||
// and retrieve files
|
||||
const QFileInfo editorFile = editorDocument->filePath().toFileInfo();
|
||||
const QFileInfo changeFile(m_checkInMessageFileName);
|
||||
const FilePath editorFile = editorDocument->filePath();
|
||||
const FilePath changeFile = m_checkInMessageFilePath;
|
||||
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
|
||||
return true; // Oops?!
|
||||
|
||||
@@ -834,7 +833,7 @@ bool ClearCasePluginPrivate::submitEditorAboutToClose()
|
||||
closeEditor = DocumentManager::saveDocument(editorDocument);
|
||||
if (closeEditor) {
|
||||
ClearCaseSubmitEditorWidget *widget = editor->submitEditorWidget();
|
||||
closeEditor = vcsCheckIn(m_checkInMessageFileName, fileList, widget->activity(),
|
||||
closeEditor = vcsCheckIn(m_checkInMessageFilePath, fileList, widget->activity(),
|
||||
widget->isIdentical(), widget->isPreserve(),
|
||||
widget->activityChanged());
|
||||
}
|
||||
@@ -853,7 +852,7 @@ void ClearCasePluginPrivate::diffCheckInFiles(const QStringList &files)
|
||||
ccDiffWithPred(m_checkInView, files);
|
||||
}
|
||||
|
||||
static void setWorkingDirectory(IEditor *editor, const QString &wd)
|
||||
static void setWorkingDirectory(IEditor *editor, const FilePath &wd)
|
||||
{
|
||||
if (auto ve = qobject_cast<VcsBaseEditorWidget*>(editor->widget()))
|
||||
ve->setWorkingDirectory(wd);
|
||||
@@ -881,7 +880,7 @@ QStringList ClearCasePluginPrivate::ccGetActiveVobs() const
|
||||
const QString theViewRoot = viewRoot();
|
||||
|
||||
const ClearCaseResponse response =
|
||||
runCleartool(theViewRoot, args, m_settings.timeOutS, SilentRun);
|
||||
runCleartool(FilePath::fromString(theViewRoot), args, m_settings.timeOutS, SilentRun);
|
||||
if (response.error)
|
||||
return res;
|
||||
|
||||
@@ -927,7 +926,7 @@ FileStatus ClearCasePluginPrivate::vcsStatus(const QString &file) const
|
||||
return m_statusMap->value(file, FileStatus(FileStatus::Unknown));
|
||||
}
|
||||
|
||||
QString ClearCasePluginPrivate::ccGetFileActivity(const QString &workingDir, const QString &file)
|
||||
QString ClearCasePluginPrivate::ccGetFileActivity(const FilePath &workingDir, const QString &file)
|
||||
{
|
||||
QStringList args(QLatin1String("lscheckout"));
|
||||
args << QLatin1String("-fmt") << QLatin1String("%[activity]p");
|
||||
@@ -937,10 +936,10 @@ QString ClearCasePluginPrivate::ccGetFileActivity(const QString &workingDir, con
|
||||
return response.stdOut;
|
||||
}
|
||||
|
||||
ClearCaseSubmitEditor *ClearCasePluginPrivate::openClearCaseSubmitEditor(const QString &fileName, bool isUcm)
|
||||
ClearCaseSubmitEditor *ClearCasePluginPrivate::openClearCaseSubmitEditor(const FilePath &filePath, bool isUcm)
|
||||
{
|
||||
IEditor *editor =
|
||||
EditorManager::openEditor(fileName, Constants::CLEARCASECHECKINEDITOR_ID);
|
||||
EditorManager::openEditor(filePath, Constants::CLEARCASECHECKINEDITOR_ID);
|
||||
auto submitEditor = qobject_cast<ClearCaseSubmitEditor*>(editor);
|
||||
QTC_ASSERT(submitEditor, return nullptr);
|
||||
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
|
||||
@@ -1010,7 +1009,7 @@ void ClearCasePluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
const bool hasTopLevel = state.hasTopLevel();
|
||||
m_commandLocator->setEnabled(hasTopLevel);
|
||||
if (hasTopLevel) {
|
||||
const QString topLevel = state.topLevel();
|
||||
const FilePath topLevel = state.topLevel();
|
||||
if (m_topLevel != topLevel) {
|
||||
m_topLevel = topLevel;
|
||||
m_viewData = ccGetView(topLevel);
|
||||
@@ -1095,7 +1094,7 @@ void ClearCasePluginPrivate::undoCheckOutCurrent()
|
||||
vcsUndoCheckOut(state.topLevel(), file, keep);
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsUndoCheckOut(const QString &workingDir, const QString &fileName, bool keep)
|
||||
bool ClearCasePluginPrivate::vcsUndoCheckOut(const FilePath &workingDir, const QString &fileName, bool keep)
|
||||
{
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDir << fileName << keep;
|
||||
@@ -1112,7 +1111,7 @@ bool ClearCasePluginPrivate::vcsUndoCheckOut(const QString &workingDir, const QS
|
||||
VcsCommand::ShowStdOut | VcsCommand::FullySynchronously);
|
||||
|
||||
if (!response.error) {
|
||||
const QString absPath = workingDir + QLatin1Char('/') + fileName;
|
||||
const QString absPath = workingDir.pathAppended(fileName).toString();
|
||||
|
||||
if (!m_settings.disableIndexer)
|
||||
setStatus(absPath, FileStatus::CheckedIn);
|
||||
@@ -1127,7 +1126,7 @@ bool ClearCasePluginPrivate::vcsUndoCheckOut(const QString &workingDir, const QS
|
||||
* Runs cleartool update -overwrite \a fileName in \a workingDir
|
||||
* if \a keep is true, renames hijacked files to <filename>.keep. Otherwise it is overwritten
|
||||
*/
|
||||
bool ClearCasePluginPrivate::vcsUndoHijack(const QString &workingDir, const QString &fileName, bool keep)
|
||||
bool ClearCasePluginPrivate::vcsUndoHijack(const FilePath &workingDir, const QString &fileName, bool keep)
|
||||
{
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDir << fileName << keep;
|
||||
@@ -1144,7 +1143,7 @@ bool ClearCasePluginPrivate::vcsUndoHijack(const QString &workingDir, const QStr
|
||||
runCleartool(workingDir, args, m_settings.timeOutS,
|
||||
VcsCommand::ShowStdOut | VcsCommand::FullySynchronously);
|
||||
if (!response.error && !m_settings.disableIndexer) {
|
||||
const QString absPath = workingDir + QLatin1Char('/') + fileName;
|
||||
const QString absPath = workingDir.pathAppended(fileName).toString();
|
||||
setStatus(absPath, FileStatus::CheckedIn);
|
||||
}
|
||||
return !response.error;
|
||||
@@ -1182,14 +1181,14 @@ void ClearCasePluginPrivate::undoHijackCurrent()
|
||||
emit filesChanged(QStringList(state.currentFile()));
|
||||
}
|
||||
|
||||
QString ClearCasePluginPrivate::ccGetFileVersion(const QString &workingDir, const QString &file) const
|
||||
QString ClearCasePluginPrivate::ccGetFileVersion(const FilePath &workingDir, const QString &file) const
|
||||
{
|
||||
QStringList args(QLatin1String("ls"));
|
||||
args << QLatin1String("-short") << file;
|
||||
return runCleartoolSync(workingDir, args).trimmed();
|
||||
}
|
||||
|
||||
void ClearCasePluginPrivate::ccDiffWithPred(const QString &workingDir, const QStringList &files)
|
||||
void ClearCasePluginPrivate::ccDiffWithPred(const FilePath &workingDir, const QStringList &files)
|
||||
{
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << files;
|
||||
@@ -1199,7 +1198,7 @@ void ClearCasePluginPrivate::ccDiffWithPred(const QString &workingDir, const QSt
|
||||
|
||||
if ((m_settings.diffType == GraphicalDiff) && (files.count() == 1)) {
|
||||
const QString file = files.first();
|
||||
const QString absFilePath = workingDir + QLatin1Char('/') + file;
|
||||
const QString absFilePath = workingDir.pathAppended(file).toString();
|
||||
if (vcsStatus(absFilePath).status == FileStatus::Hijacked)
|
||||
diffGraphical(ccGetFileVersion(workingDir, file), file);
|
||||
else
|
||||
@@ -1212,7 +1211,7 @@ void ClearCasePluginPrivate::ccDiffWithPred(const QString &workingDir, const QSt
|
||||
}
|
||||
QString result;
|
||||
foreach (const QString &file, files) {
|
||||
const QString absFilePath = workingDir + QLatin1Char('/') + file;
|
||||
const QString absFilePath = workingDir.pathAppended(file).toString();
|
||||
if (vcsStatus(QDir::fromNativeSeparators(absFilePath)).status == FileStatus::Hijacked)
|
||||
result += diffExternal(ccGetFileVersion(workingDir, file), file);
|
||||
else
|
||||
@@ -1223,7 +1222,7 @@ void ClearCasePluginPrivate::ccDiffWithPred(const QString &workingDir, const QSt
|
||||
|
||||
// diff of a single file? re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString tag = VcsBaseEditor::editorTag(DiffOutput, workingDir, files);
|
||||
const QString tag = VcsBaseEditor::editorTag(DiffOutput, workingDir.toString(), files);
|
||||
if (files.count() == 1) {
|
||||
// Show in the same editor if diff has been executed before
|
||||
if (IEditor *existingEditor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
@@ -1244,7 +1243,7 @@ void ClearCasePluginPrivate::ccDiffWithPred(const QString &workingDir, const QSt
|
||||
editor->setProperty("originalFileName", diffname);
|
||||
}
|
||||
|
||||
QStringList ClearCasePluginPrivate::ccGetActivityVersions(const QString &workingDir, const QString &activity)
|
||||
QStringList ClearCasePluginPrivate::ccGetActivityVersions(const FilePath &workingDir, const QString &activity)
|
||||
{
|
||||
QStringList args(QLatin1String("lsactivity"));
|
||||
args << QLatin1String("-fmt") << QLatin1String("%[versions]Cp") << activity;
|
||||
@@ -1282,7 +1281,7 @@ void ClearCasePluginPrivate::diffActivity()
|
||||
VcsOutputWindow::appendError(tr("External diff is required to compare multiple files."));
|
||||
return;
|
||||
}
|
||||
QString topLevel = state.topLevel();
|
||||
FilePath topLevel = state.topLevel();
|
||||
QString activity = QInputDialog::getText(ICore::dialogParent(), tr("Enter Activity"),
|
||||
tr("Activity Name"), QLineEdit::Normal, m_activity);
|
||||
if (activity.isEmpty())
|
||||
@@ -1292,7 +1291,7 @@ void ClearCasePluginPrivate::diffActivity()
|
||||
QString result;
|
||||
// map from fileName to (first, latest) pair
|
||||
QMap<QString, QStringPair> filever;
|
||||
int topLevelLen = topLevel.length();
|
||||
int topLevelLen = topLevel.toString().length();
|
||||
foreach (const QString &version, versions) {
|
||||
QString shortver = version.mid(topLevelLen + 1);
|
||||
int atatpos = shortver.indexOf(QLatin1String("@@"));
|
||||
@@ -1354,7 +1353,7 @@ void ClearCasePluginPrivate::startCheckInAll()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
QString topLevel = state.topLevel();
|
||||
FilePath topLevel = state.topLevel();
|
||||
QStringList files;
|
||||
for (StatusMap::ConstIterator iterator = m_statusMap->constBegin();
|
||||
iterator != m_statusMap->constEnd();
|
||||
@@ -1386,8 +1385,8 @@ void ClearCasePluginPrivate::startCheckInActivity()
|
||||
if (!dlg.exec())
|
||||
return;
|
||||
|
||||
QString topLevel = state.topLevel();
|
||||
int topLevelLen = topLevel.length();
|
||||
FilePath topLevel = state.topLevel();
|
||||
int topLevelLen = topLevel.toString().length();
|
||||
QStringList versions = ccGetActivityVersions(topLevel, actSelector->activity());
|
||||
QStringList files;
|
||||
QString last;
|
||||
@@ -1407,7 +1406,7 @@ void ClearCasePluginPrivate::startCheckInActivity()
|
||||
/* Start check in of files of a single repository by displaying
|
||||
* template and files in a submit editor. On closing, the real
|
||||
* check in will start. */
|
||||
void ClearCasePluginPrivate::startCheckIn(const QString &workingDir, const QStringList &files)
|
||||
void ClearCasePluginPrivate::startCheckIn(const FilePath &workingDir, const QStringList &files)
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
return;
|
||||
@@ -1437,10 +1436,10 @@ void ClearCasePluginPrivate::startCheckIn(const QString &workingDir, const QStri
|
||||
VcsOutputWindow::appendError(saver.errorString());
|
||||
return;
|
||||
}
|
||||
m_checkInMessageFileName = saver.filePath().toString();
|
||||
m_checkInMessageFilePath = saver.filePath();
|
||||
m_checkInView = workingDir;
|
||||
// Create a submit editor and set file list
|
||||
ClearCaseSubmitEditor *editor = openClearCaseSubmitEditor(m_checkInMessageFileName, m_viewData.isUcm);
|
||||
ClearCaseSubmitEditor *editor = openClearCaseSubmitEditor(m_checkInMessageFilePath, m_viewData.isUcm);
|
||||
setSubmitEditor(editor);
|
||||
editor->setStatusList(files);
|
||||
|
||||
@@ -1464,9 +1463,9 @@ void ClearCasePluginPrivate::updateView()
|
||||
ccUpdate(state.topLevel());
|
||||
}
|
||||
|
||||
void ClearCasePluginPrivate::history(const QString &workingDir,
|
||||
const QStringList &files,
|
||||
bool enableAnnotationContextMenu)
|
||||
void ClearCasePluginPrivate::history(const FilePath &workingDir,
|
||||
const QStringList &files,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, files);
|
||||
// no need for temp file
|
||||
@@ -1487,7 +1486,7 @@ void ClearCasePluginPrivate::history(const QString &workingDir,
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files);
|
||||
const QString tag = VcsBaseEditor::editorTag(LogOutput, workingDir, files);
|
||||
const QString tag = VcsBaseEditor::editorTag(LogOutput, workingDir.toString(), files);
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(response.stdOut.toUtf8());
|
||||
EditorManager::activateEditor(editor);
|
||||
@@ -1532,7 +1531,7 @@ void ClearCasePluginPrivate::viewStatus()
|
||||
VcsOutputWindow::appendWarning(QLatin1String("No modified files found."));
|
||||
}
|
||||
|
||||
void ClearCasePluginPrivate::ccUpdate(const QString &workingDir, const QStringList &relativePaths)
|
||||
void ClearCasePluginPrivate::ccUpdate(const FilePath &workingDir, const QStringList &relativePaths)
|
||||
{
|
||||
QStringList args(QLatin1String("update"));
|
||||
args << QLatin1String("-noverwrite");
|
||||
@@ -1551,7 +1550,7 @@ void ClearCasePluginPrivate::annotateCurrentFile()
|
||||
vcsAnnotateHelper(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void ClearCasePluginPrivate::vcsAnnotateHelper(const QString &workingDir, const QString &file,
|
||||
void ClearCasePluginPrivate::vcsAnnotateHelper(const FilePath &workingDir, const QString &file,
|
||||
const QString &revision /* = QString() */,
|
||||
int lineNumber /* = -1 */) const
|
||||
{
|
||||
@@ -1578,7 +1577,7 @@ void ClearCasePluginPrivate::vcsAnnotateHelper(const QString &workingDir, const
|
||||
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString source = workingDir + QLatin1Char('/') + file;
|
||||
const QString source = workingDir.pathAppended(file).toString();
|
||||
if (lineNumber <= 0)
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(source);
|
||||
|
||||
@@ -1592,7 +1591,7 @@ void ClearCasePluginPrivate::vcsAnnotateHelper(const QString &workingDir, const
|
||||
stream << response.stdOut.mid(dataStart) << headerSep << QLatin1Char('\n')
|
||||
<< headerSep << QLatin1Char('\n') << response.stdOut.left(pos);
|
||||
const QStringList files = QStringList(file);
|
||||
const QString tag = VcsBaseEditor::editorTag(AnnotateOutput, workingDir, files);
|
||||
const QString tag = VcsBaseEditor::editorTag(AnnotateOutput, workingDir.toString(), files);
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(res.toUtf8());
|
||||
VcsBaseEditor::gotoLineOfEditor(editor, lineNumber);
|
||||
@@ -1621,7 +1620,7 @@ void ClearCasePluginPrivate::vcsDescribe(const FilePath &source, const QString &
|
||||
QStringList args(QLatin1String("describe"));
|
||||
args.push_back(id);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(source.toString());
|
||||
const ClearCaseResponse response = runCleartool(topLevel.toString(), args, m_settings.timeOutS, 0, codec);
|
||||
const ClearCaseResponse response = runCleartool(topLevel, args, m_settings.timeOutS, 0, codec);
|
||||
description = response.stdOut;
|
||||
if (m_settings.extDiffAvailable)
|
||||
description += diffExternal(id);
|
||||
@@ -1646,18 +1645,18 @@ void ClearCasePluginPrivate::commitFromEditor()
|
||||
EditorManager::closeDocuments({submitEditor()->document()});
|
||||
}
|
||||
|
||||
QString ClearCasePluginPrivate::runCleartoolSync(const QString &workingDir,
|
||||
const QStringList &arguments) const
|
||||
QString ClearCasePluginPrivate::runCleartoolSync(const FilePath &workingDir,
|
||||
const QStringList &arguments) const
|
||||
{
|
||||
return runCleartool(workingDir, arguments, m_settings.timeOutS, SilentRun).stdOut;
|
||||
}
|
||||
|
||||
ClearCaseResponse
|
||||
ClearCasePluginPrivate::runCleartool(const QString &workingDir,
|
||||
const QStringList &arguments,
|
||||
int timeOutS,
|
||||
unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
ClearCasePluginPrivate::runCleartool(const FilePath &workingDir,
|
||||
const QStringList &arguments,
|
||||
int timeOutS,
|
||||
unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
{
|
||||
const QString executable = m_settings.ccBinaryPath;
|
||||
ClearCaseResponse response;
|
||||
@@ -1727,15 +1726,15 @@ ClearCasePluginPrivate *ClearCasePluginPrivate::instance()
|
||||
return dd;
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsOpen(const QString &workingDir, const QString &fileName)
|
||||
bool ClearCasePluginPrivate::vcsOpen(const FilePath &workingDir, const QString &fileName)
|
||||
{
|
||||
QTC_ASSERT(currentState().hasTopLevel(), return false);
|
||||
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDir << fileName;
|
||||
|
||||
QFileInfo fi(workingDir, fileName);
|
||||
QString topLevel = currentState().topLevel();
|
||||
QFileInfo fi(workingDir.toString(), fileName);
|
||||
FilePath topLevel = currentState().topLevel();
|
||||
QString absPath = fi.absoluteFilePath();
|
||||
|
||||
if (!m_settings.disableIndexer &&
|
||||
@@ -1747,7 +1746,7 @@ bool ClearCasePluginPrivate::vcsOpen(const QString &workingDir, const QString &f
|
||||
return true;
|
||||
}
|
||||
|
||||
const QString relFile = QDir(topLevel).relativeFilePath(absPath);
|
||||
const QString relFile = QDir(topLevel.toString()).relativeFilePath(absPath);
|
||||
const QString file = QDir::toNativeSeparators(relFile);
|
||||
const QString title = QString::fromLatin1("Checkout %1").arg(file);
|
||||
CheckOutDialog coDialog(title, m_viewData.isUcm, !m_settings.noComment);
|
||||
@@ -1839,7 +1838,7 @@ bool ClearCasePluginPrivate::vcsOpen(const QString &workingDir, const QString &f
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsSetActivity(const QString &workingDir, const QString &title, const QString &activity)
|
||||
bool ClearCasePluginPrivate::vcsSetActivity(const FilePath &workingDir, const QString &title, const QString &activity)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("setactivity") << activity;
|
||||
@@ -1855,7 +1854,7 @@ bool ClearCasePluginPrivate::vcsSetActivity(const QString &workingDir, const QSt
|
||||
}
|
||||
|
||||
// files are received using native separators
|
||||
bool ClearCasePluginPrivate::vcsCheckIn(const QString &messageFile, const QStringList &files, const QString &activity,
|
||||
bool ClearCasePluginPrivate::vcsCheckIn(const FilePath &messageFile, const QStringList &files, const QString &activity,
|
||||
bool isIdentical, bool isPreserve, bool replaceActivity)
|
||||
{
|
||||
if (Constants::debug)
|
||||
@@ -1868,7 +1867,7 @@ bool ClearCasePluginPrivate::vcsCheckIn(const QString &messageFile, const QStrin
|
||||
if (replaceActivity && !vcsSetActivity(m_checkInView, title, activity))
|
||||
return false;
|
||||
QString message;
|
||||
QFile msgFile(messageFile);
|
||||
QFile msgFile(messageFile.toString());
|
||||
if (msgFile.open(QFile::ReadOnly | QFile::Text)) {
|
||||
message = QString::fromLocal8Bit(msgFile.readAll().trimmed());
|
||||
msgFile.close();
|
||||
@@ -1878,7 +1877,7 @@ bool ClearCasePluginPrivate::vcsCheckIn(const QString &messageFile, const QStrin
|
||||
if (message.isEmpty())
|
||||
args << QLatin1String("-nc");
|
||||
else
|
||||
args << QLatin1String("-cfile") << messageFile;
|
||||
args << QLatin1String("-cfile") << messageFile.toString();
|
||||
if (isIdentical)
|
||||
args << QLatin1String("-identical");
|
||||
if (isPreserve)
|
||||
@@ -1887,7 +1886,7 @@ bool ClearCasePluginPrivate::vcsCheckIn(const QString &messageFile, const QStrin
|
||||
QList<FCBPointer> blockers;
|
||||
foreach (const QString &fileName, files) {
|
||||
FCBPointer fcb(new FileChangeBlocker(
|
||||
FilePath::fromString(QFileInfo(m_checkInView, fileName).canonicalFilePath())));
|
||||
FilePath::fromString(QFileInfo(m_checkInView.toString(), fileName).canonicalFilePath())));
|
||||
blockers.append(fcb);
|
||||
}
|
||||
const ClearCaseResponse response =
|
||||
@@ -1899,7 +1898,7 @@ bool ClearCasePluginPrivate::vcsCheckIn(const QString &messageFile, const QStrin
|
||||
int offset = match.capturedStart();
|
||||
while (match.hasMatch()) {
|
||||
QString file = match.captured(1);
|
||||
QFileInfo fi(m_checkInView, file);
|
||||
QFileInfo fi(m_checkInView.toString(), file);
|
||||
QString absPath = fi.absoluteFilePath();
|
||||
|
||||
if (!m_settings.disableIndexer)
|
||||
@@ -1912,7 +1911,7 @@ bool ClearCasePluginPrivate::vcsCheckIn(const QString &messageFile, const QStrin
|
||||
return anySucceeded;
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::ccFileOp(const QString &workingDir, const QString &title, const QStringList &opArgs,
|
||||
bool ClearCasePluginPrivate::ccFileOp(const FilePath &workingDir, const QString &title, const QStringList &opArgs,
|
||||
const QString &fileName, const QString &file2)
|
||||
{
|
||||
const QString file = QDir::toNativeSeparators(fileName);
|
||||
@@ -1949,7 +1948,7 @@ bool ClearCasePluginPrivate::ccFileOp(const QString &workingDir, const QString &
|
||||
if (m_viewData.isUcm && actSelector->changed())
|
||||
vcsSetActivity(workingDir, fileOpDlg.windowTitle(), actSelector->activity());
|
||||
|
||||
QString dirName = QDir::toNativeSeparators(QFileInfo(workingDir, fileName).absolutePath());
|
||||
QString dirName = QDir::toNativeSeparators(QFileInfo(workingDir.toString(), fileName).absolutePath());
|
||||
QStringList commentArg;
|
||||
if (comment.isEmpty())
|
||||
commentArg << QLatin1String("-nc");
|
||||
@@ -2001,13 +2000,13 @@ static QString baseName(const QString &fileName)
|
||||
return fileName.mid(fileName.lastIndexOf(QLatin1Char('/')) + 1);
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsAdd(const QString &workingDir, const QString &fileName)
|
||||
bool ClearCasePluginPrivate::vcsAdd(const FilePath &workingDir, const QString &fileName)
|
||||
{
|
||||
return ccFileOp(workingDir, tr("ClearCase Add File %1").arg(baseName(fileName)),
|
||||
QStringList({"mkelem", "-ci"}), fileName);
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsDelete(const QString &workingDir, const QString &fileName)
|
||||
bool ClearCasePluginPrivate::vcsDelete(const FilePath &workingDir, const QString &fileName)
|
||||
{
|
||||
const QString title(tr("ClearCase Remove Element %1").arg(baseName(fileName)));
|
||||
if (QMessageBox::warning(ICore::dialogParent(), title, tr("This operation is irreversible. Are you sure?"),
|
||||
@@ -2018,7 +2017,7 @@ bool ClearCasePluginPrivate::vcsDelete(const QString &workingDir, const QString
|
||||
QStringList({"rmname", "-force"}), fileName);
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsMove(const QString &workingDir, const QString &from, const QString &to)
|
||||
bool ClearCasePluginPrivate::vcsMove(const FilePath &workingDir, const QString &from, const QString &to)
|
||||
{
|
||||
return ccFileOp(workingDir, tr("ClearCase Rename File %1 -> %2")
|
||||
.arg(baseName(from)).arg(baseName(to)),
|
||||
@@ -2032,9 +2031,9 @@ bool ClearCasePluginPrivate::managesDirectory(const FilePath &directory, FilePat
|
||||
{
|
||||
#ifdef WITH_TESTS
|
||||
// If running with tests and fake ClearTool is enabled, then pretend we manage every directory
|
||||
QString topLevelFound = m_fakeClearTool ? directory.toString() : findTopLevel(directory.toString());
|
||||
QString topLevelFound = m_fakeClearTool ? directory.toString() : findTopLevel(directory);
|
||||
#else
|
||||
QString topLevelFound = findTopLevel(directory.toString());
|
||||
QString topLevelFound = findTopLevel(directory);
|
||||
#endif
|
||||
|
||||
if (topLevel)
|
||||
@@ -2117,7 +2116,7 @@ QList<QStringPair> ClearCasePluginPrivate::activities(int *current)
|
||||
|
||||
bool ClearCasePluginPrivate::newActivity()
|
||||
{
|
||||
QString workingDir = currentState().topLevel();
|
||||
FilePath workingDir = currentState().topLevel();
|
||||
QStringList args;
|
||||
args << QLatin1String("mkactivity") << QLatin1String("-f");
|
||||
if (!m_settings.autoAssignActivityName) {
|
||||
@@ -2137,7 +2136,7 @@ bool ClearCasePluginPrivate::newActivity()
|
||||
}
|
||||
|
||||
// check if the view is UCM
|
||||
bool ClearCasePluginPrivate::ccCheckUcm(const QString &viewname, const QString &workingDir) const
|
||||
bool ClearCasePluginPrivate::ccCheckUcm(const QString &viewname, const FilePath &workingDir) const
|
||||
{
|
||||
QStringList catcsArgs(QLatin1String("catcs"));
|
||||
catcsArgs << QLatin1String("-tag") << viewname;
|
||||
@@ -2154,9 +2153,9 @@ bool ClearCasePluginPrivate::managesFile(const FilePath &workingDirectory, const
|
||||
return status != FileStatus::NotManaged && status != FileStatus::Derived;
|
||||
}
|
||||
|
||||
ViewData ClearCasePluginPrivate::ccGetView(const QString &workingDir) const
|
||||
ViewData ClearCasePluginPrivate::ccGetView(const FilePath &workingDir) const
|
||||
{
|
||||
static QHash<QString, ViewData> viewCache;
|
||||
static QHash<FilePath, ViewData> viewCache;
|
||||
|
||||
bool inCache = viewCache.contains(workingDir);
|
||||
ViewData &res = viewCache[workingDir];
|
||||
@@ -2173,7 +2172,7 @@ ViewData ClearCasePluginPrivate::ccGetView(const QString &workingDir) const
|
||||
return res;
|
||||
}
|
||||
|
||||
QString ClearCasePluginPrivate::ccGetComment(const QString &workingDir, const QString &fileName) const
|
||||
QString ClearCasePluginPrivate::ccGetComment(const FilePath &workingDir, const QString &fileName) const
|
||||
{
|
||||
QStringList args(QLatin1String("describe"));
|
||||
args << QLatin1String("-fmt") << QLatin1String("%c") << fileName;
|
||||
@@ -2204,9 +2203,9 @@ void ClearCasePluginPrivate::projectChanged(Project *project)
|
||||
m_intStream.clear();
|
||||
ProgressManager::cancelTasks(ClearCase::Constants::TASK_INDEX);
|
||||
if (project) {
|
||||
QString projDir = project->projectDirectory().toString();
|
||||
FilePath projDir = project->projectDirectory();
|
||||
QString topLevel = findTopLevel(projDir);
|
||||
m_topLevel = topLevel;
|
||||
m_topLevel = FilePath::fromString(topLevel);
|
||||
if (topLevel.isEmpty())
|
||||
return;
|
||||
connect(qApp, &QApplication::applicationStateChanged,
|
||||
@@ -2267,7 +2266,7 @@ QString ClearCasePluginPrivate::getFile(const QString &nativeFile, const QString
|
||||
if (Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << nativeFile;
|
||||
if ((atatpos != -1) && (nativeFile.indexOf(QLatin1String("CHECKEDOUT"), atatpos) != -1)) {
|
||||
bool res = QFile::copy(QDir(m_topLevel).absoluteFilePath(file), tempFile);
|
||||
bool res = QFile::copy(QDir(m_topLevel.toString()).absoluteFilePath(file), tempFile);
|
||||
return res ? tempFile : QString();
|
||||
}
|
||||
QStringList args(QLatin1String("get"));
|
||||
@@ -2345,11 +2344,11 @@ void ClearCasePluginPrivate::diffGraphical(const QString &file1, const QString &
|
||||
args << file1;
|
||||
if (!pred)
|
||||
args << file2;
|
||||
QProcess::startDetached(m_settings.ccBinaryPath, args, m_topLevel);
|
||||
QProcess::startDetached(m_settings.ccBinaryPath, args, m_topLevel.toString());
|
||||
}
|
||||
|
||||
QString ClearCasePluginPrivate::runExtDiff(const QString &workingDir, const QStringList &arguments,
|
||||
int timeOutS, QTextCodec *outputCodec)
|
||||
QString ClearCasePluginPrivate::runExtDiff(const FilePath &workingDir, const QStringList &arguments,
|
||||
int timeOutS, QTextCodec *outputCodec)
|
||||
{
|
||||
CommandLine diff("diff");
|
||||
diff.addArgs(m_settings.diffArgs.split(' ', Qt::SkipEmptyParts));
|
||||
@@ -2372,7 +2371,7 @@ void ClearCasePluginPrivate::syncSlot()
|
||||
VcsBasePluginState state = currentState();
|
||||
if (!state.hasProject() || !state.hasTopLevel())
|
||||
return;
|
||||
QString topLevel = state.topLevel();
|
||||
FilePath topLevel = state.topLevel();
|
||||
if (topLevel != state.currentProjectTopLevel())
|
||||
return;
|
||||
Utils::runAsync(sync, QStringList());
|
||||
@@ -2461,8 +2460,7 @@ Core::IVersionControl::OpenSupportMode ClearCasePluginPrivate::openSupportMode(c
|
||||
|
||||
bool ClearCasePluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsOpen(fi.absolutePath(), fi.fileName());
|
||||
return vcsOpen(filePath.parentDir().absolutePath(), filePath.fileName());
|
||||
}
|
||||
|
||||
Core::IVersionControl::SettingsFlags ClearCasePluginPrivate::settingsFlags() const
|
||||
@@ -2475,27 +2473,24 @@ Core::IVersionControl::SettingsFlags ClearCasePluginPrivate::settingsFlags() con
|
||||
|
||||
bool ClearCasePluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsAdd(fi.absolutePath(), fi.fileName());
|
||||
return vcsAdd(filePath.parentDir().absolutePath(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsDelete(fi.absolutePath(), fi.fileName());
|
||||
return vcsDelete(filePath.parentDir().absoluteFilePath(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo ifrom = from.toFileInfo();
|
||||
const QFileInfo ito = from.toFileInfo();
|
||||
return vcsMove(ifrom.absolutePath(), from.fileName(), to.fileName());
|
||||
return vcsMove(from.parentDir().absolutePath(), from.fileName(), to.fileName());
|
||||
}
|
||||
|
||||
void ClearCasePluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
vcsAnnotateHelper(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
vcsAnnotateHelper(filePath.parentDir().absolutePath(), filePath.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
QString ClearCasePluginPrivate::vcsOpenText() const
|
||||
@@ -2512,7 +2507,7 @@ QString ClearCasePluginPrivate::vcsMakeWritableText() const
|
||||
|
||||
QString ClearCasePluginPrivate::vcsTopic(const FilePath &directory)
|
||||
{
|
||||
return ccGetView(directory.toString()).name;
|
||||
return ccGetView(directory).name;
|
||||
}
|
||||
|
||||
bool ClearCasePluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
|
||||
@@ -427,7 +427,7 @@ void ReadOnlyFilesDialogPrivate::initDialog(const FilePaths &filePaths)
|
||||
// Add a button for opening the file with a version control system
|
||||
// if the file is managed by an version control system which allows opening files.
|
||||
IVersionControl *versionControlForFile =
|
||||
VcsManager::findVersionControlForDirectory(directory.toString());
|
||||
VcsManager::findVersionControlForDirectory(directory);
|
||||
const bool fileManagedByVCS = versionControlForFile
|
||||
&& versionControlForFile->openSupportMode(filePath) != IVersionControl::NoOpen;
|
||||
if (fileManagedByVCS) {
|
||||
|
||||
@@ -1996,7 +1996,7 @@ void EditorManagerPrivate::updateMakeWritableWarning()
|
||||
// Do this after setWriteWarning so we don't re-evaluate this part even
|
||||
// if we do not really show a warning.
|
||||
bool promptVCS = false;
|
||||
const QString directory = document->filePath().toFileInfo().absolutePath();
|
||||
const FilePath directory = document->filePath().parentDir();
|
||||
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
|
||||
if (versionControl && versionControl->openSupportMode(document->filePath()) != IVersionControl::NoOpen) {
|
||||
if (versionControl->settingsFlags() & IVersionControl::AutoOpen) {
|
||||
@@ -2248,7 +2248,7 @@ void EditorManagerPrivate::vcsOpenCurrentEditor()
|
||||
if (!document)
|
||||
return;
|
||||
|
||||
const QString directory = document->filePath().toFileInfo().absolutePath();
|
||||
const FilePath directory = document->filePath().parentDir();
|
||||
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
|
||||
if (!versionControl || versionControl->openSupportMode(document->filePath()) == IVersionControl::NoOpen)
|
||||
return;
|
||||
|
||||
@@ -201,7 +201,7 @@ bool FileUtils::renameFile(const FilePath &orgFilePath, const FilePath &newFileP
|
||||
return false;
|
||||
|
||||
FilePath dir = orgFilePath.absolutePath();
|
||||
IVersionControl *vc = VcsManager::findVersionControlForDirectory(dir.toString());
|
||||
IVersionControl *vc = VcsManager::findVersionControlForDirectory(dir);
|
||||
|
||||
bool result = false;
|
||||
if (vc && vc->supportsOperation(IVersionControl::MoveOperation))
|
||||
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
void setTopicCache(TopicCache *topicCache);
|
||||
|
||||
signals:
|
||||
void repositoryChanged(const QString &repository);
|
||||
void repositoryChanged(const Utils::FilePath &repository);
|
||||
void filesChanged(const QStringList &files);
|
||||
void configurationChanged();
|
||||
|
||||
|
||||
@@ -210,10 +210,10 @@ void VcsManager::resetVersionControlForDirectory(const FilePath &inputDirectory)
|
||||
|
||||
const QString directory = absoluteWithNoTrailingSlash(inputDirectory.toString());
|
||||
d->resetCache(directory);
|
||||
emit m_instance->repositoryChanged(directory);
|
||||
emit m_instance->repositoryChanged(FilePath::fromString(directory));
|
||||
}
|
||||
|
||||
IVersionControl* VcsManager::findVersionControlForDirectory(const QString &inputDirectory,
|
||||
IVersionControl* VcsManager::findVersionControlForDirectory(const FilePath &inputDirectory,
|
||||
QString *topLevelDirectory)
|
||||
{
|
||||
using StringVersionControlPair = QPair<QString, IVersionControl *>;
|
||||
@@ -225,7 +225,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
||||
}
|
||||
|
||||
// Make sure we an absolute path:
|
||||
QString directory = absoluteWithNoTrailingSlash(inputDirectory);
|
||||
QString directory = absoluteWithNoTrailingSlash(inputDirectory.toString());
|
||||
#ifdef WITH_TESTS
|
||||
if (directory[0].isLetter() && directory.indexOf(QLatin1Char(':') + QLatin1String(TEST_PREFIX)) == 1)
|
||||
directory = directory.mid(2);
|
||||
@@ -321,11 +321,11 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
||||
return versionControl;
|
||||
}
|
||||
|
||||
QString VcsManager::findTopLevelForDirectory(const QString &directory)
|
||||
FilePath VcsManager::findTopLevelForDirectory(const FilePath &directory)
|
||||
{
|
||||
QString result;
|
||||
findVersionControlForDirectory(directory, &result);
|
||||
return result;
|
||||
return FilePath::fromString(result);
|
||||
}
|
||||
|
||||
QStringList VcsManager::repositories(const IVersionControl *vc)
|
||||
@@ -354,7 +354,7 @@ FilePaths VcsManager::promptToDelete(const FilePaths &filePaths)
|
||||
// Categorize by version control system.
|
||||
QHash<IVersionControl *, FilePaths> filesByVersionControl;
|
||||
for (auto it = filesByParentDir.cbegin(); it != filesByParentDir.cend(); ++it) {
|
||||
IVersionControl * const vc = findVersionControlForDirectory(it.key().toString());
|
||||
IVersionControl * const vc = findVersionControlForDirectory(it.key());
|
||||
if (vc)
|
||||
filesByVersionControl[vc] << it.value();
|
||||
}
|
||||
@@ -433,7 +433,7 @@ QStringList VcsManager::additionalToolsPath()
|
||||
|
||||
void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNames)
|
||||
{
|
||||
IVersionControl *vc = findVersionControlForDirectory(directory);
|
||||
IVersionControl *vc = findVersionControlForDirectory(FilePath::fromString(directory));
|
||||
if (!vc || !vc->supportsOperation(IVersionControl::AddOperation))
|
||||
return;
|
||||
|
||||
@@ -460,7 +460,7 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
|
||||
|
||||
void VcsManager::emitRepositoryChanged(const QString &repository)
|
||||
{
|
||||
emit m_instance->repositoryChanged(repository);
|
||||
emit m_instance->repositoryChanged(FilePath::fromString(repository));
|
||||
}
|
||||
|
||||
void VcsManager::clearVersionControlCache()
|
||||
@@ -468,7 +468,7 @@ void VcsManager::clearVersionControlCache()
|
||||
QStringList repoList = d->m_cachedMatches.keys();
|
||||
d->clearCache();
|
||||
foreach (const QString &repo, repoList)
|
||||
emit m_instance->repositoryChanged(repo);
|
||||
emit m_instance->repositoryChanged(FilePath::fromString(repo));
|
||||
}
|
||||
|
||||
void VcsManager::handleConfigurationChanges()
|
||||
@@ -606,7 +606,8 @@ void CorePlugin::testVcsManager()
|
||||
++expectedCount;
|
||||
|
||||
IVersionControl *vcs;
|
||||
vcs = VcsManager::findVersionControlForDirectory(makeString(directory), &realTopLevel);
|
||||
vcs = VcsManager::findVersionControlForDirectory(
|
||||
FilePath::fromString(makeString(directory)), &realTopLevel);
|
||||
QCOMPARE(realTopLevel, makeString(topLevel));
|
||||
if (vcs)
|
||||
QCOMPARE(vcs->id().toString(), vcsId);
|
||||
|
||||
@@ -64,9 +64,9 @@ public:
|
||||
static IVersionControl *versionControl(Utils::Id id);
|
||||
|
||||
static void resetVersionControlForDirectory(const Utils::FilePath &inputDirectory);
|
||||
static IVersionControl *findVersionControlForDirectory(const QString &directory,
|
||||
static IVersionControl *findVersionControlForDirectory(const Utils::FilePath &directory,
|
||||
QString *topLevelDirectory = nullptr);
|
||||
static QString findTopLevelForDirectory(const QString &directory);
|
||||
static Utils::FilePath findTopLevelForDirectory(const Utils::FilePath &directory);
|
||||
|
||||
static QStringList repositories(const IVersionControl *);
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
static void clearVersionControlCache();
|
||||
|
||||
signals:
|
||||
void repositoryChanged(const QString &repository);
|
||||
void repositoryChanged(const Utils::FilePath &repository);
|
||||
void configurationChanged(const IVersionControl *vcs);
|
||||
|
||||
private:
|
||||
|
||||
@@ -234,7 +234,7 @@ public:
|
||||
QString displayName() const final { return QLatin1String("cvs"); }
|
||||
Utils::Id id() const final;
|
||||
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &fileName) const final;
|
||||
bool isVcsFileOrDirectory(const Utils::FilePath &filePath) const final;
|
||||
|
||||
bool managesDirectory(const Utils::FilePath &directory, Utils::FilePath *topLevel) const final;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const final;
|
||||
@@ -261,12 +261,12 @@ public:
|
||||
CvsSubmitEditor *openCVSSubmitEditor(const QString &fileName);
|
||||
|
||||
// IVersionControl
|
||||
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
||||
bool vcsDelete(const QString &workingDir, const QString &fileName);
|
||||
bool vcsAdd(const FilePath &workingDir, const QString &fileName);
|
||||
bool vcsDelete(const FilePath &workingDir, const QString &fileName);
|
||||
// cvs 'edit' is used to implement 'open' (cvsnt).
|
||||
bool edit(const QString &topLevel, const QStringList &files);
|
||||
bool edit(const FilePath &topLevel, const QStringList &files);
|
||||
|
||||
void vcsAnnotate(const QString &workingDirectory, const QString &file,
|
||||
void vcsAnnotate(const FilePath &workingDirectory, const QString &file,
|
||||
const QString &revision, int lineNumber);
|
||||
void vcsDescribe(const Utils::FilePath &source, const QString &changeNr) final;
|
||||
|
||||
@@ -305,28 +305,28 @@ private:
|
||||
Utils::Id id, const QString &source,
|
||||
QTextCodec *codec);
|
||||
|
||||
CvsResponse runCvs(const QString &workingDirectory,
|
||||
CvsResponse runCvs(const FilePath &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
int timeOutS,
|
||||
unsigned flags,
|
||||
QTextCodec *outputCodec = nullptr) const;
|
||||
|
||||
void annotate(const QString &workingDir, const QString &file,
|
||||
void annotate(const FilePath &workingDir, const QString &file,
|
||||
const QString &revision = QString(), int lineNumber= -1);
|
||||
bool describe(const QString &source, const QString &changeNr, QString *errorMessage);
|
||||
bool describe(const QString &toplevel, const QString &source, const QString &changeNr, QString *errorMessage);
|
||||
bool describe(const QString &repository, QList<CvsLogEntry> entries, QString *errorMessage);
|
||||
void filelog(const QString &workingDir,
|
||||
const QString &file = QString(),
|
||||
bool describe(const Utils::FilePath &toplevel, const QString &source, const QString &changeNr, QString *errorMessage);
|
||||
bool describe(const Utils::FilePath &repository, QList<CvsLogEntry> entries, QString *errorMessage);
|
||||
void filelog(const Utils::FilePath &workingDir,
|
||||
const QString &file = {},
|
||||
bool enableAnnotationContextMenu = false);
|
||||
bool unedit(const QString &topLevel, const QStringList &files);
|
||||
bool status(const QString &topLevel, const QString &file, const QString &title);
|
||||
bool update(const QString &topLevel, const QString &file);
|
||||
bool unedit(const Utils::FilePath &topLevel, const QStringList &files);
|
||||
bool status(const Utils::FilePath &topLevel, const QString &file, const QString &title);
|
||||
bool update(const Utils::FilePath &topLevel, const QString &file);
|
||||
bool checkCVSDirectory(const QDir &directory) const;
|
||||
// Quick check if files are modified
|
||||
bool diffCheckModified(const QString &topLevel, const QStringList &files, bool *modified);
|
||||
bool diffCheckModified(const Utils::FilePath &topLevel, const QStringList &files, bool *modified);
|
||||
QString findTopLevelForDirectoryI(const QString &directory) const;
|
||||
void startCommit(const QString &workingDir, const QString &file = QString());
|
||||
void startCommit(const Utils::FilePath &workingDir, const QString &file = {});
|
||||
bool commit(const QString &messageFile, const QStringList &subVersionFileList);
|
||||
void cleanCommitMessageFile();
|
||||
|
||||
@@ -334,7 +334,7 @@ private:
|
||||
CvsClient *m_client = nullptr;
|
||||
|
||||
QString m_commitMessageFileName;
|
||||
QString m_commitRepository;
|
||||
FilePath m_commitRepository;
|
||||
|
||||
Core::CommandLocator *m_commandLocator = nullptr;
|
||||
Utils::ParameterAction *m_addAction = nullptr;
|
||||
@@ -403,10 +403,10 @@ Utils::Id CvsPluginPrivate::id() const
|
||||
return Utils::Id(VcsBase::Constants::VCS_ID_CVS);
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &fileName) const
|
||||
bool CvsPluginPrivate::isVcsFileOrDirectory(const Utils::FilePath &filePath) const
|
||||
{
|
||||
return fileName.isDir()
|
||||
&& !fileName.fileName().compare("CVS", Utils::HostOsInfo::fileNameCaseSensitivity());
|
||||
return filePath.isDir()
|
||||
&& !filePath.fileName().compare("CVS", Utils::HostOsInfo::fileNameCaseSensitivity());
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::isConfigured() const
|
||||
@@ -444,20 +444,17 @@ Core::IVersionControl::OpenSupportMode CvsPluginPrivate::openSupportMode(const F
|
||||
|
||||
bool CvsPluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return edit(fi.absolutePath(), QStringList(fi.fileName()));
|
||||
return edit(filePath.parentDir(), QStringList(filePath.fileName()));
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsAdd(fi.absolutePath(), fi.fileName());
|
||||
return vcsAdd(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsDelete(fi.absolutePath(), fi.fileName());
|
||||
return vcsDelete(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
@@ -467,8 +464,7 @@ bool CvsPluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
|
||||
void CvsPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
vcsAnnotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
vcsAnnotate(filePath.parentDir(), filePath.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
QString CvsPluginPrivate::vcsOpenText() const
|
||||
@@ -486,8 +482,7 @@ Core::ShellCommand *CvsPluginPrivate::createInitialCheckoutCommand(const QString
|
||||
QStringList args;
|
||||
args << QLatin1String("checkout") << url << extraArgs;
|
||||
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory.toString(),
|
||||
Environment::systemEnvironment());
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory, Environment::systemEnvironment());
|
||||
command->setDisplayName(tr("CVS Checkout"));
|
||||
command->addJob({m_settings.binaryPath.filePath(), m_settings.addOptions(args)}, -1);
|
||||
return command;
|
||||
@@ -799,7 +794,7 @@ void CvsPluginPrivate::diffCommitFiles(const QStringList &files)
|
||||
m_client->diff(m_commitRepository, files);
|
||||
}
|
||||
|
||||
static void setDiffBaseDirectory(IEditor *editor, const QString &db)
|
||||
static void setDiffBaseDirectory(IEditor *editor, const FilePath &db)
|
||||
{
|
||||
if (auto ve = qobject_cast<VcsBaseEditorWidget*>(editor->widget()))
|
||||
ve->setWorkingDirectory(db);
|
||||
@@ -845,7 +840,7 @@ void CvsPluginPrivate::updateActions(VcsBasePluginPrivate::ActionState as)
|
||||
m_commitProjectAction->setParameter(currentProjectName);
|
||||
|
||||
// TODO: Find a more elegant way to shorten the path
|
||||
QString currentDirectoryName = QDir::toNativeSeparators(currentState().currentFileDirectory());
|
||||
QString currentDirectoryName = currentState().currentFileDirectory().toUserOutput();
|
||||
if (currentDirectoryName.size() > 15)
|
||||
currentDirectoryName.replace(0, currentDirectoryName.size() - 15, QLatin1String("..."));
|
||||
m_updateDirectoryAction->setParameter(currentDirectoryName);
|
||||
@@ -874,7 +869,7 @@ void CvsPluginPrivate::revertAll()
|
||||
if (!messageBoxQuestion(title, tr("Revert all pending changes to the repository?")))
|
||||
return;
|
||||
QStringList args;
|
||||
args << QLatin1String("update") << QLatin1String("-C") << state.topLevel();
|
||||
args << QLatin1String("update") << QLatin1String("-C") << state.topLevel().toString();
|
||||
const CvsResponse revertResponse =
|
||||
runCvs(state.topLevel(), args, m_settings.timeout.value(),
|
||||
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
||||
@@ -963,7 +958,7 @@ void CvsPluginPrivate::startCommitAll()
|
||||
/* Start commit of files of a single repository by displaying
|
||||
* template and files in a submit editor. On closing, the real
|
||||
* commit will start. */
|
||||
void CvsPluginPrivate::startCommit(const QString &workingDir, const QString &file)
|
||||
void CvsPluginPrivate::startCommit(const FilePath &workingDir, const QString &file)
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
return;
|
||||
@@ -1051,9 +1046,9 @@ void CvsPluginPrivate::logRepository()
|
||||
filelog(state.topLevel());
|
||||
}
|
||||
|
||||
void CvsPluginPrivate::filelog(const QString &workingDir,
|
||||
const QString &file,
|
||||
bool enableAnnotationContextMenu)
|
||||
void CvsPluginPrivate::filelog(const FilePath &workingDir,
|
||||
const QString &file,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, QStringList(file));
|
||||
// no need for temp file
|
||||
@@ -1070,7 +1065,7 @@ void CvsPluginPrivate::filelog(const QString &workingDir,
|
||||
|
||||
// Re-use an existing view if possible to support
|
||||
// the common usage pattern of continuously changing and diffing a file
|
||||
const QString tag = VcsBaseEditor::editorTag(LogOutput, workingDir, QStringList(file));
|
||||
const QString tag = VcsBaseEditor::editorTag(LogOutput, workingDir.toString(), QStringList(file));
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(response.stdOut.toUtf8());
|
||||
EditorManager::activateEditor(editor);
|
||||
@@ -1097,7 +1092,7 @@ void CvsPluginPrivate::updateProject()
|
||||
update(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::update(const QString &topLevel, const QString &file)
|
||||
bool CvsPluginPrivate::update(const FilePath &topLevel, const QString &file)
|
||||
{
|
||||
QStringList args(QLatin1String("update"));
|
||||
args.push_back(QLatin1String("-dR"));
|
||||
@@ -1140,13 +1135,13 @@ void CvsPluginPrivate::annotateCurrentFile()
|
||||
annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void CvsPluginPrivate::vcsAnnotate(const QString &workingDirectory, const QString &file,
|
||||
const QString &revision, int lineNumber)
|
||||
void CvsPluginPrivate::vcsAnnotate(const FilePath &workingDirectory, const QString &file,
|
||||
const QString &revision, int lineNumber)
|
||||
{
|
||||
annotate(workingDirectory, file, revision, lineNumber);
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::edit(const QString &topLevel, const QStringList &files)
|
||||
bool CvsPluginPrivate::edit(const FilePath &topLevel, const QStringList &files)
|
||||
{
|
||||
QStringList args(QLatin1String("edit"));
|
||||
args.append(files);
|
||||
@@ -1156,7 +1151,7 @@ bool CvsPluginPrivate::edit(const QString &topLevel, const QStringList &files)
|
||||
return response.result == CvsResponse::Ok;
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::diffCheckModified(const QString &topLevel, const QStringList &files, bool *modified)
|
||||
bool CvsPluginPrivate::diffCheckModified(const FilePath &topLevel, const QStringList &files, bool *modified)
|
||||
{
|
||||
// Quick check for modified files using diff
|
||||
*modified = false;
|
||||
@@ -1170,7 +1165,7 @@ bool CvsPluginPrivate::diffCheckModified(const QString &topLevel, const QStringL
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::unedit(const QString &topLevel, const QStringList &files)
|
||||
bool CvsPluginPrivate::unedit(const FilePath &topLevel, const QStringList &files)
|
||||
{
|
||||
bool modified;
|
||||
// Prompt and use force flag if modified
|
||||
@@ -1178,8 +1173,8 @@ bool CvsPluginPrivate::unedit(const QString &topLevel, const QStringList &files)
|
||||
return false;
|
||||
if (modified) {
|
||||
const QString question = files.isEmpty() ?
|
||||
tr("Would you like to discard your changes to the repository \"%1\"?").arg(topLevel) :
|
||||
tr("Would you like to discard your changes to the file \"%1\"?").arg(files.front());
|
||||
tr("Would you like to discard your changes to the repository \"%1\"?").arg(topLevel.toUserOutput()) :
|
||||
tr("Would you like to discard your changes to the file \"%1\"?").arg(files.front());
|
||||
if (!messageBoxQuestion(tr("Unedit"), question))
|
||||
return false;
|
||||
}
|
||||
@@ -1196,9 +1191,9 @@ bool CvsPluginPrivate::unedit(const QString &topLevel, const QStringList &files)
|
||||
return response.result == CvsResponse::Ok;
|
||||
}
|
||||
|
||||
void CvsPluginPrivate::annotate(const QString &workingDir, const QString &file,
|
||||
const QString &revision /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
void CvsPluginPrivate::annotate(const FilePath &workingDir, const QString &file,
|
||||
const QString &revision /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
{
|
||||
const QStringList files(file);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, files);
|
||||
@@ -1220,7 +1215,7 @@ void CvsPluginPrivate::annotate(const QString &workingDir, const QString &file,
|
||||
if (lineNumber < 1)
|
||||
lineNumber = VcsBaseEditor::lineNumberOfCurrentEditor(file);
|
||||
|
||||
const QString tag = VcsBaseEditor::editorTag(AnnotateOutput, workingDir, QStringList(file), revision);
|
||||
const QString tag = VcsBaseEditor::editorTag(AnnotateOutput, workingDir.toString(), QStringList(file), revision);
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(response.stdOut.toUtf8());
|
||||
VcsBaseEditor::gotoLineOfEditor(editor, lineNumber);
|
||||
@@ -1233,7 +1228,7 @@ void CvsPluginPrivate::annotate(const QString &workingDir, const QString &file,
|
||||
}
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::status(const QString &topLevel, const QString &file, const QString &title)
|
||||
bool CvsPluginPrivate::status(const FilePath &topLevel, const QString &file, const QString &title)
|
||||
{
|
||||
QStringList args(QLatin1String("status"));
|
||||
if (!file.isEmpty())
|
||||
@@ -1242,7 +1237,7 @@ bool CvsPluginPrivate::status(const QString &topLevel, const QString &file, cons
|
||||
runCvs(topLevel, args, m_settings.timeout.value(), 0);
|
||||
const bool ok = response.result == CvsResponse::Ok;
|
||||
if (ok)
|
||||
showOutputInEditor(title, response.stdOut, commandLogEditorParameters.id, topLevel, nullptr);
|
||||
showOutputInEditor(title, response.stdOut, commandLogEditorParameters.id, topLevel.toString(), nullptr);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@@ -1291,10 +1286,10 @@ bool CvsPluginPrivate::describe(const QString &file, const QString &changeNr, QS
|
||||
.arg(QDir::toNativeSeparators(file));
|
||||
return false;
|
||||
}
|
||||
return describe(toplevel.toString(), QDir(toplevel.toString()).relativeFilePath(file), changeNr, errorMessage);
|
||||
return describe(toplevel, QDir(toplevel.toString()).relativeFilePath(file), changeNr, errorMessage);
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, const
|
||||
bool CvsPluginPrivate::describe(const FilePath &toplevel, const QString &file, const
|
||||
QString &changeNr, QString *errorMessage)
|
||||
{
|
||||
|
||||
@@ -1356,9 +1351,9 @@ bool CvsPluginPrivate::describe(const QString &toplevel, const QString &file, co
|
||||
|
||||
// Describe a set of files and revisions by
|
||||
// concatenating log and diffs to previous revisions
|
||||
bool CvsPluginPrivate::describe(const QString &repositoryPath,
|
||||
QList<CvsLogEntry> entries,
|
||||
QString *errorMessage)
|
||||
bool CvsPluginPrivate::describe(const FilePath &repositoryPath,
|
||||
QList<CvsLogEntry> entries,
|
||||
QString *errorMessage)
|
||||
{
|
||||
// Collect logs
|
||||
QString output;
|
||||
@@ -1431,11 +1426,11 @@ void CvsPluginPrivate::commitFromEditor()
|
||||
|
||||
// Run CVS. At this point, file arguments must be relative to
|
||||
// the working directory (see above).
|
||||
CvsResponse CvsPluginPrivate::runCvs(const QString &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
int timeOutS,
|
||||
unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
CvsResponse CvsPluginPrivate::runCvs(const FilePath &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
int timeOutS,
|
||||
unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
{
|
||||
const FilePath executable = m_settings.binaryPath.filePath();
|
||||
CvsResponse response;
|
||||
@@ -1495,7 +1490,7 @@ IEditor *CvsPluginPrivate::showOutputInEditor(const QString& title, const QStrin
|
||||
return editor;
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::vcsAdd(const QString &workingDir, const QString &rawFileName)
|
||||
bool CvsPluginPrivate::vcsAdd(const FilePath &workingDir, const QString &rawFileName)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("add") << rawFileName;
|
||||
@@ -1505,7 +1500,7 @@ bool CvsPluginPrivate::vcsAdd(const QString &workingDir, const QString &rawFileN
|
||||
return response.result == CvsResponse::Ok;
|
||||
}
|
||||
|
||||
bool CvsPluginPrivate::vcsDelete(const QString &workingDir, const QString &rawFileName)
|
||||
bool CvsPluginPrivate::vcsDelete(const FilePath &workingDir, const QString &rawFileName)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("remove") << QLatin1String("-f") << rawFileName;
|
||||
@@ -1551,7 +1546,7 @@ bool CvsPluginPrivate::managesFile(const FilePath &workingDirectory, const QStri
|
||||
QStringList args;
|
||||
args << QLatin1String("status") << fileName;
|
||||
const CvsResponse response =
|
||||
runCvs(workingDirectory.toString(), args, m_settings.timeout.value(), VcsCommand::SshPasswordPrompt);
|
||||
runCvs(workingDirectory, args, m_settings.timeout.value(), VcsCommand::SshPasswordPrompt);
|
||||
if (response.result != CvsResponse::Ok)
|
||||
return false;
|
||||
return !response.stdOut.contains(QLatin1String("Status: Unknown"));
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
using namespace Utils;
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
@@ -240,7 +241,7 @@ public:
|
||||
|
||||
BranchModel *q;
|
||||
GitClient *client;
|
||||
QString workingDirectory;
|
||||
FilePath workingDirectory;
|
||||
BranchNode *rootNode;
|
||||
BranchNode *currentBranch = nullptr;
|
||||
BranchNode *headNode = nullptr;
|
||||
@@ -422,7 +423,7 @@ void BranchModel::clear()
|
||||
d->obsoleteLocalBranches.clear();
|
||||
}
|
||||
|
||||
bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage)
|
||||
bool BranchModel::refresh(const FilePath &workingDirectory, QString *errorMessage)
|
||||
{
|
||||
beginResetModel();
|
||||
clear();
|
||||
@@ -510,7 +511,7 @@ void BranchModel::renameTag(const QString &oldName, const QString &newName)
|
||||
}
|
||||
}
|
||||
|
||||
QString BranchModel::workingDirectory() const
|
||||
FilePath BranchModel::workingDirectory() const
|
||||
{
|
||||
return d->workingDirectory;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QAbstractListModel>
|
||||
@@ -60,12 +61,12 @@ public:
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
void clear();
|
||||
bool refresh(const QString &workingDirectory, QString *errorMessage);
|
||||
bool refresh(const Utils::FilePath &workingDirectory, QString *errorMessage);
|
||||
|
||||
void renameBranch(const QString &oldName, const QString &newName);
|
||||
void renameTag(const QString &oldName, const QString &newName);
|
||||
|
||||
QString workingDirectory() const;
|
||||
Utils::FilePath workingDirectory() const;
|
||||
|
||||
QModelIndex currentBranch() const;
|
||||
QString fullName(const QModelIndex &idx, bool includePrefix = false) const;
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
@@ -139,13 +140,13 @@ BranchView::BranchView()
|
||||
refreshCurrentRepository();
|
||||
}
|
||||
|
||||
void BranchView::refreshIfSame(const QString &repository)
|
||||
void BranchView::refreshIfSame(const FilePath &repository)
|
||||
{
|
||||
if (m_repository == repository)
|
||||
refreshCurrentRepository();
|
||||
}
|
||||
|
||||
void BranchView::refresh(const QString &repository, bool force)
|
||||
void BranchView::refresh(const FilePath &repository, bool force)
|
||||
{
|
||||
if (m_repository == repository && !force)
|
||||
return;
|
||||
@@ -156,7 +157,7 @@ void BranchView::refresh(const QString &repository, bool force)
|
||||
m_addAction->setToolTip(tr("Create Git Repository..."));
|
||||
m_branchView->setEnabled(false);
|
||||
} else {
|
||||
m_repositoryLabel->setText(QDir::toNativeSeparators(m_repository));
|
||||
m_repositoryLabel->setText(m_repository.toUserOutput());
|
||||
m_repositoryLabel->setToolTip(GitPlugin::msgRepositoryLabel(m_repository));
|
||||
m_addAction->setToolTip(tr("Add Branch..."));
|
||||
m_branchView->setEnabled(true);
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <coreplugin/inavigationwidgetfactory.h>
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QWidget>
|
||||
|
||||
@@ -55,8 +57,8 @@ class BranchView : public QWidget
|
||||
public:
|
||||
explicit BranchView();
|
||||
|
||||
void refreshIfSame(const QString &repository);
|
||||
void refresh(const QString &repository, bool force);
|
||||
void refreshIfSame(const Utils::FilePath &repository);
|
||||
void refresh(const Utils::FilePath &repository, bool force);
|
||||
void refreshCurrentBranch();
|
||||
|
||||
QList<QToolButton *> createToolButtons();
|
||||
@@ -94,7 +96,7 @@ private:
|
||||
Utils::NavigationTreeView *m_branchView = nullptr;
|
||||
BranchModel *m_model = nullptr;
|
||||
BranchFilterModel *m_filterModel = nullptr;
|
||||
QString m_repository;
|
||||
Utils::FilePath m_repository;
|
||||
};
|
||||
|
||||
class BranchViewFactory : public Core::INavigationWidgetFactory
|
||||
|
||||
@@ -52,7 +52,7 @@ using namespace Utils;
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Utils::Id id,
|
||||
ChangeSelectionDialog::ChangeSelectionDialog(const FilePath &workingDirectory, Id id,
|
||||
QWidget *parent) :
|
||||
QDialog(parent), m_ui(new Ui::ChangeSelectionDialog)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Ut
|
||||
m_ui->setupUi(this);
|
||||
m_ui->workingDirectoryChooser->setExpectedKind(PathChooser::ExistingDirectory);
|
||||
m_ui->workingDirectoryChooser->setPromptDialogTitle(tr("Select Git Directory"));
|
||||
m_ui->workingDirectoryChooser->setPath(workingDirectory);
|
||||
m_ui->workingDirectoryChooser->setFilePath(workingDirectory);
|
||||
m_gitEnvironment = GitClient::instance()->processEnvironment();
|
||||
m_ui->changeNumberEdit->setFocus();
|
||||
m_ui->changeNumberEdit->selectAll();
|
||||
@@ -116,7 +116,7 @@ QString ChangeSelectionDialog::change() const
|
||||
|
||||
void ChangeSelectionDialog::selectCommitFromRecentHistory()
|
||||
{
|
||||
QString workingDir = workingDirectory();
|
||||
FilePath workingDir = workingDirectory();
|
||||
if (workingDir.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -135,11 +135,11 @@ void ChangeSelectionDialog::selectCommitFromRecentHistory()
|
||||
m_ui->changeNumberEdit->setText(dialog.commit());
|
||||
}
|
||||
|
||||
QString ChangeSelectionDialog::workingDirectory() const
|
||||
FilePath ChangeSelectionDialog::workingDirectory() const
|
||||
{
|
||||
const QString workingDir = m_ui->workingDirectoryChooser->filePath().toString();
|
||||
if (workingDir.isEmpty() || !QDir(workingDir).exists())
|
||||
return QString();
|
||||
const FilePath workingDir = m_ui->workingDirectoryChooser->filePath();
|
||||
if (workingDir.isEmpty() || !workingDir.exists())
|
||||
return {};
|
||||
|
||||
return Core::VcsManager::findTopLevelForDirectory(workingDir);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ void ChangeSelectionDialog::terminateProcess()
|
||||
|
||||
void ChangeSelectionDialog::recalculateCompletion()
|
||||
{
|
||||
const QString workingDir = workingDirectory();
|
||||
const FilePath workingDir = workingDirectory();
|
||||
if (workingDir == m_oldWorkingDir)
|
||||
return;
|
||||
m_oldWorkingDir = workingDir;
|
||||
@@ -216,7 +216,7 @@ void ChangeSelectionDialog::recalculateDetails()
|
||||
terminateProcess();
|
||||
enableButtons(true);
|
||||
|
||||
const QString workingDir = workingDirectory();
|
||||
const FilePath workingDir = workingDirectory();
|
||||
if (workingDir.isEmpty()) {
|
||||
m_ui->detailsText->setPlainText(tr("Error: Bad working directory."));
|
||||
return;
|
||||
@@ -229,7 +229,7 @@ void ChangeSelectionDialog::recalculateDetails()
|
||||
}
|
||||
|
||||
m_process = new QProcess(this);
|
||||
m_process->setWorkingDirectory(workingDir);
|
||||
m_process->setWorkingDirectory(workingDir.toString());
|
||||
m_process->setProcessEnvironment(m_gitEnvironment.toProcessEnvironment());
|
||||
|
||||
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
|
||||
@@ -54,12 +54,12 @@ class ChangeSelectionDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChangeSelectionDialog(const QString &workingDirectory, Utils::Id id, QWidget *parent);
|
||||
ChangeSelectionDialog(const Utils::FilePath &workingDirectory, Utils::Id id, QWidget *parent);
|
||||
~ChangeSelectionDialog() override;
|
||||
|
||||
QString change() const;
|
||||
|
||||
QString workingDirectory() const;
|
||||
Utils::FilePath workingDirectory() const;
|
||||
ChangeCommand command() const;
|
||||
|
||||
private:
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
Utils::Environment m_gitEnvironment;
|
||||
ChangeCommand m_command = NoCommand;
|
||||
QStringListModel *m_changeModel = nullptr;
|
||||
QString m_oldWorkingDir;
|
||||
Utils::FilePath m_oldWorkingDir;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "gitsettings.h" // CommitType
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QPair>
|
||||
@@ -43,7 +45,7 @@ class GitSubmitEditorPanelInfo
|
||||
{
|
||||
public:
|
||||
void clear();
|
||||
QString repository;
|
||||
Utils::FilePath repository;
|
||||
QString branch;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,11 +28,12 @@
|
||||
|
||||
using namespace Git::Internal;
|
||||
using namespace Gerrit::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
BranchComboBox::BranchComboBox(QWidget *parent) : QComboBox(parent)
|
||||
{ }
|
||||
|
||||
void BranchComboBox::init(const QString &repository)
|
||||
void BranchComboBox::init(const FilePath &repository)
|
||||
{
|
||||
m_repository = repository;
|
||||
QString currentBranch = GitClient::instance()->synchronousCurrentLocalBranch(repository);
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
namespace Git {
|
||||
@@ -38,10 +40,10 @@ class BranchComboBox : public QComboBox
|
||||
{
|
||||
public:
|
||||
explicit BranchComboBox(QWidget *parent = nullptr);
|
||||
void init(const QString &repository);
|
||||
void init(const Utils::FilePath &repository);
|
||||
|
||||
private:
|
||||
QString m_repository;
|
||||
Utils::FilePath m_repository;
|
||||
bool m_detached = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
#include <QStringListModel>
|
||||
#include <QUrl>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Gerrit {
|
||||
namespace Internal {
|
||||
|
||||
@@ -53,7 +55,7 @@ static const int maxTitleWidth = 350;
|
||||
|
||||
GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
|
||||
const QSharedPointer<GerritServer> &s,
|
||||
const QString &repository,
|
||||
const FilePath &repository,
|
||||
QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_parameters(p)
|
||||
@@ -127,12 +129,12 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
|
||||
m_refreshButton->setDefault(true);
|
||||
}
|
||||
|
||||
QString GerritDialog::repositoryPath() const
|
||||
FilePath GerritDialog::repositoryPath() const
|
||||
{
|
||||
return m_repository;
|
||||
}
|
||||
|
||||
void GerritDialog::setCurrentPath(const QString &path)
|
||||
void GerritDialog::setCurrentPath(const FilePath &path)
|
||||
{
|
||||
if (path == m_repository)
|
||||
return;
|
||||
@@ -244,7 +246,7 @@ void GerritDialog::remoteChanged()
|
||||
void GerritDialog::updateRemotes(bool forceReload)
|
||||
{
|
||||
m_ui->remoteComboBox->setRepository(m_repository);
|
||||
if (m_repository.isEmpty() || !QFileInfo(m_repository).isDir())
|
||||
if (m_repository.isEmpty() || !m_repository.isDir())
|
||||
return;
|
||||
*m_server = m_parameters->server;
|
||||
m_ui->remoteComboBox->updateRemotes(forceReload);
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QSharedPointer>
|
||||
#include <QTimer>
|
||||
@@ -54,11 +56,11 @@ class GerritDialog : public QDialog
|
||||
public:
|
||||
explicit GerritDialog(const QSharedPointer<GerritParameters> &p,
|
||||
const QSharedPointer<GerritServer> &s,
|
||||
const QString &repository,
|
||||
const Utils::FilePath &repository,
|
||||
QWidget *parent = nullptr);
|
||||
~GerritDialog() override;
|
||||
QString repositoryPath() const;
|
||||
void setCurrentPath(const QString &path);
|
||||
Utils::FilePath repositoryPath() const;
|
||||
void setCurrentPath(const Utils::FilePath &path);
|
||||
void fetchStarted(const QSharedPointer<Gerrit::Internal::GerritChange> &change);
|
||||
void fetchFinished();
|
||||
void refresh();
|
||||
@@ -100,7 +102,7 @@ private:
|
||||
QPushButton *m_refreshButton;
|
||||
Utils::ProgressIndicator *m_progressIndicator;
|
||||
QTimer m_progressIndicatorTimer;
|
||||
QString m_repository;
|
||||
Utils::FilePath m_repository;
|
||||
bool m_fetchRunning = false;
|
||||
bool m_updatingRemotes = false;
|
||||
bool m_shouldUpdateRemotes = false;
|
||||
|
||||
@@ -92,7 +92,7 @@ class FetchContext : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
FetchContext(const QSharedPointer<GerritChange> &change,
|
||||
const QString &repository, const Utils::FilePath &git,
|
||||
const FilePath &repository, const FilePath &git,
|
||||
const GerritServer &server,
|
||||
FetchMode fm, QObject *parent = nullptr);
|
||||
~FetchContext() override;
|
||||
@@ -118,7 +118,7 @@ private:
|
||||
void terminate();
|
||||
|
||||
const QSharedPointer<GerritChange> m_change;
|
||||
const QString m_repository;
|
||||
const FilePath m_repository;
|
||||
const FetchMode m_fetchMode;
|
||||
const Utils::FilePath m_git;
|
||||
const GerritServer m_server;
|
||||
@@ -129,7 +129,7 @@ private:
|
||||
};
|
||||
|
||||
FetchContext::FetchContext(const QSharedPointer<GerritChange> &change,
|
||||
const QString &repository, const Utils::FilePath &git,
|
||||
const FilePath &repository, const FilePath &git,
|
||||
const GerritServer &server,
|
||||
FetchMode fm, QObject *parent)
|
||||
: QObject(parent)
|
||||
@@ -170,7 +170,7 @@ void FetchContext::start()
|
||||
m_progress.reportStarted();
|
||||
// Order: initialize future before starting the process in case error handling is invoked.
|
||||
const QStringList args = m_change->gitFetchArguments(m_server);
|
||||
VcsBase::VcsOutputWindow::appendCommand(m_repository, {m_git, args});
|
||||
VcsBase::VcsOutputWindow::appendCommand(m_repository.toString(), {m_git, args});
|
||||
m_process.setCommand({m_git, args});
|
||||
m_process.start();
|
||||
m_process.closeWriteChannel();
|
||||
@@ -242,7 +242,7 @@ void FetchContext::show()
|
||||
{
|
||||
const QString title = QString::number(m_change->number) + '/'
|
||||
+ QString::number(m_change->currentPatchSet.patchSetNumber);
|
||||
GitClient::instance()->show(m_repository, "FETCH_HEAD", title);
|
||||
GitClient::instance()->show(m_repository.toString(), "FETCH_HEAD", title);
|
||||
}
|
||||
|
||||
void FetchContext::cherryPick()
|
||||
@@ -314,7 +314,7 @@ void GerritPlugin::addToLocator(CommandLocator *locator)
|
||||
locator->appendCommand(m_pushToGerritCommand);
|
||||
}
|
||||
|
||||
void GerritPlugin::push(const QString &topLevel)
|
||||
void GerritPlugin::push(const FilePath &topLevel)
|
||||
{
|
||||
// QScopedPointer is required to delete the dialog when leaving the function
|
||||
GerritPushDialog dialog(topLevel, m_reviewers, m_parameters, ICore::dialogParent());
|
||||
@@ -333,7 +333,7 @@ void GerritPlugin::push(const QString &topLevel)
|
||||
GitClient::instance()->push(topLevel, {dialog.selectedRemoteName(), dialog.pushTarget()});
|
||||
}
|
||||
|
||||
static QString currentRepository()
|
||||
static FilePath currentRepository()
|
||||
{
|
||||
return GitPlugin::currentState().topLevel();
|
||||
}
|
||||
@@ -381,7 +381,7 @@ Utils::FilePath GerritPlugin::gitBinDirectory()
|
||||
}
|
||||
|
||||
// Find the branch of a repository.
|
||||
QString GerritPlugin::branch(const QString &repository)
|
||||
QString GerritPlugin::branch(const FilePath &repository)
|
||||
{
|
||||
return GitClient::instance()->synchronousCurrentLocalBranch(repository);
|
||||
}
|
||||
@@ -395,9 +395,9 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
return;
|
||||
}
|
||||
|
||||
QString repository;
|
||||
FilePath repository;
|
||||
bool verifiedRepository = false;
|
||||
if (!m_dialog.isNull() && !m_parameters.isNull() && QFile::exists(m_dialog->repositoryPath()))
|
||||
if (!m_dialog.isNull() && !m_parameters.isNull() && m_dialog->repositoryPath().exists())
|
||||
repository = m_dialog->repositoryPath();
|
||||
|
||||
if (!repository.isEmpty()) {
|
||||
@@ -421,8 +421,8 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
if (remote.endsWith(".git"))
|
||||
remote.chop(4);
|
||||
if (remote.contains(m_server->host) && remote.endsWith(change->project)
|
||||
&& QFile::exists(repository + '/' + submoduleData.dir)) {
|
||||
repository = QDir::cleanPath(repository + '/' + submoduleData.dir);
|
||||
&& repository.pathAppended(submoduleData.dir).exists()) {
|
||||
repository = repository.pathAppended(submoduleData.dir).cleanPath();
|
||||
verifiedRepository = true;
|
||||
break;
|
||||
}
|
||||
@@ -436,7 +436,7 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
" in %3. Select different folder?")
|
||||
.arg(m_server->host,
|
||||
change->project,
|
||||
QDir::toNativeSeparators(repository)),
|
||||
repository.toUserOutput()),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
|
||||
QMessageBox::Yes);
|
||||
switch (answer) {
|
||||
@@ -458,8 +458,8 @@ void GerritPlugin::fetch(const QSharedPointer<GerritChange> &change, int mode)
|
||||
tr("Enter Local Repository for \"%1\" (%2)").arg(change->project, change->branch);
|
||||
const QString suggestedRespository =
|
||||
findLocalRepository(change->project, change->branch);
|
||||
repository = QFileDialog::getExistingDirectory(m_dialog.data(),
|
||||
title, suggestedRespository);
|
||||
repository = FilePath::fromString(QFileDialog::getExistingDirectory(m_dialog.data(),
|
||||
title, suggestedRespository));
|
||||
}
|
||||
|
||||
if (repository.isEmpty())
|
||||
@@ -500,7 +500,7 @@ QString GerritPlugin::findLocalRepository(QString project, const QString &branch
|
||||
if (branch.isEmpty()) {
|
||||
return repository;
|
||||
} else {
|
||||
const QString repositoryBranch = GerritPlugin::branch(repository);
|
||||
const QString repositoryBranch = GerritPlugin::branch(FilePath::fromString(repository));
|
||||
if (repositoryBranch.isEmpty() || repositoryBranch == branch)
|
||||
return repository;
|
||||
} // !branch.isEmpty()
|
||||
|
||||
@@ -58,9 +58,9 @@ public:
|
||||
void initialize(Core::ActionContainer *ac);
|
||||
|
||||
static Utils::FilePath gitBinDirectory();
|
||||
static QString branch(const QString &repository);
|
||||
static QString branch(const Utils::FilePath &repository);
|
||||
void addToLocator(Core::CommandLocator *locator);
|
||||
void push(const QString &topLevel);
|
||||
void push(const Utils::FilePath &topLevel);
|
||||
|
||||
void updateActions(const VcsBase::VcsBasePluginState &state);
|
||||
|
||||
|
||||
@@ -124,14 +124,14 @@ void GerritPushDialog::initRemoteBranches()
|
||||
m_ui->remoteComboBox->updateRemotes(false);
|
||||
}
|
||||
|
||||
GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &reviewerList,
|
||||
GerritPushDialog::GerritPushDialog(const Utils::FilePath &workingDir, const QString &reviewerList,
|
||||
QSharedPointer<GerritParameters> parameters, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_workingDir(workingDir),
|
||||
m_ui(new Ui::GerritPushDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->repositoryLabel->setText(QDir::toNativeSeparators(workingDir));
|
||||
m_ui->repositoryLabel->setText(workingDir.toUserOutput());
|
||||
m_ui->remoteComboBox->setRepository(workingDir);
|
||||
m_ui->remoteComboBox->setParameters(parameters);
|
||||
m_ui->remoteComboBox->setAllowDups(true);
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMultiMap>
|
||||
#include <QDate>
|
||||
@@ -46,7 +48,7 @@ class GerritPushDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GerritPushDialog(const QString &workingDir, const QString &reviewerList,
|
||||
GerritPushDialog(const Utils::FilePath &workingDir, const QString &reviewerList,
|
||||
QSharedPointer<GerritParameters> parameters, QWidget *parent);
|
||||
~GerritPushDialog() override;
|
||||
|
||||
@@ -72,7 +74,7 @@ private:
|
||||
QString determineRemoteBranch(const QString &localBranch);
|
||||
void initRemoteBranches();
|
||||
QString calculateChangeRange(const QString &branch);
|
||||
QString m_workingDir;
|
||||
Utils::FilePath m_workingDir;
|
||||
QString m_suggestedRemoteBranch;
|
||||
QString m_initErrorMessage;
|
||||
Ui::GerritPushDialog *m_ui;
|
||||
|
||||
@@ -28,12 +28,15 @@
|
||||
#include "gerritserver.h"
|
||||
#include "../gitclient.h"
|
||||
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Gerrit {
|
||||
namespace Internal {
|
||||
|
||||
@@ -64,7 +67,7 @@ GerritRemoteChooser::GerritRemoteChooser(QWidget *parent) :
|
||||
this, [this] { updateRemotes(true); });
|
||||
}
|
||||
|
||||
void GerritRemoteChooser::setRepository(const QString &repository)
|
||||
void GerritRemoteChooser::setRepository(const FilePath &repository)
|
||||
{
|
||||
m_repository = repository;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "gerritserver.h"
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QSharedPointer>
|
||||
#include <QToolButton>
|
||||
@@ -45,7 +47,7 @@ class GerritRemoteChooser : public QWidget
|
||||
|
||||
public:
|
||||
GerritRemoteChooser(QWidget *parent = nullptr);
|
||||
void setRepository(const QString &repository);
|
||||
void setRepository(const Utils::FilePath &repository);
|
||||
void setParameters(QSharedPointer<GerritParameters> parameters);
|
||||
void setFallbackEnabled(bool value);
|
||||
void setAllowDups(bool value);
|
||||
@@ -63,7 +65,7 @@ private:
|
||||
void addRemote(const GerritServer &server, const QString &name);
|
||||
void handleRemoteChanged();
|
||||
|
||||
QString m_repository;
|
||||
Utils::FilePath m_repository;
|
||||
QSharedPointer<GerritParameters> m_parameters;
|
||||
QComboBox *m_remoteComboBox = nullptr;
|
||||
QToolButton *m_resetRemoteButton = nullptr;
|
||||
|
||||
@@ -245,7 +245,7 @@ int GerritServer::testConnection()
|
||||
static GitClient *const client = GitClient::instance();
|
||||
const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC);
|
||||
QtcProcess proc;
|
||||
client->vcsFullySynchronousExec(proc, QString(), {curlBinary, arguments},
|
||||
client->vcsFullySynchronousExec(proc, {}, {curlBinary, arguments},
|
||||
Core::ShellCommand::NoOutput);
|
||||
if (proc.result() == QtcProcess::FinishedWithSuccess) {
|
||||
QString output = proc.stdOut();
|
||||
@@ -346,7 +346,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
|
||||
if (port)
|
||||
arguments << p.portFlag << QString::number(port);
|
||||
arguments << hostArgument() << "gerrit" << "version";
|
||||
client->vcsFullySynchronousExec(proc, QString(), {p.ssh, arguments},
|
||||
client->vcsFullySynchronousExec(proc, {}, {p.ssh, arguments},
|
||||
Core::ShellCommand::NoOutput);
|
||||
QString stdOut = proc.stdOut().trimmed();
|
||||
stdOut.remove("gerrit version ");
|
||||
@@ -354,7 +354,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
|
||||
} else {
|
||||
const QStringList arguments = curlArguments() << (url(RestUrl) + versionUrlC);
|
||||
QtcProcess proc;
|
||||
client->vcsFullySynchronousExec(proc, QString(), {curlBinary, arguments},
|
||||
client->vcsFullySynchronousExec(proc, {}, {curlBinary, arguments},
|
||||
Core::ShellCommand::NoOutput);
|
||||
// REST endpoint for version is only available from 2.8 and up. Do not consider invalid
|
||||
// if it fails.
|
||||
|
||||
+196
-193
File diff suppressed because it is too large
Load Diff
+129
-126
@@ -120,7 +120,7 @@ public:
|
||||
enum StashResult { StashUnchanged, StashCanceled, StashFailed,
|
||||
Stashed, NotStashed /* User did not want it */ };
|
||||
|
||||
bool init(const QString &workingDirectory, const QString &command,
|
||||
bool init(const Utils::FilePath &workingDirectory, const QString &command,
|
||||
StashFlag flag = Default, PushAction pushAction = NoPush);
|
||||
bool stashingFailed() const;
|
||||
void end();
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
|
||||
StashResult m_stashResult = NotStashed;
|
||||
QString m_message;
|
||||
QString m_workingDir;
|
||||
Utils::FilePath m_workingDir;
|
||||
StashFlag m_flags = Default;
|
||||
PushAction m_pushAction = NoPush;
|
||||
};
|
||||
@@ -145,178 +145,178 @@ public:
|
||||
Utils::FilePath vcsBinary() const override;
|
||||
unsigned gitVersion(QString *errorMessage = nullptr) const;
|
||||
|
||||
VcsBase::VcsCommand *vcsExecAbortable(const QString &workingDirectory,
|
||||
VcsBase::VcsCommand *vcsExecAbortable(const Utils::FilePath &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
bool isRebase = false,
|
||||
QString abortCommand = QString());
|
||||
QString abortCommand = {});
|
||||
|
||||
QString findRepositoryForDirectory(const QString &directory) const;
|
||||
QString findGitDirForRepository(const QString &repositoryDir) const;
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
|
||||
QString findGitDirForRepository(const Utils::FilePath &repositoryDir) const;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const;
|
||||
Utils::FilePaths unmanagedFiles(const Utils::FilePaths &filePaths) const;
|
||||
|
||||
void diffFile(const QString &workingDirectory, const QString &fileName) const;
|
||||
void diffFiles(const QString &workingDirectory,
|
||||
void diffFile(const Utils::FilePath &workingDirectory, const QString &fileName) const;
|
||||
void diffFiles(const Utils::FilePath &workingDirectory,
|
||||
const QStringList &unstagedFileNames,
|
||||
const QStringList &stagedFileNames) const;
|
||||
void diffProject(const QString &workingDirectory,
|
||||
void diffProject(const Utils::FilePath &workingDirectory,
|
||||
const QString &projectDirectory) const;
|
||||
void diffRepository(const QString &workingDirectory) const
|
||||
void diffRepository(const Utils::FilePath &workingDirectory) const
|
||||
{
|
||||
return diffRepository(workingDirectory, {}, {});
|
||||
}
|
||||
void diffRepository(const QString &workingDirectory,
|
||||
void diffRepository(const Utils::FilePath &workingDirectory,
|
||||
const QString &leftCommit,
|
||||
const QString &rightCommit) const;
|
||||
void diffBranch(const QString &workingDirectory,
|
||||
void diffBranch(const Utils::FilePath &workingDirectory,
|
||||
const QString &branchName) const;
|
||||
void merge(const QString &workingDirectory, const QStringList &unmergedFileNames = QStringList());
|
||||
void merge(const Utils::FilePath &workingDirectory, const QStringList &unmergedFileNames = {});
|
||||
|
||||
void status(const QString &workingDirectory) const;
|
||||
void log(const QString &workingDirectory, const QString &fileName = QString(),
|
||||
bool enableAnnotationContextMenu = false, const QStringList &args = QStringList());
|
||||
void reflog(const QString &workingDirectory, const QString &branch = {});
|
||||
VcsBase::VcsBaseEditorWidget *annotate(
|
||||
const QString &workingDir, const QString &file, const QString &revision = QString(),
|
||||
int lineNumber = -1, const QStringList &extraOptions = QStringList()) override;
|
||||
void reset(const QString &workingDirectory, const QString &argument, const QString &commit = QString());
|
||||
void removeStaleRemoteBranches(const QString &workingDirectory, const QString &remote);
|
||||
void recoverDeletedFiles(const QString &workingDirectory);
|
||||
void addFile(const QString &workingDirectory, const QString &fileName);
|
||||
bool synchronousLog(const QString &workingDirectory, const QStringList &arguments,
|
||||
void status(const Utils::FilePath &workingDirectory) const;
|
||||
void log(const Utils::FilePath &workingDirectory, const QString &fileName = {},
|
||||
bool enableAnnotationContextMenu = false, const QStringList &args = {});
|
||||
void reflog(const Utils::FilePath &workingDirectory, const QString &branch = {});
|
||||
VcsBase::VcsBaseEditorWidget *annotate(const Utils::FilePath &workingDir, const QString &file,
|
||||
const QString &revision = {}, int lineNumber = -1,
|
||||
const QStringList &extraOptions = {}) override;
|
||||
void reset(const Utils::FilePath &workingDirectory, const QString &argument, const QString &commit = {});
|
||||
void removeStaleRemoteBranches(const Utils::FilePath &workingDirectory, const QString &remote);
|
||||
void recoverDeletedFiles(const Utils::FilePath &workingDirectory);
|
||||
void addFile(const Utils::FilePath &workingDirectory, const QString &fileName);
|
||||
bool synchronousLog(const Utils::FilePath &workingDirectory, const QStringList &arguments,
|
||||
QString *output, QString *errorMessage = nullptr,
|
||||
unsigned flags = 0);
|
||||
bool synchronousAdd(const QString &workingDirectory, const QStringList &files,
|
||||
bool synchronousAdd(const Utils::FilePath &workingDirectory, const QStringList &files,
|
||||
const QStringList &extraOptions = {});
|
||||
bool synchronousDelete(const QString &workingDirectory,
|
||||
bool synchronousDelete(const Utils::FilePath &workingDirectory,
|
||||
bool force,
|
||||
const QStringList &files);
|
||||
bool synchronousMove(const QString &workingDirectory,
|
||||
bool synchronousMove(const Utils::FilePath &workingDirectory,
|
||||
const QString &from,
|
||||
const QString &to);
|
||||
bool synchronousReset(const QString &workingDirectory, const QStringList &files = QStringList(),
|
||||
bool synchronousReset(const Utils::FilePath &workingDirectory, const QStringList &files = {},
|
||||
QString *errorMessage = nullptr);
|
||||
bool synchronousCleanList(const QString &workingDirectory, const QString &modulePath,
|
||||
bool synchronousCleanList(const Utils::FilePath &workingDirectory, const QString &modulePath,
|
||||
QStringList *files, QStringList *ignoredFiles, QString *errorMessage);
|
||||
bool synchronousApplyPatch(const QString &workingDirectory, const QString &file,
|
||||
QString *errorMessage, const QStringList &extraArguments = QStringList());
|
||||
bool synchronousApplyPatch(const Utils::FilePath &workingDirectory, const QString &file,
|
||||
QString *errorMessage, const QStringList &extraArguments = {});
|
||||
bool synchronousInit(const Utils::FilePath &workingDirectory);
|
||||
bool synchronousCheckoutFiles(const QString &workingDirectory, QStringList files = QStringList(),
|
||||
QString revision = QString(), QString *errorMessage = nullptr,
|
||||
bool synchronousCheckoutFiles(const Utils::FilePath &workingDirectory, QStringList files = {},
|
||||
QString revision = {}, QString *errorMessage = nullptr,
|
||||
bool revertStaging = true);
|
||||
enum class StashMode { NoStash, TryStash };
|
||||
VcsBase::VcsCommand *checkout(const QString &workingDirectory, const QString &ref,
|
||||
VcsBase::VcsCommand *checkout(const Utils::FilePath &workingDirectory, const QString &ref,
|
||||
StashMode stashMode = StashMode::TryStash);
|
||||
|
||||
QStringList setupCheckoutArguments(const QString &workingDirectory, const QString &ref);
|
||||
void updateSubmodulesIfNeeded(const QString &workingDirectory, bool prompt);
|
||||
QStringList setupCheckoutArguments(const Utils::FilePath &workingDirectory, const QString &ref);
|
||||
void updateSubmodulesIfNeeded(const Utils::FilePath &workingDirectory, bool prompt);
|
||||
|
||||
// Do a stash and return identier.
|
||||
enum { StashPromptDescription = 0x1, StashImmediateRestore = 0x2, StashIgnoreUnchanged = 0x4 };
|
||||
QString synchronousStash(const QString &workingDirectory,
|
||||
const QString &messageKeyword = QString(),
|
||||
QString synchronousStash(const Utils::FilePath &workingDirectory,
|
||||
const QString &messageKeyword = {},
|
||||
unsigned flags = 0, bool *unchanged = nullptr) const;
|
||||
|
||||
bool executeSynchronousStash(const QString &workingDirectory,
|
||||
const QString &message = QString(),
|
||||
bool executeSynchronousStash(const Utils::FilePath &workingDirectory,
|
||||
const QString &message = {},
|
||||
bool unstagedOnly = false,
|
||||
QString *errorMessage = nullptr) const;
|
||||
bool synchronousStashRestore(const QString &workingDirectory,
|
||||
bool synchronousStashRestore(const Utils::FilePath &workingDirectory,
|
||||
const QString &stash,
|
||||
bool pop = false,
|
||||
const QString &branch = QString()) const;
|
||||
bool synchronousStashRemove(const QString &workingDirectory,
|
||||
const QString &stash = QString(),
|
||||
const QString &branch = {}) const;
|
||||
bool synchronousStashRemove(const Utils::FilePath &workingDirectory,
|
||||
const QString &stash = {},
|
||||
QString *errorMessage = nullptr) const;
|
||||
bool synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs,
|
||||
bool synchronousBranchCmd(const Utils::FilePath &workingDirectory, QStringList branchArgs,
|
||||
QString *output, QString *errorMessage) const;
|
||||
bool synchronousTagCmd(const QString &workingDirectory, QStringList tagArgs,
|
||||
bool synchronousTagCmd(const Utils::FilePath &workingDirectory, QStringList tagArgs,
|
||||
QString *output, QString *errorMessage) const;
|
||||
bool synchronousForEachRefCmd(const QString &workingDirectory, QStringList args,
|
||||
bool synchronousForEachRefCmd(const Utils::FilePath &workingDirectory, QStringList args,
|
||||
QString *output, QString *errorMessage = nullptr) const;
|
||||
VcsBase::VcsCommand *asyncForEachRefCmd(const QString &workingDirectory, QStringList args) const;
|
||||
bool synchronousRemoteCmd(const QString &workingDirectory, QStringList remoteArgs,
|
||||
VcsBase::VcsCommand *asyncForEachRefCmd(const Utils::FilePath &workingDirectory, QStringList args) const;
|
||||
bool synchronousRemoteCmd(const Utils::FilePath &workingDirectory, QStringList remoteArgs,
|
||||
QString *output = nullptr, QString *errorMessage = nullptr,
|
||||
bool silent = false) const;
|
||||
|
||||
QMap<QString,QString> synchronousRemotesList(const QString &workingDirectory,
|
||||
QMap<QString,QString> synchronousRemotesList(const Utils::FilePath &workingDirectory,
|
||||
QString *errorMessage = nullptr) const;
|
||||
QStringList synchronousSubmoduleStatus(const QString &workingDirectory,
|
||||
QStringList synchronousSubmoduleStatus(const Utils::FilePath &workingDirectory,
|
||||
QString *errorMessage = nullptr) const;
|
||||
SubmoduleDataMap submoduleList(const QString &workingDirectory) const;
|
||||
QByteArray synchronousShow(const QString &workingDirectory, const QString &id,
|
||||
SubmoduleDataMap submoduleList(const Utils::FilePath &workingDirectory) const;
|
||||
QByteArray synchronousShow(const Utils::FilePath &workingDirectory, const QString &id,
|
||||
unsigned flags = 0) const;
|
||||
|
||||
bool synchronousRevListCmd(const QString &workingDirectory, const QStringList &extraArguments,
|
||||
bool synchronousRevListCmd(const Utils::FilePath &workingDirectory, const QStringList &extraArguments,
|
||||
QString *output, QString *errorMessage = nullptr) const;
|
||||
|
||||
bool synchronousParentRevisions(const QString &workingDirectory,
|
||||
bool synchronousParentRevisions(const Utils::FilePath &workingDirectory,
|
||||
const QString &revision,
|
||||
QStringList *parents,
|
||||
QString *errorMessage) const;
|
||||
QString synchronousShortDescription(const QString &workingDirectory, const QString &revision) const;
|
||||
QString synchronousShortDescription(const QString &workingDirectory, const QString &revision,
|
||||
QString synchronousShortDescription(const Utils::FilePath &workingDirectory, const QString &revision) const;
|
||||
QString synchronousShortDescription(const Utils::FilePath &workingDirectory, const QString &revision,
|
||||
const QString &format) const;
|
||||
|
||||
QString synchronousCurrentLocalBranch(const QString &workingDirectory) const;
|
||||
QString synchronousCurrentLocalBranch(const Utils::FilePath &workingDirectory) const;
|
||||
|
||||
bool synchronousHeadRefs(const QString &workingDirectory, QStringList *output,
|
||||
bool synchronousHeadRefs(const Utils::FilePath &workingDirectory, QStringList *output,
|
||||
QString *errorMessage = nullptr) const;
|
||||
QString synchronousTopic(const QString &workingDirectory) const;
|
||||
bool synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
|
||||
QString synchronousTopic(const Utils::FilePath &workingDirectory) const;
|
||||
bool synchronousRevParseCmd(const Utils::FilePath &workingDirectory, const QString &ref,
|
||||
QString *output, QString *errorMessage = nullptr) const;
|
||||
QString synchronousTopRevision(const QString &workingDirectory, QDateTime *dateTime = nullptr);
|
||||
void synchronousTagsForCommit(const QString &workingDirectory, const QString &revision,
|
||||
QString synchronousTopRevision(const Utils::FilePath &workingDirectory, QDateTime *dateTime = nullptr);
|
||||
void synchronousTagsForCommit(const Utils::FilePath &workingDirectory, const QString &revision,
|
||||
QString &precedes, QString &follows) const;
|
||||
bool isRemoteCommit(const QString &workingDirectory, const QString &commit);
|
||||
bool isFastForwardMerge(const QString &workingDirectory, const QString &branch);
|
||||
bool isRemoteCommit(const Utils::FilePath &workingDirectory, const QString &commit);
|
||||
bool isFastForwardMerge(const Utils::FilePath &workingDirectory, const QString &branch);
|
||||
|
||||
void fetch(const QString &workingDirectory, const QString &remote);
|
||||
void pull(const QString &workingDirectory, bool rebase);
|
||||
void push(const QString &workingDirectory, const QStringList &pushArgs = QStringList());
|
||||
bool synchronousMerge(const QString &workingDirectory, const QString &branch,
|
||||
void fetch(const Utils::FilePath &workingDirectory, const QString &remote);
|
||||
void pull(const Utils::FilePath &workingDirectory, bool rebase);
|
||||
void push(const Utils::FilePath &workingDirectory, const QStringList &pushArgs = {});
|
||||
bool synchronousMerge(const Utils::FilePath &workingDirectory, const QString &branch,
|
||||
bool allowFastForward = true);
|
||||
bool canRebase(const QString &workingDirectory) const;
|
||||
void rebase(const QString &workingDirectory, const QString &argument);
|
||||
void cherryPick(const QString &workingDirectory, const QString &argument);
|
||||
void revert(const QString &workingDirectory, const QString &argument);
|
||||
bool canRebase(const Utils::FilePath &workingDirectory) const;
|
||||
void rebase(const Utils::FilePath &workingDirectory, const QString &argument);
|
||||
void cherryPick(const Utils::FilePath &workingDirectory, const QString &argument);
|
||||
void revert(const Utils::FilePath &workingDirectory, const QString &argument);
|
||||
|
||||
bool synchronousRevert(const QString &workingDirectory, const QString &commit);
|
||||
bool synchronousCherryPick(const QString &workingDirectory, const QString &commit);
|
||||
void interactiveRebase(const QString &workingDirectory, const QString &commit, bool fixup);
|
||||
void synchronousAbortCommand(const QString &workingDir, const QString &abortCommand);
|
||||
QString synchronousTrackingBranch(const QString &workingDirectory,
|
||||
const QString &branch = QString());
|
||||
bool synchronousSetTrackingBranch(const QString &workingDirectory,
|
||||
bool synchronousRevert(const Utils::FilePath &workingDirectory, const QString &commit);
|
||||
bool synchronousCherryPick(const Utils::FilePath &workingDirectory, const QString &commit);
|
||||
void interactiveRebase(const Utils::FilePath &workingDirectory, const QString &commit, bool fixup);
|
||||
void synchronousAbortCommand(const Utils::FilePath &workingDir, const QString &abortCommand);
|
||||
QString synchronousTrackingBranch(const Utils::FilePath &workingDirectory,
|
||||
const QString &branch = {});
|
||||
bool synchronousSetTrackingBranch(const Utils::FilePath &workingDirectory,
|
||||
const QString &branch,
|
||||
const QString &tracking);
|
||||
|
||||
// git svn support (asynchronous).
|
||||
void synchronousSubversionFetch(const QString &workingDirectory) const;
|
||||
void subversionLog(const QString &workingDirectory) const;
|
||||
void subversionDeltaCommit(const QString &workingDirectory) const;
|
||||
void synchronousSubversionFetch(const Utils::FilePath &workingDirectory) const;
|
||||
void subversionLog(const Utils::FilePath &workingDirectory) const;
|
||||
void subversionDeltaCommit(const Utils::FilePath &workingDirectory) const;
|
||||
|
||||
void stashPop(const QString &workingDirectory, const QString &stash = QString());
|
||||
void stashPop(const Utils::FilePath &workingDirectory, const QString &stash = {});
|
||||
void revert(const QStringList &files, bool revertStaging);
|
||||
bool synchronousStashList(const QString &workingDirectory, QList<Stash> *stashes,
|
||||
bool synchronousStashList(const Utils::FilePath &workingDirectory, QList<Stash> *stashes,
|
||||
QString *errorMessage = nullptr) const;
|
||||
// Resolve a stash name from message (for IVersionControl's names).
|
||||
bool stashNameFromMessage(const QString &workingDirectory, const QString &messge, QString *name,
|
||||
bool stashNameFromMessage(const Utils::FilePath &workingDirectory, const QString &messge, QString *name,
|
||||
QString *errorMessage = nullptr) const;
|
||||
|
||||
QString readGitVar(const QString &workingDirectory, const QString &configVar) const;
|
||||
QString readConfigValue(const QString &workingDirectory, const QString &configVar) const;
|
||||
void setConfigValue(const QString &workingDirectory, const QString &configVar,
|
||||
QString readGitVar(const Utils::FilePath &workingDirectory, const QString &configVar) const;
|
||||
QString readConfigValue(const Utils::FilePath &workingDirectory, const QString &configVar) const;
|
||||
void setConfigValue(const Utils::FilePath &workingDirectory, const QString &configVar,
|
||||
const QString &value) const;
|
||||
|
||||
QTextCodec *encoding(const QString &workingDirectory, const QString &configVar) const;
|
||||
bool readDataFromCommit(const QString &repoDirectory, const QString &commit,
|
||||
QTextCodec *encoding(const Utils::FilePath &workingDirectory, const QString &configVar) const;
|
||||
bool readDataFromCommit(const Utils::FilePath &repoDirectory, const QString &commit,
|
||||
CommitData &commitData, QString *errorMessage = nullptr,
|
||||
QString *commitTemplate = nullptr);
|
||||
bool getCommitData(const QString &workingDirectory, QString *commitTemplate,
|
||||
bool getCommitData(const Utils::FilePath &workingDirectory, QString *commitTemplate,
|
||||
CommitData &commitData, QString *errorMessage);
|
||||
|
||||
bool addAndCommit(const QString &workingDirectory,
|
||||
bool addAndCommit(const Utils::FilePath &workingDirectory,
|
||||
const GitSubmitEditorPanelData &data,
|
||||
CommitType commitType,
|
||||
const QString &amendSHA1,
|
||||
@@ -324,53 +324,54 @@ public:
|
||||
VcsBase::SubmitFileModel *model);
|
||||
|
||||
enum StatusResult { StatusChanged, StatusUnchanged, StatusFailed };
|
||||
StatusResult gitStatus(const QString &workingDirectory, StatusMode mode,
|
||||
StatusResult gitStatus(const Utils::FilePath &workingDirectory, StatusMode mode,
|
||||
QString *output = nullptr, QString *errorMessage = nullptr) const;
|
||||
|
||||
CommandInProgress checkCommandInProgress(const QString &workingDirectory) const;
|
||||
QString commandInProgressDescription(const QString &workingDirectory) const;
|
||||
CommandInProgress checkCommandInProgress(const Utils::FilePath &workingDirectory) const;
|
||||
QString commandInProgressDescription(const Utils::FilePath &workingDirectory) const;
|
||||
|
||||
void continueCommandIfNeeded(const QString &workingDirectory, bool allowContinue = true);
|
||||
void continueCommandIfNeeded(const Utils::FilePath &workingDirectory, bool allowContinue = true);
|
||||
|
||||
QString extendedShowDescription(const QString &workingDirectory, const QString &text) const;
|
||||
QString extendedShowDescription(const Utils::FilePath &workingDirectory, const QString &text) const;
|
||||
|
||||
void launchGitK(const QString &workingDirectory, const QString &fileName) const;
|
||||
void launchGitK(const QString &workingDirectory) const { launchGitK(workingDirectory, QString()); }
|
||||
bool launchGitGui(const QString &workingDirectory);
|
||||
void launchGitK(const Utils::FilePath &workingDirectory, const QString &fileName) const;
|
||||
void launchGitK(const Utils::FilePath &workingDirectory) const { launchGitK(workingDirectory, QString()); }
|
||||
bool launchGitGui(const Utils::FilePath &workingDirectory);
|
||||
Utils::FilePath gitBinDirectory() const;
|
||||
bool launchGitBash(const QString &workingDirectory);
|
||||
bool launchGitBash(const Utils::FilePath &workingDirectory);
|
||||
|
||||
void launchRepositoryBrowser(const QString &workingDirectory) const;
|
||||
void launchRepositoryBrowser(const Utils::FilePath &workingDirectory) const;
|
||||
|
||||
QStringList synchronousRepositoryBranches(const QString &repositoryURL,
|
||||
const QString &workingDirectory = QString()) const;
|
||||
const Utils::FilePath &workingDirectory = {}) const;
|
||||
|
||||
Utils::Environment processEnvironment() const override;
|
||||
|
||||
bool beginStashScope(const QString &workingDirectory, const QString &command,
|
||||
bool beginStashScope(const Utils::FilePath &workingDirectory, const QString &command,
|
||||
StashFlag flag = Default, PushAction pushAction = NoPush);
|
||||
StashInfo &stashInfo(const QString &workingDirectory);
|
||||
void endStashScope(const QString &workingDirectory);
|
||||
StashInfo &stashInfo(const Utils::FilePath &workingDirectory);
|
||||
void endStashScope(const Utils::FilePath &workingDirectory);
|
||||
bool isValidRevision(const QString &revision) const;
|
||||
void handleMergeConflicts(const QString &workingDir, const QString &commit, const QStringList &files, const QString &abortCommand);
|
||||
void handleMergeConflicts(const Utils::FilePath &workingDir, const QString &commit,
|
||||
const QStringList &files, const QString &abortCommand);
|
||||
void addFuture(const QFuture<void> &future);
|
||||
|
||||
static QString msgNoChangedFiles();
|
||||
static QString msgNoCommits(bool includeRemote);
|
||||
void show(const QString &source, const QString &id, const QString &name = QString());
|
||||
void archive(const QString &workingDirectory, QString commit);
|
||||
void show(const QString &source, const QString &id, const QString &name = {});
|
||||
void archive(const Utils::FilePath &workingDirectory, QString commit);
|
||||
|
||||
VcsBase::VcsCommand *asyncUpstreamStatus(const QString &workingDirectory,
|
||||
VcsBase::VcsCommand *asyncUpstreamStatus(const Utils::FilePath &workingDirectory,
|
||||
const QString &branch, const QString &upstream);
|
||||
|
||||
enum class BranchTargetType { Remote, Commit };
|
||||
static QString suggestedLocalBranchName(
|
||||
const QString &workingDirectory, const QStringList &existingLocalNames,
|
||||
const Utils::FilePath &workingDirectory, const QStringList &existingLocalNames,
|
||||
const QString &target, BranchTargetType targetType);
|
||||
static void addChangeActions(QMenu *menu, const QString &source, const QString &change);
|
||||
static QString fileWorkingDirectory(const QString &file);
|
||||
static Utils::FilePath fileWorkingDirectory(const QString &file);
|
||||
enum class ShowEditor { OnlyIfDifferent, Always };
|
||||
Core::IEditor *openShowEditor(const QString &workingDirectory, const QString &ref,
|
||||
Core::IEditor *openShowEditor(const Utils::FilePath &workingDirectory, const QString &ref,
|
||||
const QString &path, ShowEditor showSetting = ShowEditor::Always);
|
||||
|
||||
private:
|
||||
@@ -382,15 +383,16 @@ private:
|
||||
const QString &patch, bool revert);
|
||||
|
||||
enum CodecType { CodecSource, CodecLogOutput, CodecNone };
|
||||
QTextCodec *codecFor(CodecType codecType, const QString &source = QString()) const;
|
||||
QTextCodec *codecFor(CodecType codecType, const Utils::FilePath &source = {}) const;
|
||||
|
||||
void requestReload(const QString &documentId, const QString &source, const QString &title, const QString &workingDirectory,
|
||||
std::function<GitBaseDiffEditorController *(Core::IDocument *)> factory) const;
|
||||
void requestReload(const QString &documentId, const QString &source, const QString &title,
|
||||
const Utils::FilePath &workingDirectory,
|
||||
std::function<GitBaseDiffEditorController *(Core::IDocument *)> factory) const;
|
||||
|
||||
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
|
||||
unsigned synchronousGitVersion(QString *errorMessage = nullptr) const;
|
||||
|
||||
QString readOneLine(const QString &workingDirectory, const QStringList &arguments) const;
|
||||
QString readOneLine(const Utils::FilePath &workingDirectory, const QStringList &arguments) const;
|
||||
|
||||
enum RevertResult { RevertOk, RevertUnchanged, RevertCanceled, RevertFailed };
|
||||
RevertResult revertI(QStringList files,
|
||||
@@ -398,13 +400,14 @@ private:
|
||||
QString *errorMessage,
|
||||
bool revertStaging);
|
||||
void connectRepositoryChanged(const QString & repository, VcsBase::VcsCommand *cmd);
|
||||
bool executeAndHandleConflicts(const QString &workingDirectory, const QStringList &arguments,
|
||||
const QString &abortCommand = QString()) const;
|
||||
bool executeAndHandleConflicts(const Utils::FilePath &workingDirectory, const QStringList &arguments,
|
||||
const QString &abortCommand = {}) const;
|
||||
bool tryLauchingGitK(const Utils::Environment &env,
|
||||
const QString &workingDirectory,
|
||||
const Utils::FilePath &workingDirectory,
|
||||
const QString &fileName,
|
||||
const QString &gitBinDirectory) const;
|
||||
bool cleanList(const QString &workingDirectory, const QString &modulePath, const QString &flag, QStringList *files, QString *errorMessage);
|
||||
bool cleanList(const Utils::FilePath &workingDirectory, const QString &modulePath,
|
||||
const QString &flag, QStringList *files, QString *errorMessage);
|
||||
|
||||
enum ContinueCommandMode {
|
||||
ContinueOnly,
|
||||
@@ -412,7 +415,7 @@ private:
|
||||
SkipIfNoChanges
|
||||
};
|
||||
|
||||
void continuePreviousGitCommand(const QString &workingDirectory, const QString &msgBoxTitle,
|
||||
void continuePreviousGitCommand(const Utils::FilePath &workingDirectory, const QString &msgBoxTitle,
|
||||
QString msgBoxText, const QString &buttonName,
|
||||
const QString &gitCommand, ContinueCommandMode continueMode);
|
||||
|
||||
@@ -420,10 +423,10 @@ private:
|
||||
mutable unsigned m_cachedGitVersion = 0;
|
||||
|
||||
QString m_gitQtcEditor;
|
||||
QMap<QString, StashInfo> m_stashInfo;
|
||||
QMap<Utils::FilePath, StashInfo> m_stashInfo;
|
||||
QString m_pushFallbackCommand;
|
||||
QString m_diffCommit;
|
||||
QStringList m_updatedSubmodules;
|
||||
Utils::FilePaths m_updatedSubmodules;
|
||||
bool m_disableEditor = false;
|
||||
Utils::FutureSynchronizer m_synchronizer; // for commit updates
|
||||
};
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
#define CHANGE_PATTERN "[a-f0-9]{7,40}"
|
||||
|
||||
using namespace Utils;
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
@@ -235,7 +236,7 @@ void GitEditorWidget::applyDiffChunk(const DiffChunk& chunk, bool revert)
|
||||
if (!patchFile.open())
|
||||
return;
|
||||
|
||||
const QString baseDir = workingDirectory();
|
||||
const FilePath baseDir = workingDirectory();
|
||||
patchFile.write(chunk.header);
|
||||
patchFile.write(chunk.chunk);
|
||||
patchFile.close();
|
||||
@@ -290,8 +291,8 @@ void GitEditorWidget::aboutToOpen(const Utils::FilePath &filePath,
|
||||
Utils::Id editorId = textDocument()->id();
|
||||
if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID
|
||||
|| editorId == Git::Constants::GIT_REBASE_EDITOR_ID) {
|
||||
const QString gitPath = filePath.absolutePath().toString();
|
||||
setSource(gitPath);
|
||||
const FilePath gitPath = filePath.absolutePath();
|
||||
setSource(gitPath.toString());
|
||||
textDocument()->setCodec(
|
||||
GitClient::instance()->encoding(gitPath, "i18n.commitEncoding"));
|
||||
}
|
||||
@@ -361,7 +362,7 @@ QString GitEditorWidget::fileNameForLine(int line) const
|
||||
return source();
|
||||
}
|
||||
|
||||
QString GitEditorWidget::sourceWorkingDirectory() const
|
||||
FilePath GitEditorWidget::sourceWorkingDirectory() const
|
||||
{
|
||||
return GitClient::fileWorkingDirectory(source());
|
||||
}
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace Utils { class FancyLineEdit; }
|
||||
namespace Utils {
|
||||
class FancyLineEdit;
|
||||
class FilePath;
|
||||
} // Utils
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
@@ -69,7 +72,7 @@ private:
|
||||
QString revisionSubject(const QTextBlock &inBlock) const override;
|
||||
bool supportChangeLinks() const override;
|
||||
QString fileNameForLine(int line) const override;
|
||||
QString sourceWorkingDirectory() const;
|
||||
Utils::FilePath sourceWorkingDirectory() const;
|
||||
|
||||
const QRegularExpression m_changeNumberPattern;
|
||||
GitLogFilterWidget *m_logFilterWidget = nullptr;
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
GitGrepRunner(const TextEditor::FileFindParameters ¶meters)
|
||||
: m_parameters(parameters)
|
||||
{
|
||||
m_directory = parameters.additionalParameters.toString();
|
||||
m_directory = FilePath::fromString(parameters.additionalParameters.toString());
|
||||
m_command.reset(GitClient::instance()->createCommand(m_directory));
|
||||
m_vcsBinary = GitClient::instance()->vcsBinary();
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
QString filePath = line.left(lineSeparator);
|
||||
if (!m_ref.isEmpty() && filePath.startsWith(m_ref))
|
||||
filePath.remove(0, m_ref.length());
|
||||
single.fileName = m_directory + '/' + filePath;
|
||||
single.fileName = m_directory.pathAppended(filePath).toString();
|
||||
const int textSeparator = line.indexOf(QChar::Null, lineSeparator + 1);
|
||||
single.lineNumber = line.mid(lineSeparator + 1, textSeparator - lineSeparator - 1).toInt();
|
||||
QString text = line.mid(textSeparator + 1);
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
|
||||
private:
|
||||
FilePath m_vcsBinary;
|
||||
QString m_directory;
|
||||
FilePath m_directory;
|
||||
QString m_ref;
|
||||
TextEditor::FileFindParameters m_parameters;
|
||||
std::unique_ptr<VcsCommand> m_command;
|
||||
@@ -225,7 +225,7 @@ private:
|
||||
|
||||
} // namespace
|
||||
|
||||
static bool isGitDirectory(const QString &path)
|
||||
static bool isGitDirectory(const FilePath &path)
|
||||
{
|
||||
static IVersionControl *gitVc = VcsManager::versionControl(VcsBase::Constants::VCS_ID_GIT);
|
||||
QTC_ASSERT(gitVc, return false);
|
||||
@@ -253,7 +253,7 @@ GitGrep::GitGrep(GitClient *client)
|
||||
QTC_ASSERT(findInFiles, return);
|
||||
connect(findInFiles, &TextEditor::FindInFiles::pathChanged,
|
||||
m_widget, [this](const QString &path) {
|
||||
setEnabled(isGitDirectory(path));
|
||||
setEnabled(isGitDirectory(FilePath::fromString(path)));
|
||||
});
|
||||
connect(this, &SearchEngine::enabledChanged, m_widget, &QWidget::setEnabled);
|
||||
findInFiles->addSearchEngine(this);
|
||||
@@ -314,7 +314,7 @@ IEditor *GitGrep::openEditor(const SearchResultItem &item,
|
||||
if (params.ref.isEmpty() || item.path().isEmpty())
|
||||
return nullptr;
|
||||
const QString path = QDir::fromNativeSeparators(item.path().first());
|
||||
const QString topLevel = parameters.additionalParameters.toString();
|
||||
const FilePath topLevel = FilePath::fromString(parameters.additionalParameters.toString());
|
||||
IEditor *editor = m_client->openShowEditor(
|
||||
topLevel, params.ref, path, GitClient::ShowEditor::OnlyIfDifferent);
|
||||
if (editor)
|
||||
|
||||
@@ -104,7 +104,7 @@ using namespace std::placeholders;
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
using GitClientMemberFunc = void (GitClient::*)(const QString &) const;
|
||||
using GitClientMemberFunc = void (GitClient::*)(const FilePath &) const;
|
||||
|
||||
class GitTopicCache : public Core::IVersionControl::TopicCache
|
||||
{
|
||||
@@ -116,13 +116,13 @@ public:
|
||||
protected:
|
||||
FilePath trackFile(const FilePath &repository) override
|
||||
{
|
||||
const QString gitDir = m_client->findGitDirForRepository(repository.toString());
|
||||
const QString gitDir = m_client->findGitDirForRepository(repository);
|
||||
return gitDir.isEmpty() ? FilePath() : FilePath::fromString(gitDir + "/HEAD");
|
||||
}
|
||||
|
||||
QString refreshTopic(const FilePath &repository) override
|
||||
{
|
||||
return m_client->synchronousTopic(repository.toString());
|
||||
return m_client->synchronousTopic(repository);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -244,13 +244,13 @@ public:
|
||||
|
||||
bool isConfigured() const final;
|
||||
bool supportsOperation(Operation operation) const final;
|
||||
bool vcsOpen(const FilePath &fileName) final;
|
||||
bool vcsAdd(const FilePath &fileName) final;
|
||||
bool vcsDelete(const FilePath &filename) final;
|
||||
bool vcsOpen(const FilePath &filePath) final;
|
||||
bool vcsAdd(const FilePath &filePath) final;
|
||||
bool vcsDelete(const FilePath &filePath) final;
|
||||
bool vcsMove(const FilePath &from, const FilePath &to) final;
|
||||
bool vcsCreateRepository(const FilePath &directory) final;
|
||||
|
||||
void vcsAnnotate(const FilePath &file, int line) final;
|
||||
void vcsAnnotate(const FilePath &filePath, int line) final;
|
||||
void vcsDescribe(const FilePath &source, const QString &id) final { m_gitClient.show(source.toString(), id); };
|
||||
QString vcsTopic(const FilePath &directory) final;
|
||||
|
||||
@@ -274,7 +274,7 @@ public:
|
||||
bool handleLink(const FilePath &workingDirectory, const QString &reference) final
|
||||
{
|
||||
if (reference.contains(".."))
|
||||
GitClient::instance()->log(workingDirectory.toString(), {}, false, {reference});
|
||||
GitClient::instance()->log(workingDirectory, {}, false, {reference});
|
||||
else
|
||||
GitClient::instance()->show(workingDirectory.toString(), reference);
|
||||
return true;
|
||||
@@ -286,12 +286,12 @@ public:
|
||||
|
||||
bool isCommitEditorOpen() const;
|
||||
void startCommit(CommitType commitType = SimpleCommit);
|
||||
void updateBranches(const QString &repository);
|
||||
void updateBranches(const FilePath &repository);
|
||||
void updateCurrentBranch();
|
||||
|
||||
void manageRemotes();
|
||||
void initRepository();
|
||||
void startRebaseFromCommit(const QString &workingDirectory, QString commit);
|
||||
void startRebaseFromCommit(const FilePath &workingDirectory, QString commit);
|
||||
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
bool submitEditorAboutToClose() override;
|
||||
@@ -371,8 +371,8 @@ public:
|
||||
void updateRepositoryBrowserAction();
|
||||
Core::IEditor *openSubmitEditor(const QString &fileName, const CommitData &cd);
|
||||
void cleanCommitMessageFile();
|
||||
void cleanRepository(const QString &directory);
|
||||
void applyPatch(const QString &workingDirectory, QString file = QString());
|
||||
void cleanRepository(const FilePath &directory);
|
||||
void applyPatch(const FilePath &workingDirectory, QString file = QString());
|
||||
void updateVersionWarning();
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ public:
|
||||
QPointer<StashDialog> m_stashDialog;
|
||||
BranchViewFactory m_branchViewFactory;
|
||||
QPointer<RemoteDialog> m_remoteDialog;
|
||||
QString m_submitRepository;
|
||||
FilePath m_submitRepository;
|
||||
QString m_commitMessageFileName;
|
||||
bool m_submitActionTriggered = false;
|
||||
|
||||
@@ -514,11 +514,11 @@ const VcsBasePluginState &GitPlugin::currentState()
|
||||
return dd->currentState();
|
||||
}
|
||||
|
||||
QString GitPlugin::msgRepositoryLabel(const QString &repository)
|
||||
QString GitPlugin::msgRepositoryLabel(const FilePath &repository)
|
||||
{
|
||||
return repository.isEmpty() ?
|
||||
tr("<No repository>") :
|
||||
tr("Repository: %1").arg(QDir::toNativeSeparators(repository));
|
||||
tr("Repository: %1").arg(repository.toUserOutput());
|
||||
}
|
||||
|
||||
// Returns a regular expression pattern with characters not allowed
|
||||
@@ -1157,11 +1157,11 @@ void GitPluginPrivate::resetRepository()
|
||||
return;
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
QString topLevel = state.topLevel();
|
||||
FilePath topLevel = state.topLevel();
|
||||
|
||||
LogChangeDialog dialog(true, ICore::dialogParent());
|
||||
ResetItemDelegate delegate(dialog.widget());
|
||||
dialog.setWindowTitle(tr("Undo Changes to %1").arg(QDir::toNativeSeparators(topLevel)));
|
||||
dialog.setWindowTitle(tr("Undo Changes to %1").arg(topLevel.toUserOutput()));
|
||||
if (dialog.runDialog(topLevel, QString(), LogChangeWidget::IncludeRemotes))
|
||||
m_gitClient.reset(topLevel, dialog.resetFlag(), dialog.commit());
|
||||
}
|
||||
@@ -1179,12 +1179,12 @@ void GitPluginPrivate::startRebase()
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
const QString topLevel = state.topLevel();
|
||||
const FilePath topLevel = state.topLevel();
|
||||
|
||||
startRebaseFromCommit(topLevel, QString());
|
||||
}
|
||||
|
||||
void GitPluginPrivate::startRebaseFromCommit(const QString &workingDirectory, QString commit)
|
||||
void GitPluginPrivate::startRebaseFromCommit(const FilePath &workingDirectory, QString commit)
|
||||
{
|
||||
if (!DocumentManager::saveAllModifiedDocuments())
|
||||
return;
|
||||
@@ -1208,7 +1208,8 @@ void GitPluginPrivate::startChangeRelatedAction(const Id &id)
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
|
||||
ChangeSelectionDialog dialog(state.hasTopLevel() ? state.topLevel() : PathChooser::homePath(),
|
||||
ChangeSelectionDialog dialog(state.hasTopLevel()
|
||||
? state.topLevel() : FilePath::fromString(PathChooser::homePath()),
|
||||
id, ICore::dialogParent());
|
||||
|
||||
int result = dialog.exec();
|
||||
@@ -1216,7 +1217,7 @@ void GitPluginPrivate::startChangeRelatedAction(const Id &id)
|
||||
if (result == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
const QString workingDirectory = dialog.workingDirectory();
|
||||
const FilePath workingDirectory = dialog.workingDirectory();
|
||||
const QString change = dialog.change();
|
||||
|
||||
if (workingDirectory.isEmpty() || change.isEmpty())
|
||||
@@ -1225,10 +1226,10 @@ void GitPluginPrivate::startChangeRelatedAction(const Id &id)
|
||||
if (dialog.command() == Show) {
|
||||
const int colon = change.indexOf(':');
|
||||
if (colon > 0) {
|
||||
const QString path = QDir(workingDirectory).absoluteFilePath(change.mid(colon + 1));
|
||||
const QString path = QDir(workingDirectory.toString()).absoluteFilePath(change.mid(colon + 1));
|
||||
m_gitClient.openShowEditor(workingDirectory, change.left(colon), path);
|
||||
} else {
|
||||
m_gitClient.show(workingDirectory, change);
|
||||
m_gitClient.show(workingDirectory.toString(), change);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1296,14 +1297,14 @@ void GitPluginPrivate::gitkForCurrentFolder()
|
||||
* one line command mentioned above.
|
||||
*
|
||||
*/
|
||||
QDir dir(state.currentFileDirectory());
|
||||
QDir dir(state.currentFileDirectory().toString());
|
||||
if (QFileInfo(dir,".git").exists() || dir.cd(".git")) {
|
||||
m_gitClient.launchGitK(state.currentFileDirectory());
|
||||
} else {
|
||||
QString folderName = dir.absolutePath();
|
||||
dir.cdUp();
|
||||
folderName = folderName.remove(0, dir.absolutePath().length() + 1);
|
||||
m_gitClient.launchGitK(dir.absolutePath(), folderName);
|
||||
m_gitClient.launchGitK(FilePath::fromString(dir.absolutePath()), folderName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1399,7 +1400,7 @@ IEditor *GitPluginPrivate::openSubmitEditor(const QString &fileName, const Commi
|
||||
}
|
||||
IDocument *document = submitEditor->document();
|
||||
document->setPreferredDisplayName(title);
|
||||
VcsBase::setSource(document, m_submitRepository);
|
||||
VcsBase::setSource(document, m_submitRepository.toString());
|
||||
return editor;
|
||||
}
|
||||
|
||||
@@ -1488,7 +1489,7 @@ void GitPluginPrivate::pull()
|
||||
return;
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
QString topLevel = state.topLevel();
|
||||
FilePath topLevel = state.topLevel();
|
||||
bool rebase = m_settings.pullRebase.value();
|
||||
|
||||
if (!rebase) {
|
||||
@@ -1561,7 +1562,7 @@ void GitPluginPrivate::cleanRepository()
|
||||
cleanRepository(state.topLevel());
|
||||
}
|
||||
|
||||
void GitPluginPrivate::cleanRepository(const QString &directory)
|
||||
void GitPluginPrivate::cleanRepository(const FilePath &directory)
|
||||
{
|
||||
// Find files to be deleted
|
||||
QString errorMessage;
|
||||
@@ -1583,7 +1584,7 @@ void GitPluginPrivate::cleanRepository(const QString &directory)
|
||||
|
||||
// Show in dialog
|
||||
CleanDialog dialog(ICore::dialogParent());
|
||||
dialog.setFileList(directory, files, ignoredFiles);
|
||||
dialog.setFileList(directory.toString(), files, ignoredFiles);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
@@ -1618,7 +1619,7 @@ void GitPluginPrivate::promptApplyPatch()
|
||||
applyPatch(state.topLevel(), QString());
|
||||
}
|
||||
|
||||
void GitPluginPrivate::applyPatch(const QString &workingDirectory, QString file)
|
||||
void GitPluginPrivate::applyPatch(const FilePath &workingDirectory, QString file)
|
||||
{
|
||||
// Ensure user has been notified about pending changes
|
||||
if (!m_gitClient.beginStashScope(workingDirectory, "Apply-Patch", AllowUnstashed))
|
||||
@@ -1636,7 +1637,8 @@ void GitPluginPrivate::applyPatch(const QString &workingDirectory, QString file)
|
||||
QString errorMessage;
|
||||
if (m_gitClient.synchronousApplyPatch(workingDirectory, file, &errorMessage)) {
|
||||
if (errorMessage.isEmpty())
|
||||
VcsOutputWindow::appendMessage(tr("Patch %1 successfully applied to %2").arg(file, workingDirectory));
|
||||
VcsOutputWindow::appendMessage(tr("Patch %1 successfully applied to %2")
|
||||
.arg(file, workingDirectory.toUserOutput()));
|
||||
else
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
} else {
|
||||
@@ -1653,7 +1655,7 @@ void GitPluginPrivate::stash(bool unstagedOnly)
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
|
||||
const QString topLevel = state.topLevel();
|
||||
const FilePath topLevel = state.topLevel();
|
||||
m_gitClient.executeSynchronousStash(topLevel, QString(), unstagedOnly);
|
||||
if (m_stashDialog)
|
||||
m_stashDialog->refresh(topLevel, true);
|
||||
@@ -1679,7 +1681,7 @@ void GitPluginPrivate::stashPop()
|
||||
{
|
||||
if (!DocumentManager::saveAllModifiedDocuments())
|
||||
return;
|
||||
const QString repository = currentState().topLevel();
|
||||
const FilePath repository = currentState().topLevel();
|
||||
m_gitClient.stashPop(repository);
|
||||
if (m_stashDialog)
|
||||
m_stashDialog->refresh(repository, true);
|
||||
@@ -1687,7 +1689,7 @@ void GitPluginPrivate::stashPop()
|
||||
|
||||
// Create a non-modal dialog with refresh function or raise if it exists
|
||||
template <class NonModalDialog>
|
||||
inline void showNonModalDialog(const QString &topLevel,
|
||||
inline void showNonModalDialog(const FilePath &topLevel,
|
||||
QPointer<NonModalDialog> &dialog)
|
||||
{
|
||||
if (dialog) {
|
||||
@@ -1798,7 +1800,7 @@ void GitPluginPrivate::delayedPushToGerrit()
|
||||
m_gerritPlugin->push(m_submitRepository);
|
||||
}
|
||||
|
||||
void GitPluginPrivate::updateBranches(const QString &repository)
|
||||
void GitPluginPrivate::updateBranches(const FilePath &repository)
|
||||
{
|
||||
if (m_branchViewFactory.view())
|
||||
m_branchViewFactory.view()->refreshIfSame(repository);
|
||||
@@ -1880,21 +1882,19 @@ bool GitPluginPrivate::vcsOpen(const FilePath & /*filePath*/)
|
||||
|
||||
bool GitPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_gitClient.synchronousAdd(fi.absolutePath(), {fi.fileName()}, {"--intent-to-add"});
|
||||
return m_gitClient.synchronousAdd(filePath.parentDir(), {filePath.fileName()}, {"--intent-to-add"});
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_gitClient.synchronousDelete(fi.absolutePath(), true, {fi.fileName()});
|
||||
return m_gitClient.synchronousDelete(filePath.parentDir().absolutePath(), true, {filePath.fileName()});
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return m_gitClient.synchronousMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||
return m_gitClient.synchronousMove(from.parentDir().absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool GitPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
||||
@@ -1905,7 +1905,7 @@ bool GitPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
||||
QString GitPluginPrivate::vcsTopic(const FilePath &directory)
|
||||
{
|
||||
QString topic = Core::IVersionControl::vcsTopic(directory);
|
||||
const QString commandInProgress = m_gitClient.commandInProgressDescription(directory.toString());
|
||||
const QString commandInProgress = m_gitClient.commandInProgressDescription(directory);
|
||||
if (!commandInProgress.isEmpty())
|
||||
topic += " (" + commandInProgress + ')';
|
||||
return topic;
|
||||
@@ -1919,7 +1919,7 @@ Core::ShellCommand *GitPluginPrivate::createInitialCheckoutCommand(const QString
|
||||
QStringList args = {"clone", "--progress"};
|
||||
args << extraArgs << url << localName;
|
||||
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory.toString(), m_gitClient.processEnvironment());
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory, m_gitClient.processEnvironment());
|
||||
command->addFlags(VcsBase::VcsCommand::SuppressStdErr);
|
||||
command->addJob({m_gitClient.vcsBinary(), args}, -1);
|
||||
return command;
|
||||
@@ -1949,7 +1949,7 @@ bool GitPluginPrivate::managesDirectory(const FilePath &directory, FilePath *top
|
||||
|
||||
bool GitPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
return m_gitClient.managesFile(workingDirectory.toString(), fileName);
|
||||
return m_gitClient.managesFile(workingDirectory, fileName);
|
||||
}
|
||||
|
||||
FilePaths GitPluginPrivate::unmanagedFiles(const FilePaths &filePaths) const
|
||||
@@ -1959,8 +1959,7 @@ FilePaths GitPluginPrivate::unmanagedFiles(const FilePaths &filePaths) const
|
||||
|
||||
void GitPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
m_gitClient.annotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
m_gitClient.annotate(filePath.absolutePath(), filePath.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
void GitPlugin::emitFilesChanged(const QStringList &l)
|
||||
@@ -1970,10 +1969,10 @@ void GitPlugin::emitFilesChanged(const QStringList &l)
|
||||
|
||||
void GitPlugin::emitRepositoryChanged(const QString &r)
|
||||
{
|
||||
emit dd->repositoryChanged(r);
|
||||
emit dd->repositoryChanged(FilePath::fromString(r));
|
||||
}
|
||||
|
||||
void GitPlugin::startRebaseFromCommit(const QString &workingDirectory, const QString &commit)
|
||||
void GitPlugin::startRebaseFromCommit(const FilePath &workingDirectory, const QString &commit)
|
||||
{
|
||||
dd->startRebaseFromCommit(workingDirectory, commit);
|
||||
}
|
||||
@@ -1998,12 +1997,12 @@ void GitPlugin::updateCurrentBranch()
|
||||
dd->updateCurrentBranch();
|
||||
}
|
||||
|
||||
void GitPlugin::updateBranches(const QString &repository)
|
||||
void GitPlugin::updateBranches(const FilePath &repository)
|
||||
{
|
||||
dd->updateBranches(repository);
|
||||
}
|
||||
|
||||
void GitPlugin::gerritPush(const QString &topLevel)
|
||||
void GitPlugin::gerritPush(const FilePath &topLevel)
|
||||
{
|
||||
dd->m_gerritPlugin->push(topLevel);
|
||||
}
|
||||
|
||||
@@ -61,19 +61,19 @@ public:
|
||||
static const GitSettings &settings();
|
||||
static const VcsBase::VcsBasePluginState ¤tState();
|
||||
|
||||
static QString msgRepositoryLabel(const QString &repository);
|
||||
static QString msgRepositoryLabel(const Utils::FilePath &repository);
|
||||
static QString invalidBranchAndRemoteNamePattern();
|
||||
static bool isCommitEditorOpen();
|
||||
|
||||
static void emitFilesChanged(const QStringList &);
|
||||
static void emitRepositoryChanged(const QString &);
|
||||
static void startRebaseFromCommit(const QString &workingDirectory, const QString &commit);
|
||||
static void startRebaseFromCommit(const Utils::FilePath &workingDirectory, const QString &commit);
|
||||
static void manageRemotes();
|
||||
static void initRepository();
|
||||
static void startCommit();
|
||||
static void updateCurrentBranch();
|
||||
static void updateBranches(const QString &repository);
|
||||
static void gerritPush(const QString &topLevel);
|
||||
static void updateBranches(const Utils::FilePath &repository);
|
||||
static void gerritPush(const Utils::FilePath &topLevel);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
static const char TASK_UPDATE_COMMIT[] = "Git.UpdateCommit";
|
||||
|
||||
using namespace Utils;
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
@@ -83,7 +84,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
CommitDataFetchResult CommitDataFetchResult::fetch(CommitType commitType, const QString &workingDirectory)
|
||||
CommitDataFetchResult CommitDataFetchResult::fetch(CommitType commitType, const FilePath &workingDirectory)
|
||||
{
|
||||
CommitDataFetchResult result;
|
||||
result.commitData.commitType = commitType;
|
||||
@@ -135,7 +136,7 @@ void GitSubmitEditor::setCommitData(const CommitData &d)
|
||||
setEmptyFileListEnabled(m_commitType == AmendCommit); // Allow for just correcting the message
|
||||
|
||||
m_model = new GitSubmitFileModel(this);
|
||||
m_model->setRepositoryRoot(d.panelInfo.repository);
|
||||
m_model->setRepositoryRoot(d.panelInfo.repository.toString());
|
||||
m_model->setFileStatusQualifier([](const QString &, const QVariant &extraData)
|
||||
-> SubmitFileModel::FileStatusHint
|
||||
{
|
||||
@@ -196,7 +197,7 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
|
||||
}
|
||||
stagedFiles.push_back(fileName);
|
||||
} else if (state == UntrackedFile) {
|
||||
Core::EditorManager::openEditor(m_workingDirectory + '/' + fileName);
|
||||
Core::EditorManager::openEditor(m_workingDirectory.pathAppended(fileName));
|
||||
} else {
|
||||
unstagedFiles.push_back(fileName);
|
||||
}
|
||||
@@ -210,7 +211,7 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
|
||||
void GitSubmitEditor::showCommit(const QString &commit)
|
||||
{
|
||||
if (!m_workingDirectory.isEmpty())
|
||||
GitClient::instance()->show(m_workingDirectory, commit);
|
||||
GitClient::instance()->show(m_workingDirectory.toString(), commit);
|
||||
}
|
||||
|
||||
void GitSubmitEditor::updateFileModel()
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "commitdata.h"
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <vcsbase/vcsbasesubmiteditor.h>
|
||||
|
||||
#include <QFutureWatcher>
|
||||
@@ -43,7 +45,7 @@ class GitSubmitEditorPanelData;
|
||||
class CommitDataFetchResult
|
||||
{
|
||||
public:
|
||||
static CommitDataFetchResult fetch(CommitType commitType, const QString &workingDirectory);
|
||||
static CommitDataFetchResult fetch(CommitType commitType, const Utils::FilePath &workingDirectory);
|
||||
|
||||
QString errorMessage;
|
||||
CommitData commitData;
|
||||
@@ -80,7 +82,7 @@ private:
|
||||
QTextCodec *m_commitEncoding = nullptr;
|
||||
CommitType m_commitType = SimpleCommit;
|
||||
QString m_amendSHA1;
|
||||
QString m_workingDirectory;
|
||||
Utils::FilePath m_workingDirectory;
|
||||
bool m_firstUpdate = true;
|
||||
QFutureWatcher<CommitDataFetchResult> m_fetchWatcher;
|
||||
};
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
#include "logchangedialog.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <utils/completingtextedit.h>
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/theme/theme.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -41,6 +43,8 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QMenu>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -65,7 +69,7 @@ GitSubmitEditorWidget::GitSubmitEditorWidget() :
|
||||
|
||||
void GitSubmitEditorWidget::setPanelInfo(const GitSubmitEditorPanelInfo &info)
|
||||
{
|
||||
m_gitSubmitPanelUi.repositoryLabel->setText(QDir::toNativeSeparators(info.repository));
|
||||
m_gitSubmitPanelUi.repositoryLabel->setText(info.repository.toUserOutput());
|
||||
if (info.branch.contains("(no branch)")) {
|
||||
const QString errorColor =
|
||||
Utils::creatorTheme()->color(Utils::Theme::TextColorError).name();
|
||||
@@ -87,7 +91,7 @@ void GitSubmitEditorWidget::setHasUnmerged(bool e)
|
||||
}
|
||||
|
||||
void GitSubmitEditorWidget::initialize(CommitType commitType,
|
||||
const QString &repository,
|
||||
const FilePath &repository,
|
||||
const GitSubmitEditorPanelData &data,
|
||||
const GitSubmitEditorPanelInfo &info,
|
||||
bool enablePush)
|
||||
@@ -123,7 +127,7 @@ void GitSubmitEditorWidget::initialize(CommitType commitType,
|
||||
}
|
||||
}
|
||||
|
||||
void GitSubmitEditorWidget::refreshLog(const QString &repository)
|
||||
void GitSubmitEditorWidget::refreshLog(const FilePath &repository)
|
||||
{
|
||||
if (m_logChangeWidget)
|
||||
m_logChangeWidget->init(repository);
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <texteditor/syntaxhighlighter.h>
|
||||
#include <vcsbase/submiteditorwidget.h>
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QSyntaxHighlighter>
|
||||
|
||||
@@ -64,11 +65,11 @@ public:
|
||||
QString amendSHA1() const;
|
||||
void setHasUnmerged(bool e);
|
||||
void initialize(CommitType commitType,
|
||||
const QString &repository,
|
||||
const Utils::FilePath &repository,
|
||||
const GitSubmitEditorPanelData &data,
|
||||
const GitSubmitEditorPanelInfo &info,
|
||||
bool enablePush);
|
||||
void refreshLog(const QString &repository);
|
||||
void refreshLog(const Utils::FilePath &repository);
|
||||
|
||||
protected:
|
||||
bool canSubmit(QString *whyNot) const override;
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <QTreeView>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
using namespace Utils;
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
@@ -75,9 +76,9 @@ public:
|
||||
return QStandardItemModel::data(index, role);
|
||||
}
|
||||
|
||||
void setWorkingDirectory(const QString &workingDir) { m_workingDirectory = workingDir; }
|
||||
void setWorkingDirectory(const FilePath &workingDir) { m_workingDirectory = workingDir; }
|
||||
private:
|
||||
QString m_workingDirectory;
|
||||
FilePath m_workingDirectory;
|
||||
mutable QHash<QString, QString> m_descriptions;
|
||||
};
|
||||
|
||||
@@ -99,7 +100,7 @@ LogChangeWidget::LogChangeWidget(QWidget *parent)
|
||||
setFocus();
|
||||
}
|
||||
|
||||
bool LogChangeWidget::init(const QString &repository, const QString &commit, LogFlags flags)
|
||||
bool LogChangeWidget::init(const FilePath &repository, const QString &commit, LogFlags flags)
|
||||
{
|
||||
m_model->setWorkingDirectory(repository);
|
||||
if (!populateLog(repository, commit, flags))
|
||||
@@ -171,7 +172,7 @@ void LogChangeWidget::selectionChanged(const QItemSelection &selected,
|
||||
}
|
||||
}
|
||||
|
||||
bool LogChangeWidget::populateLog(const QString &repository, const QString &commit, LogFlags flags)
|
||||
bool LogChangeWidget::populateLog(const FilePath &repository, const QString &commit, LogFlags flags)
|
||||
{
|
||||
const QString currentCommit = this->commit();
|
||||
int selected = currentCommit.isEmpty() ? 0 : -1;
|
||||
@@ -232,6 +233,7 @@ const QStandardItem *LogChangeWidget::currentItem(int column) const
|
||||
LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
|
||||
QDialog(parent)
|
||||
, m_widget(new LogChangeWidget)
|
||||
|
||||
, m_dialogButtonBox(new QDialogButtonBox(this))
|
||||
{
|
||||
auto layout = new QVBoxLayout(this);
|
||||
@@ -262,7 +264,7 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
|
||||
resize(600, 400);
|
||||
}
|
||||
|
||||
bool LogChangeDialog::runDialog(const QString &repository,
|
||||
bool LogChangeDialog::runDialog(const FilePath &repository,
|
||||
const QString &commit,
|
||||
LogChangeWidget::LogFlags flags)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/icon.h>
|
||||
#include <utils/itemviews.h>
|
||||
|
||||
@@ -62,7 +63,7 @@ public:
|
||||
Q_DECLARE_FLAGS(LogFlags, LogFlag)
|
||||
|
||||
explicit LogChangeWidget(QWidget *parent = nullptr);
|
||||
bool init(const QString &repository, const QString &commit = QString(), LogFlags flags = None);
|
||||
bool init(const Utils::FilePath &repository, const QString &commit = {}, LogFlags flags = None);
|
||||
QString commit() const;
|
||||
int commitIndex() const;
|
||||
QString earliestCommit() const;
|
||||
@@ -76,7 +77,7 @@ private:
|
||||
void emitCommitActivated(const QModelIndex &index);
|
||||
|
||||
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
|
||||
bool populateLog(const QString &repository, const QString &commit, LogFlags flags);
|
||||
bool populateLog(const Utils::FilePath &repository, const QString &commit, LogFlags flags);
|
||||
const QStandardItem *currentItem(int column = 0) const;
|
||||
|
||||
LogChangeModel *m_model;
|
||||
@@ -91,7 +92,7 @@ class LogChangeDialog : public QDialog
|
||||
public:
|
||||
LogChangeDialog(bool isReset, QWidget *parent);
|
||||
|
||||
bool runDialog(const QString &repository, const QString &commit = QString(),
|
||||
bool runDialog(const Utils::FilePath &repository, const QString &commit = QString(),
|
||||
LogChangeWidget::LogFlags flags = LogChangeWidget::None);
|
||||
|
||||
QString commit() const;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <QProcess>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace Utils;
|
||||
using namespace VcsBase;
|
||||
|
||||
namespace Git {
|
||||
@@ -263,7 +264,7 @@ void MergeTool::done()
|
||||
VcsOutputWindow::appendError(tr("Merge tool process terminated with exit code %1")
|
||||
.arg(exitCode));
|
||||
}
|
||||
GitClient::instance()->continueCommandIfNeeded(workingDirectory, exitCode == 0);
|
||||
GitClient::instance()->continueCommandIfNeeded(FilePath::fromString(workingDirectory), exitCode == 0);
|
||||
GitPlugin::emitRepositoryChanged(workingDirectory);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QRegularExpression>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -152,7 +154,7 @@ RemoteDialog::~RemoteDialog()
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void RemoteDialog::refresh(const QString &repository, bool force)
|
||||
void RemoteDialog::refresh(const FilePath &repository, bool force)
|
||||
{
|
||||
if (m_remoteModel->workingDirectory() == repository && !force)
|
||||
return;
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Utils { class FilePath; }
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -42,7 +44,7 @@ public:
|
||||
explicit RemoteDialog(QWidget *parent = nullptr);
|
||||
~RemoteDialog() override;
|
||||
|
||||
void refresh(const QString &repository, bool force);
|
||||
void refresh(const Utils::FilePath &repository, bool force);
|
||||
|
||||
private:
|
||||
void refreshRemotes();
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
@@ -97,7 +99,7 @@ bool RemoteModel::updateUrl(const QString &name, const QString &newUrl)
|
||||
return success;
|
||||
}
|
||||
|
||||
QString RemoteModel::workingDirectory() const
|
||||
FilePath RemoteModel::workingDirectory() const
|
||||
{
|
||||
return m_workingDirectory;
|
||||
}
|
||||
@@ -179,7 +181,7 @@ void RemoteModel::clear()
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
bool RemoteModel::refresh(const QString &workingDirectory, QString *errorMessage)
|
||||
bool RemoteModel::refresh(const FilePath &workingDirectory, QString *errorMessage)
|
||||
{
|
||||
m_workingDirectory = workingDirectory;
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
@@ -38,7 +40,7 @@ public:
|
||||
explicit RemoteModel(QObject *parent = nullptr);
|
||||
|
||||
void clear();
|
||||
bool refresh(const QString &workingDirectory, QString *errorMessage);
|
||||
bool refresh(const Utils::FilePath &workingDirectory, QString *errorMessage);
|
||||
|
||||
QStringList allRemoteNames() const;
|
||||
QString remoteName(int row) const;
|
||||
@@ -60,7 +62,7 @@ public:
|
||||
|
||||
int remoteCount() const;
|
||||
|
||||
QString workingDirectory() const;
|
||||
Utils::FilePath workingDirectory() const;
|
||||
int findRemoteByName(const QString &name) const;
|
||||
|
||||
protected:
|
||||
@@ -74,7 +76,7 @@ protected:
|
||||
private:
|
||||
const Qt::ItemFlags m_flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
|
||||
|
||||
QString m_workingDirectory;
|
||||
Utils::FilePath m_workingDirectory;
|
||||
RemoteList m_remotes;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
enum { NameColumn, BranchColumn, MessageColumn, ColumnCount };
|
||||
|
||||
namespace Git {
|
||||
@@ -150,7 +152,7 @@ StashDialog::~StashDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void StashDialog::refresh(const QString &repository, bool force)
|
||||
void StashDialog::refresh(const FilePath &repository, bool force)
|
||||
{
|
||||
if (m_repository == repository && !force)
|
||||
return;
|
||||
@@ -205,7 +207,7 @@ void StashDialog::showCurrent()
|
||||
{
|
||||
const int index = currentRow();
|
||||
QTC_ASSERT(index >= 0, return);
|
||||
GitClient::instance()->show(m_repository, QString(m_model->at(index).name));
|
||||
GitClient::instance()->show(m_repository.toString(), QString(m_model->at(index).name));
|
||||
}
|
||||
|
||||
// Suggest Branch name to restore 'stash@{0}' -> 'stash0-date'
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/filepath.h>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -51,7 +53,7 @@ public:
|
||||
explicit StashDialog(QWidget *parent = nullptr);
|
||||
~StashDialog() override;
|
||||
|
||||
void refresh(const QString &repository, bool force);
|
||||
void refresh(const Utils::FilePath &repository, bool force);
|
||||
|
||||
private:
|
||||
// Prompt dialog for modified repositories. Ask to undo or stash away.
|
||||
@@ -85,7 +87,7 @@ private:
|
||||
QPushButton *m_restoreCurrentButton;
|
||||
QPushButton *m_restoreCurrentInBranchButton;
|
||||
QPushButton *m_refreshButton;
|
||||
QString m_repository;
|
||||
Utils::FilePath m_repository;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -91,7 +91,7 @@ MercurialClient::MercurialClient(MercurialSettings *settings) : VcsBaseClient(se
|
||||
{
|
||||
}
|
||||
|
||||
bool MercurialClient::manifestSync(const QString &repository, const QString &relativeFilename)
|
||||
bool MercurialClient::manifestSync(const FilePath &repository, const QString &relativeFilename)
|
||||
{
|
||||
// This only works when called from the repo and outputs paths relative to it.
|
||||
const QStringList args(QLatin1String("manifest"));
|
||||
@@ -99,7 +99,7 @@ bool MercurialClient::manifestSync(const QString &repository, const QString &rel
|
||||
QtcProcess proc;
|
||||
vcsFullySynchronousExec(proc, repository, args);
|
||||
|
||||
const QDir repositoryDir(repository);
|
||||
const QDir repositoryDir(repository.toString());
|
||||
const QFileInfo needle = QFileInfo(repositoryDir, relativeFilename);
|
||||
|
||||
const QStringList files = proc.stdOut().split(QLatin1Char('\n'));
|
||||
@@ -112,14 +112,12 @@ bool MercurialClient::manifestSync(const QString &repository, const QString &rel
|
||||
}
|
||||
|
||||
//bool MercurialClient::clone(const QString &directory, const QString &url)
|
||||
bool MercurialClient::synchronousClone(const FilePath &workingDir,
|
||||
bool MercurialClient::synchronousClone(const FilePath &workingDirectory,
|
||||
const QString &srcLocation,
|
||||
const QString &dstLocation,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
Q_UNUSED(workingDir)
|
||||
Q_UNUSED(extraOptions)
|
||||
QDir workingDirectory(srcLocation);
|
||||
const unsigned flags = VcsCommand::SshPasswordPrompt |
|
||||
VcsCommand::ShowStdOut |
|
||||
VcsCommand::ShowSuccessMessage;
|
||||
@@ -128,7 +126,7 @@ bool MercurialClient::synchronousClone(const FilePath &workingDir,
|
||||
// Let's make first init
|
||||
QStringList arguments(QLatin1String("init"));
|
||||
QtcProcess proc;
|
||||
vcsFullySynchronousExec(proc, workingDirectory.path(), arguments);
|
||||
vcsFullySynchronousExec(proc, workingDirectory, arguments);
|
||||
if (proc.result() != QtcProcess::FinishedWithSuccess)
|
||||
return false;
|
||||
|
||||
@@ -136,12 +134,12 @@ bool MercurialClient::synchronousClone(const FilePath &workingDir,
|
||||
arguments.clear();
|
||||
arguments << QLatin1String("pull") << dstLocation;
|
||||
QtcProcess proc1;
|
||||
vcsSynchronousExec(proc1, workingDirectory.path(), arguments, flags);
|
||||
vcsSynchronousExec(proc1, workingDirectory, arguments, flags);
|
||||
if (proc1.result() != QtcProcess::FinishedWithSuccess)
|
||||
return false;
|
||||
|
||||
// By now, there is no hgrc file -> create it
|
||||
FileSaver saver(Utils::FilePath::fromString(workingDirectory.path() + "/.hg/hgrc"));
|
||||
FileSaver saver(workingDirectory.pathAppended(".hg/hgrc"));
|
||||
const QString hgrc = QLatin1String("[paths]\ndefault = ") + dstLocation + QLatin1Char('\n');
|
||||
saver.write(hgrc.toUtf8());
|
||||
if (!saver.finalize()) {
|
||||
@@ -153,19 +151,18 @@ bool MercurialClient::synchronousClone(const FilePath &workingDir,
|
||||
arguments.clear();
|
||||
arguments << QLatin1String("update");
|
||||
QtcProcess proc2;
|
||||
vcsSynchronousExec(proc2, workingDirectory.path(), arguments, flags);
|
||||
vcsSynchronousExec(proc2, workingDirectory, arguments, flags);
|
||||
return proc2.result() == QtcProcess::FinishedWithSuccess;
|
||||
} else {
|
||||
QStringList arguments(QLatin1String("clone"));
|
||||
arguments << dstLocation << workingDirectory.dirName();
|
||||
workingDirectory.cdUp();
|
||||
arguments << dstLocation << workingDirectory.parentDir().toString();
|
||||
QtcProcess proc;
|
||||
vcsSynchronousExec(proc, workingDirectory.path(), arguments, flags);
|
||||
vcsSynchronousExec(proc, workingDirectory.parentDir(), arguments, flags);
|
||||
return proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
bool MercurialClient::synchronousPull(const QString &workingDir, const QString &srcLocation, const QStringList &extraOptions)
|
||||
bool MercurialClient::synchronousPull(const FilePath &workingDir, const QString &srcLocation, const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args;
|
||||
args << vcsCommandString(PullCommand) << extraOptions << srcLocation;
|
||||
@@ -202,12 +199,12 @@ QString MercurialClient::branchQuerySync(const QString &repositoryRoot)
|
||||
return QLatin1String("Unknown Branch");
|
||||
}
|
||||
|
||||
static inline QString msgParentRevisionFailed(const QString &workingDirectory,
|
||||
const QString &revision,
|
||||
const QString &why)
|
||||
static QString msgParentRevisionFailed(const FilePath &workingDirectory,
|
||||
const QString &revision,
|
||||
const QString &why)
|
||||
{
|
||||
return MercurialClient::tr("Unable to find parent revisions of %1 in %2: %3").
|
||||
arg(revision, QDir::toNativeSeparators(workingDirectory), why);
|
||||
arg(revision, workingDirectory.toUserOutput(), why);
|
||||
}
|
||||
|
||||
static inline QString msgParseParentsOutputFailed(const QString &output)
|
||||
@@ -215,9 +212,9 @@ static inline QString msgParseParentsOutputFailed(const QString &output)
|
||||
return MercurialClient::tr("Cannot parse output: %1").arg(output);
|
||||
}
|
||||
|
||||
QStringList MercurialClient::parentRevisionsSync(const QString &workingDirectory,
|
||||
const QString &file /* = QString() */,
|
||||
const QString &revision)
|
||||
QStringList MercurialClient::parentRevisionsSync(const FilePath &workingDirectory,
|
||||
const QString &file /* = QString() */,
|
||||
const QString &revision)
|
||||
{
|
||||
QStringList parents;
|
||||
QStringList args;
|
||||
@@ -258,9 +255,9 @@ user: ...
|
||||
}
|
||||
|
||||
// Describe a change using an optional format
|
||||
QString MercurialClient::shortDescriptionSync(const QString &workingDirectory,
|
||||
const QString &revision,
|
||||
const QString &format)
|
||||
QString MercurialClient::shortDescriptionSync(const FilePath &workingDirectory,
|
||||
const QString &revision,
|
||||
const QString &format)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("log") << QLatin1String("-r") <<revision;
|
||||
@@ -277,13 +274,13 @@ QString MercurialClient::shortDescriptionSync(const QString &workingDirectory,
|
||||
// Default format: "SHA1 (author summmary)"
|
||||
static const char defaultFormatC[] = "{node} ({author|person} {desc|firstline})";
|
||||
|
||||
QString MercurialClient::shortDescriptionSync(const QString &workingDirectory,
|
||||
const QString &revision)
|
||||
QString MercurialClient::shortDescriptionSync(const FilePath &workingDirectory,
|
||||
const QString &revision)
|
||||
{
|
||||
return shortDescriptionSync(workingDirectory, revision, QLatin1String(defaultFormatC));
|
||||
}
|
||||
|
||||
bool MercurialClient::managesFile(const QString &workingDirectory, const QString &fileName) const
|
||||
bool MercurialClient::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("status") << QLatin1String("--unknown") << fileName;
|
||||
@@ -292,44 +289,43 @@ bool MercurialClient::managesFile(const QString &workingDirectory, const QString
|
||||
return proc.stdOut().isEmpty();
|
||||
}
|
||||
|
||||
void MercurialClient::incoming(const QString &repositoryRoot, const QString &repository)
|
||||
void MercurialClient::incoming(const FilePath &repositoryRoot, const QString &repository)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("incoming") << QLatin1String("-g") << QLatin1String("-p");
|
||||
if (!repository.isEmpty())
|
||||
args.append(repository);
|
||||
|
||||
QString id = repositoryRoot;
|
||||
QString id = repositoryRoot.toString();
|
||||
if (!repository.isEmpty())
|
||||
id += QLatin1Char('/') + repository;
|
||||
|
||||
const QString title = tr("Hg incoming %1").arg(id);
|
||||
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot,
|
||||
VcsBaseEditor::getCodec(repositoryRoot),
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot.toString(),
|
||||
VcsBaseEditor::getCodec(repositoryRoot.toString()),
|
||||
"incoming", id);
|
||||
VcsCommand *cmd = createCommand(repository, editor);
|
||||
VcsCommand *cmd = createCommand(FilePath::fromString(repository), editor);
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
|
||||
void MercurialClient::outgoing(const QString &repositoryRoot)
|
||||
void MercurialClient::outgoing(const FilePath &repositoryRoot)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("outgoing") << QLatin1String("-g") << QLatin1String("-p");
|
||||
|
||||
const QString title = tr("Hg outgoing %1").
|
||||
arg(QDir::toNativeSeparators(repositoryRoot));
|
||||
const QString title = tr("Hg outgoing %1").arg(repositoryRoot.toUserOutput());
|
||||
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot,
|
||||
VcsBaseEditor::getCodec(repositoryRoot),
|
||||
"outgoing", repositoryRoot);
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(Constants::DIFFLOG_ID, title, repositoryRoot.toString(),
|
||||
VcsBaseEditor::getCodec(repositoryRoot.toString()),
|
||||
"outgoing", repositoryRoot.toString());
|
||||
|
||||
VcsCommand *cmd = createCommand(repositoryRoot, editor);
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
|
||||
VcsBaseEditorWidget *MercurialClient::annotate(
|
||||
const QString &workingDir, const QString &file, const QString &revision,
|
||||
const FilePath &workingDir, const QString &file, const QString &revision,
|
||||
int lineNumber, const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args(extraOptions);
|
||||
@@ -337,7 +333,7 @@ VcsBaseEditorWidget *MercurialClient::annotate(
|
||||
return VcsBaseClient::annotate(workingDir, file, revision, lineNumber, args);
|
||||
}
|
||||
|
||||
void MercurialClient::commit(const QString &repositoryRoot, const QStringList &files,
|
||||
void MercurialClient::commit(const FilePath &repositoryRoot, const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
@@ -346,7 +342,7 @@ void MercurialClient::commit(const QString &repositoryRoot, const QStringList &f
|
||||
VcsBaseClient::commit(repositoryRoot, files, commitMessageFile, args);
|
||||
}
|
||||
|
||||
void MercurialClient::diff(const QString &workingDir, const QStringList &files,
|
||||
void MercurialClient::diff(const FilePath &workingDir, const QStringList &files,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
Q_UNUSED(extraOptions)
|
||||
@@ -358,41 +354,41 @@ void MercurialClient::diff(const QString &workingDir, const QStringList &files,
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const QString documentId = QString(Constants::MERCURIAL_PLUGIN)
|
||||
+ ".DiffRepo." + sourceFile;
|
||||
requestReload(documentId, sourceFile, title, workingDir, {"diff"});
|
||||
requestReload(documentId, sourceFile, title, workingDir.toString(), {"diff"});
|
||||
} else if (files.size() == 1) {
|
||||
fileName = files.at(0);
|
||||
const QString title = tr("Mercurial Diff \"%1\"").arg(fileName);
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const QString documentId = QString(Constants::MERCURIAL_PLUGIN)
|
||||
+ ".DiffFile." + sourceFile;
|
||||
requestReload(documentId, sourceFile, title, workingDir, {"diff", fileName});
|
||||
requestReload(documentId, sourceFile, title, workingDir.toString(), {"diff", fileName});
|
||||
} else {
|
||||
const QString title = tr("Mercurial Diff \"%1\"").arg(workingDir);
|
||||
const QString title = tr("Mercurial Diff \"%1\"").arg(workingDir.toString());
|
||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||
const QString documentId = QString(Constants::MERCURIAL_PLUGIN)
|
||||
+ ".DiffFile." + workingDir;
|
||||
requestReload(documentId, sourceFile, title, workingDir, QStringList{"diff"} + files);
|
||||
+ ".DiffFile." + workingDir.toString();
|
||||
requestReload(documentId, sourceFile, title, workingDir.toString(), QStringList{"diff"} + files);
|
||||
}
|
||||
}
|
||||
|
||||
void MercurialClient::import(const QString &repositoryRoot, const QStringList &files,
|
||||
void MercurialClient::import(const FilePath &repositoryRoot, const QStringList &files,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
VcsBaseClient::import(repositoryRoot, files,
|
||||
QStringList(extraOptions) << QLatin1String("--no-commit"));
|
||||
}
|
||||
|
||||
void MercurialClient::revertAll(const QString &workingDir, const QString &revision,
|
||||
void MercurialClient::revertAll(const FilePath &workingDir, const QString &revision,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
VcsBaseClient::revertAll(workingDir, revision,
|
||||
QStringList(extraOptions) << QLatin1String("--all"));
|
||||
}
|
||||
|
||||
bool MercurialClient::isVcsDirectory(const FilePath &fileName) const
|
||||
bool MercurialClient::isVcsDirectory(const FilePath &filePath) const
|
||||
{
|
||||
return fileName.isDir()
|
||||
&& !fileName.fileName().compare(Constants::MERCURIALREPO, HostOsInfo::fileNameCaseSensitivity());
|
||||
return filePath.isDir()
|
||||
&& !filePath.fileName().compare(Constants::MERCURIALREPO, HostOsInfo::fileNameCaseSensitivity());
|
||||
}
|
||||
|
||||
void MercurialClient::view(const QString &source, const QString &id,
|
||||
|
||||
@@ -45,36 +45,36 @@ public:
|
||||
bool synchronousClone(const Utils::FilePath &workingDir,
|
||||
const QString &srcLocation,
|
||||
const QString &dstLocation,
|
||||
const QStringList &extraOptions = QStringList()) override;
|
||||
bool synchronousPull(const QString &workingDir,
|
||||
const QStringList &extraOptions = {}) override;
|
||||
bool synchronousPull(const Utils::FilePath &workingDir,
|
||||
const QString &srcLocation,
|
||||
const QStringList &extraOptions = QStringList()) override;
|
||||
bool manifestSync(const QString &repository, const QString &filename);
|
||||
const QStringList &extraOptions = {}) override;
|
||||
bool manifestSync(const Utils::FilePath &repository, const QString &filename);
|
||||
QString branchQuerySync(const QString &repositoryRoot);
|
||||
QStringList parentRevisionsSync(const QString &workingDirectory,
|
||||
QStringList parentRevisionsSync(const Utils::FilePath &workingDirectory,
|
||||
const QString &file /* = QString() */,
|
||||
const QString &revision);
|
||||
QString shortDescriptionSync(const QString &workingDirectory, const QString &revision,
|
||||
QString shortDescriptionSync(const Utils::FilePath &workingDirectory, const QString &revision,
|
||||
const QString &format /* = QString() */);
|
||||
QString shortDescriptionSync(const QString &workingDirectory, const QString &revision);
|
||||
void incoming(const QString &repositoryRoot, const QString &repository = QString());
|
||||
void outgoing(const QString &repositoryRoot);
|
||||
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
|
||||
QString shortDescriptionSync(const Utils::FilePath &workingDirectory, const QString &revision);
|
||||
void incoming(const Utils::FilePath &repositoryRoot, const QString &repository = {});
|
||||
void outgoing(const Utils::FilePath &repositoryRoot);
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const;
|
||||
|
||||
VcsBase::VcsBaseEditorWidget *annotate(
|
||||
const QString &workingDir, const QString &file, const QString &revision = QString(),
|
||||
int lineNumber = -1, const QStringList &extraOptions = QStringList()) override;
|
||||
void commit(const QString &repositoryRoot, const QStringList &files,
|
||||
const Utils::FilePath &workingDir, const QString &file, const QString &revision = {},
|
||||
int lineNumber = -1, const QStringList &extraOptions = {}) override;
|
||||
void commit(const Utils::FilePath &repositoryRoot, const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions = QStringList()) override;
|
||||
void diff(const QString &workingDir, const QStringList &files = QStringList(),
|
||||
const QStringList &extraOptions = QStringList()) override;
|
||||
void import(const QString &repositoryRoot, const QStringList &files,
|
||||
const QStringList &extraOptions = QStringList()) override;
|
||||
void revertAll(const QString &workingDir, const QString &revision = QString(),
|
||||
const QStringList &extraOptions = QStringList()) override;
|
||||
void diff(const Utils::FilePath &workingDir, const QStringList &files = {},
|
||||
const QStringList &extraOptions = {}) override;
|
||||
void import(const Utils::FilePath &repositoryRoot, const QStringList &files,
|
||||
const QStringList &extraOptions = {}) override;
|
||||
void revertAll(const Utils::FilePath &workingDir, const QString &revision = {},
|
||||
const QStringList &extraOptions = {}) override;
|
||||
|
||||
bool isVcsDirectory(const Utils::FilePath &fileName) const;
|
||||
bool isVcsDirectory(const Utils::FilePath &filePath) const;
|
||||
Utils::FilePath findTopLevelForFile(const Utils::FilePath &file) const override;
|
||||
|
||||
void view(const QString &source, const QString &id,
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Mercurial {
|
||||
namespace Internal {
|
||||
|
||||
@@ -80,7 +82,7 @@ QString MercurialEditorWidget::decorateVersion(const QString &revision) const
|
||||
const QFileInfo fi(source());
|
||||
const QString workingDirectory = fi.absolutePath();
|
||||
// Format with short summary
|
||||
return m_client->shortDescriptionSync(workingDirectory, revision);
|
||||
return m_client->shortDescriptionSync(FilePath::fromString(workingDirectory), revision);
|
||||
}
|
||||
|
||||
QStringList MercurialEditorWidget::annotationPreviousVersions(const QString &revision) const
|
||||
@@ -88,7 +90,7 @@ QStringList MercurialEditorWidget::annotationPreviousVersions(const QString &rev
|
||||
const QFileInfo fi(source());
|
||||
const QString workingDirectory = fi.absolutePath();
|
||||
// Retrieve parent revisions
|
||||
return m_client->parentRevisionsSync(workingDirectory, fi.fileName(), revision);
|
||||
return m_client->parentRevisionsSync(FilePath::fromString(workingDirectory), fi.fileName(), revision);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -215,7 +215,7 @@ private:
|
||||
QAction *m_createRepositoryAction = nullptr;
|
||||
QAction *m_menuAction = nullptr;
|
||||
|
||||
QString m_submitRepository;
|
||||
FilePath m_submitRepository;
|
||||
|
||||
bool m_submitActionTriggered = false;
|
||||
|
||||
@@ -657,12 +657,11 @@ void MercurialPluginPrivate::showCommitWidget(const QList<VcsBaseClient::StatusI
|
||||
this, &MercurialPluginPrivate::diffFromEditorSelected);
|
||||
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
|
||||
|
||||
const QString msg = tr("Commit changes for \"%1\".").
|
||||
arg(QDir::toNativeSeparators(m_submitRepository));
|
||||
const QString msg = tr("Commit changes for \"%1\".").arg(m_submitRepository.toUserOutput());
|
||||
commitEditor->document()->setPreferredDisplayName(msg);
|
||||
|
||||
const QString branch = vcsTopic(FilePath::fromString(m_submitRepository));
|
||||
commitEditor->setFields(QFileInfo(m_submitRepository), branch,
|
||||
const QString branch = vcsTopic(m_submitRepository);
|
||||
commitEditor->setFields(QFileInfo(m_submitRepository.toString()), branch,
|
||||
m_settings.userName.value(),
|
||||
m_settings.userEmail.value(), status);
|
||||
}
|
||||
@@ -762,7 +761,7 @@ bool MercurialPluginPrivate::managesDirectory(const FilePath &filePath, FilePath
|
||||
|
||||
bool MercurialPluginPrivate::managesFile(const FilePath &workingDirectory, const QString &fileName) const
|
||||
{
|
||||
return m_client.managesFile(workingDirectory.toString(), fileName);
|
||||
return m_client.managesFile(workingDirectory, fileName);
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::isConfigured() const
|
||||
@@ -800,23 +799,21 @@ bool MercurialPluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
|
||||
bool MercurialPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_client.synchronousAdd(fi.absolutePath(), fi.fileName());
|
||||
return m_client.synchronousAdd(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return m_client.synchronousRemove(fi.absolutePath(), fi.fileName());
|
||||
return m_client.synchronousRemove(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return m_client.synchronousMove(fromInfo.absolutePath(),
|
||||
fromInfo.absoluteFilePath(),
|
||||
toInfo.absoluteFilePath());
|
||||
return m_client.synchronousMove(from.parentDir(),
|
||||
fromInfo.absoluteFilePath(),
|
||||
toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool MercurialPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
||||
@@ -826,8 +823,7 @@ bool MercurialPluginPrivate::vcsCreateRepository(const FilePath &directory)
|
||||
|
||||
void MercurialPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
m_client.annotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
m_client.annotate(filePath.parentDir(), filePath.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
Core::ShellCommand *MercurialPluginPrivate::createInitialCheckoutCommand(const QString &url,
|
||||
@@ -837,8 +833,7 @@ Core::ShellCommand *MercurialPluginPrivate::createInitialCheckoutCommand(const Q
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("clone") << extraArgs << url << localName;
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory.toString(),
|
||||
m_client.processEnvironment());
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory, m_client.processEnvironment());
|
||||
command->addJob({m_settings.binaryPath.filePath(), args}, -1);
|
||||
return command;
|
||||
}
|
||||
@@ -851,14 +846,14 @@ bool MercurialPluginPrivate::sccManaged(const QString &filename)
|
||||
if (!managed || topLevel.isEmpty())
|
||||
return false;
|
||||
const QDir topLevelDir(topLevel.toString());
|
||||
return m_client.manifestSync(topLevel.toString(), topLevelDir.relativeFilePath(filename));
|
||||
return m_client.manifestSync(topLevel, topLevelDir.relativeFilePath(filename));
|
||||
}
|
||||
|
||||
void MercurialPluginPrivate::changed(const QVariant &v)
|
||||
{
|
||||
switch (v.type()) {
|
||||
case QVariant::String:
|
||||
emit repositoryChanged(v.toString());
|
||||
emit repositoryChanged(FilePath::fromVariant(v));
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
emit filesChanged(v.toStringList());
|
||||
|
||||
@@ -90,16 +90,16 @@ QString SrcDestDialog::getRepositoryString() const
|
||||
return m_ui->urlLineEdit->text();
|
||||
}
|
||||
|
||||
QString SrcDestDialog::workingDir() const
|
||||
Utils::FilePath SrcDestDialog::workingDir() const
|
||||
{
|
||||
return m_workingdir;
|
||||
return Utils::FilePath::fromString(m_workingdir);
|
||||
}
|
||||
|
||||
QUrl SrcDestDialog::getRepoUrl() const
|
||||
{
|
||||
// Repo to use: Default to the project repo, but use the current
|
||||
const QString projectLoc = m_state.currentProjectPath();
|
||||
const QString fileLoc = m_state.currentFileTopLevel();
|
||||
const QString projectLoc = m_state.currentProjectPath().toString();
|
||||
const QString fileLoc = m_state.currentFileTopLevel().toString();
|
||||
m_workingdir = projectLoc;
|
||||
if (!fileLoc.isEmpty())
|
||||
m_workingdir = fileLoc;
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
void setPathChooserKind(Utils::PathChooser::Kind kind);
|
||||
QString getRepositoryString() const;
|
||||
QString workingDir() const;
|
||||
Utils::FilePath workingDir() const;
|
||||
|
||||
private:
|
||||
QUrl getRepoUrl() const;
|
||||
|
||||
@@ -222,7 +222,7 @@ void PerforceChecker::emitFailed(const QString &m)
|
||||
void PerforceChecker::emitSucceeded(const QString &m)
|
||||
{
|
||||
resetOverrideCursor();
|
||||
emit succeeded(m);
|
||||
emit succeeded(FilePath::fromString(m));
|
||||
}
|
||||
|
||||
bool PerforceChecker::useOverideCursor() const
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
void setUseOverideCursor(bool v);
|
||||
|
||||
signals:
|
||||
void succeeded(const QString &repositoryRoot);
|
||||
void succeeded(const Utils::FilePath &repositoryRoot);
|
||||
void failed(const QString &errorMessage);
|
||||
|
||||
private:
|
||||
|
||||
@@ -195,7 +195,7 @@ enum RunFlags
|
||||
|
||||
struct PerforceDiffParameters
|
||||
{
|
||||
QString workingDir;
|
||||
FilePath workingDir;
|
||||
QStringList diffArguments;
|
||||
QStringList files;
|
||||
};
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
QString displayName() const final { return {"perforce"}; }
|
||||
Id id() const final { return VcsBase::Constants::VCS_ID_PERFORCE; }
|
||||
|
||||
bool isVcsFileOrDirectory(const FilePath &fileName) const final;
|
||||
bool isVcsFileOrDirectory(const FilePath &filePath) const final;
|
||||
bool managesDirectory(const Utils::FilePath &directory, Utils::FilePath *topLevel = nullptr) const final;
|
||||
bool managesFile(const Utils::FilePath &workingDirectory, const QString &fileName) const final;
|
||||
|
||||
@@ -230,12 +230,12 @@ public:
|
||||
QString vcsMakeWritableText() const final;
|
||||
|
||||
///
|
||||
bool vcsOpen(const QString &workingDir, const QString &fileName, bool silently = false);
|
||||
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
||||
bool vcsDelete(const QString &workingDir, const QString &filename);
|
||||
bool vcsMove(const QString &workingDir, const QString &from, const QString &to);
|
||||
bool vcsOpen(const FilePath &workingDir, const QString &fileName, bool silently = false);
|
||||
bool vcsAdd(const FilePath &workingDir, const QString &fileName);
|
||||
bool vcsDelete(const FilePath &workingDir, const QString &filename);
|
||||
bool vcsMove(const FilePath &workingDir, const QString &from, const QString &to);
|
||||
|
||||
void p4Diff(const QString &workingDir, const QStringList &files);
|
||||
void p4Diff(const FilePath &workingDir, const QStringList &files);
|
||||
|
||||
IEditor *openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames);
|
||||
|
||||
@@ -270,18 +270,18 @@ public:
|
||||
void commitFromEditor() override;
|
||||
void printPendingChanges();
|
||||
void slotSubmitDiff(const QStringList &files);
|
||||
void setTopLevel(const QString &);
|
||||
void setTopLevel(const Utils::FilePath &);
|
||||
void slotTopLevelFailed(const QString &);
|
||||
|
||||
class DirectoryCacheEntry
|
||||
{
|
||||
public:
|
||||
DirectoryCacheEntry(bool isManaged, const QString &topLevel):
|
||||
DirectoryCacheEntry(bool isManaged, const FilePath &topLevel):
|
||||
m_isManaged(isManaged), m_topLevel(topLevel)
|
||||
{ }
|
||||
|
||||
bool m_isManaged;
|
||||
QString m_topLevel;
|
||||
FilePath m_topLevel;
|
||||
};
|
||||
|
||||
typedef QHash<QString, DirectoryCacheEntry> ManagedDirectoryCache;
|
||||
@@ -292,7 +292,7 @@ public:
|
||||
|
||||
// args are passed as command line arguments
|
||||
// extra args via a tempfile and the option -x "temp-filename"
|
||||
PerforceResponse runP4Cmd(const QString &workingDir,
|
||||
PerforceResponse runP4Cmd(const FilePath &workingDir,
|
||||
const QStringList &args,
|
||||
unsigned flags = CommandToWindow|StdErrToWindow|ErrorToWindow,
|
||||
const QStringList &extraArgs = {},
|
||||
@@ -312,11 +312,11 @@ public:
|
||||
QTextCodec *outputCodec) const;
|
||||
|
||||
QString clientFilePath(const QString &serverFilePath);
|
||||
void annotate(const QString &workingDir, const QString &fileName,
|
||||
void annotate(const FilePath &workingDir, const QString &fileName,
|
||||
const QString &changeList = QString(), int lineNumber = -1);
|
||||
void filelog(const QString &workingDir, const QString &fileName = QString(),
|
||||
void filelog(const FilePath &workingDir, const QString &fileName = QString(),
|
||||
bool enableAnnotationContextMenu = false);
|
||||
void changelists(const QString &workingDir, const QString &fileName = QString());
|
||||
void changelists(const FilePath &workingDir, const QString &fileName = QString());
|
||||
void cleanCommitMessageFile();
|
||||
bool isCommitEditorOpen() const;
|
||||
static QSharedPointer<TempFileSaver> createTemporaryArgumentFile(const QStringList &extraArgs,
|
||||
@@ -324,9 +324,8 @@ public:
|
||||
|
||||
QString pendingChangesData();
|
||||
|
||||
void updateCheckout(const QString &workingDir = QString(),
|
||||
const QStringList &dirs = QStringList());
|
||||
bool revertProject(const QString &workingDir, const QStringList &args, bool unchangedOnly);
|
||||
void updateCheckout(const FilePath &workingDir = {}, const QStringList &dirs = {});
|
||||
bool revertProject(const FilePath &workingDir, const QStringList &args, bool unchangedOnly);
|
||||
bool managesDirectoryFstat(const QString &directory);
|
||||
|
||||
void applySettings();
|
||||
@@ -685,7 +684,7 @@ void PerforcePluginPrivate::revertUnchangedCurrentProject()
|
||||
revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), true);
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::revertProject(const QString &workingDir, const QStringList &pathArgs, bool unchangedOnly)
|
||||
bool PerforcePluginPrivate::revertProject(const FilePath &workingDir, const QStringList &pathArgs, bool unchangedOnly)
|
||||
{
|
||||
QStringList args(QLatin1String("revert"));
|
||||
if (unchangedOnly)
|
||||
@@ -696,7 +695,7 @@ bool PerforcePluginPrivate::revertProject(const QString &workingDir, const QStri
|
||||
return !resp.error;
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::updateCheckout(const QString &workingDir, const QStringList &dirs)
|
||||
void PerforcePluginPrivate::updateCheckout(const FilePath &workingDir, const QStringList &dirs)
|
||||
{
|
||||
QStringList args(QLatin1String("sync"));
|
||||
args.append(dirs);
|
||||
@@ -706,9 +705,8 @@ void PerforcePluginPrivate::updateCheckout(const QString &workingDir, const QStr
|
||||
if (!workingDir.isEmpty())
|
||||
emit repositoryChanged(workingDir);
|
||||
} else {
|
||||
const QChar slash = QLatin1Char('/');
|
||||
foreach (const QString &dir, dirs)
|
||||
emit repositoryChanged(workingDir + slash + dir);
|
||||
for (const QString &dir : dirs)
|
||||
emit repositoryChanged(workingDir.pathAppended(dir));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -846,14 +844,14 @@ void PerforcePluginPrivate::annotateFile()
|
||||
const QString file = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("p4 annotate"));
|
||||
if (!file.isEmpty()) {
|
||||
const QFileInfo fi(file);
|
||||
annotate(fi.absolutePath(), fi.fileName());
|
||||
annotate(FilePath::fromString(fi.absolutePath()), fi.fileName());
|
||||
}
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::annotate(const QString &workingDir,
|
||||
const QString &fileName,
|
||||
const QString &changeList /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
void PerforcePluginPrivate::annotate(const FilePath &workingDir,
|
||||
const QString &fileName,
|
||||
const QString &changeList /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
{
|
||||
const QStringList files = QStringList(fileName);
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, files);
|
||||
@@ -887,11 +885,9 @@ void PerforcePluginPrivate::filelogCurrentFile()
|
||||
|
||||
void PerforcePluginPrivate::filelogFile()
|
||||
{
|
||||
const QString file = QFileDialog::getOpenFileName(ICore::dialogParent(), tr("p4 filelog"));
|
||||
if (!file.isEmpty()) {
|
||||
const QFileInfo fi(file);
|
||||
filelog(fi.absolutePath(), fi.fileName());
|
||||
}
|
||||
const FilePath file = FileUtils::getOpenFilePath(tr("p4 filelog"));
|
||||
if (!file.isEmpty())
|
||||
filelog(file.parentDir(), file.fileName());
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::logProject()
|
||||
@@ -908,8 +904,8 @@ void PerforcePluginPrivate::logRepository()
|
||||
changelists(state.topLevel(), perforceRelativeFileArguments(QString()));
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::filelog(const QString &workingDir, const QString &fileName,
|
||||
bool enableAnnotationContextMenu)
|
||||
void PerforcePluginPrivate::filelog(const FilePath &workingDir, const QString &fileName,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(fileName));
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, QStringList(fileName));
|
||||
@@ -931,7 +927,7 @@ void PerforcePluginPrivate::filelog(const QString &workingDir, const QString &fi
|
||||
}
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::changelists(const QString &workingDir, const QString &fileName)
|
||||
void PerforcePluginPrivate::changelists(const FilePath &workingDir, const QString &fileName)
|
||||
{
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(fileName));
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(workingDir, QStringList(fileName));
|
||||
@@ -983,7 +979,7 @@ bool PerforcePluginPrivate::managesDirectory(const FilePath &directory, FilePath
|
||||
const bool rc = const_cast<PerforcePluginPrivate *>(this)->managesDirectoryFstat(directory.toString());
|
||||
if (topLevel) {
|
||||
if (rc)
|
||||
*topLevel = FilePath::fromString(m_settings.topLevelSymLinkTarget());
|
||||
*topLevel = m_settings.topLevelSymLinkTarget();
|
||||
else
|
||||
topLevel->clear();
|
||||
}
|
||||
@@ -994,7 +990,7 @@ bool PerforcePluginPrivate::managesFile(const FilePath &workingDirectory, const
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("fstat") << QLatin1String("-m1") << fileName;
|
||||
const PerforceResponse result = runP4Cmd(workingDirectory.toString(), args, RunFullySynchronous);
|
||||
const PerforceResponse result = runP4Cmd(workingDirectory, args, RunFullySynchronous);
|
||||
return result.stdOut.contains(QLatin1String("depotFile"));
|
||||
}
|
||||
|
||||
@@ -1039,7 +1035,7 @@ bool PerforcePluginPrivate::managesDirectoryFstat(const QString &directory)
|
||||
return managed;
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsOpen(const QString &workingDir, const QString &fileName, bool silently)
|
||||
bool PerforcePluginPrivate::vcsOpen(const FilePath &workingDir, const QString &fileName, bool silently)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("edit") << QDir::toNativeSeparators(fileName);
|
||||
@@ -1052,7 +1048,7 @@ bool PerforcePluginPrivate::vcsOpen(const QString &workingDir, const QString &fi
|
||||
return !result.error;
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsAdd(const QString &workingDir, const QString &fileName)
|
||||
bool PerforcePluginPrivate::vcsAdd(const FilePath &workingDir, const QString &fileName)
|
||||
{
|
||||
QStringList args;
|
||||
args << QLatin1String("add") << fileName;
|
||||
@@ -1061,7 +1057,7 @@ bool PerforcePluginPrivate::vcsAdd(const QString &workingDir, const QString &fil
|
||||
return !result.error;
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsDelete(const QString &workingDir, const QString &fileName)
|
||||
bool PerforcePluginPrivate::vcsDelete(const FilePath &workingDir, const QString &fileName)
|
||||
{
|
||||
|
||||
QStringList args;
|
||||
@@ -1084,7 +1080,7 @@ bool PerforcePluginPrivate::vcsDelete(const QString &workingDir, const QString &
|
||||
return !deleteResult.error;
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsMove(const QString &workingDir, const QString &from, const QString &to)
|
||||
bool PerforcePluginPrivate::vcsMove(const FilePath &workingDir, const QString &from, const QString &to)
|
||||
{
|
||||
// TODO verify this works
|
||||
QStringList args;
|
||||
@@ -1126,9 +1122,9 @@ PerforcePluginPrivate::createTemporaryArgumentFile(const QStringList &extraArgs,
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::isVcsFileOrDirectory(const FilePath &FilePath) const
|
||||
bool PerforcePluginPrivate::isVcsFileOrDirectory(const FilePath &filePath) const
|
||||
{
|
||||
Q_UNUSED(FilePath)
|
||||
Q_UNUSED(filePath)
|
||||
return false; // Perforce does not seem to litter its files into the source tree.
|
||||
}
|
||||
|
||||
@@ -1166,8 +1162,7 @@ IVersionControl::OpenSupportMode PerforcePluginPrivate::openSupportMode(const Fi
|
||||
|
||||
bool PerforcePluginPrivate::vcsOpen(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsOpen(fi.absolutePath(), fi.fileName(), true);
|
||||
return vcsOpen(filePath.parentDir(), filePath.fileName(), true);
|
||||
}
|
||||
|
||||
IVersionControl::SettingsFlags PerforcePluginPrivate::settingsFlags() const
|
||||
@@ -1180,21 +1175,19 @@ IVersionControl::SettingsFlags PerforcePluginPrivate::settingsFlags() const
|
||||
|
||||
bool PerforcePluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsAdd(fi.absolutePath(), fi.fileName());
|
||||
return vcsAdd(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsDelete(fi.absolutePath(), fi.fileName());
|
||||
return vcsDelete(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return vcsMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||
return vcsMove(from.parentDir().absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool PerforcePluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
@@ -1204,8 +1197,7 @@ bool PerforcePluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
|
||||
void PerforcePluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
annotate(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
annotate(filePath.parentDir(), filePath.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
QString PerforcePluginPrivate::vcsOpenText() const
|
||||
@@ -1369,7 +1361,7 @@ PerforceResponse PerforcePluginPrivate::fullySynchronousProcess(const QString &w
|
||||
return response;
|
||||
}
|
||||
|
||||
PerforceResponse PerforcePluginPrivate::runP4Cmd(const QString &workingDir,
|
||||
PerforceResponse PerforcePluginPrivate::runP4Cmd(const FilePath &workingDir,
|
||||
const QStringList &args,
|
||||
unsigned flags,
|
||||
const QStringList &extraArgs,
|
||||
@@ -1383,7 +1375,7 @@ PerforceResponse PerforcePluginPrivate::runP4Cmd(const QString &workingDir,
|
||||
VcsOutputWindow::appendError(invalidConfigResponse.message);
|
||||
return invalidConfigResponse;
|
||||
}
|
||||
QStringList actualArgs = m_settings.commonP4Arguments(workingDir);
|
||||
QStringList actualArgs = m_settings.commonP4Arguments(workingDir.toString());
|
||||
QString errorMessage;
|
||||
QSharedPointer<TempFileSaver> tempFile = createTemporaryArgumentFile(extraArgs, &errorMessage);
|
||||
if (!tempFile.isNull()) {
|
||||
@@ -1397,14 +1389,14 @@ PerforceResponse PerforcePluginPrivate::runP4Cmd(const QString &workingDir,
|
||||
actualArgs.append(args);
|
||||
|
||||
if (flags & CommandToWindow)
|
||||
VcsOutputWindow::appendCommand(workingDir, {m_settings.p4BinaryPath.value(), actualArgs});
|
||||
VcsOutputWindow::appendCommand(workingDir.toString(), {m_settings.p4BinaryPath.value(), actualArgs});
|
||||
|
||||
if (flags & ShowBusyCursor)
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
const PerforceResponse response = (flags & RunFullySynchronous) ?
|
||||
fullySynchronousProcess(workingDir, actualArgs, flags, stdInput, outputCodec) :
|
||||
synchronousProcess(workingDir, actualArgs, flags, stdInput, outputCodec);
|
||||
fullySynchronousProcess(workingDir.toString(), actualArgs, flags, stdInput, outputCodec) :
|
||||
synchronousProcess(workingDir.toString(), actualArgs, flags, stdInput, outputCodec);
|
||||
|
||||
if (flags & ShowBusyCursor)
|
||||
QApplication::restoreOverrideCursor();
|
||||
@@ -1483,7 +1475,7 @@ QString PerforcePluginPrivate::commitDisplayName() const
|
||||
return tr("Submit");
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::p4Diff(const QString &workingDir, const QStringList &files)
|
||||
void PerforcePluginPrivate::p4Diff(const FilePath &workingDir, const QStringList &files)
|
||||
{
|
||||
PerforceDiffParameters p;
|
||||
p.workingDir = workingDir;
|
||||
@@ -1497,7 +1489,7 @@ void PerforcePluginPrivate::p4Diff(const PerforceDiffParameters &p)
|
||||
QTextCodec *codec = VcsBaseEditor::getCodec(p.workingDir, p.files);
|
||||
const QString id = VcsBaseEditor::getTitleId(p.workingDir, p.files);
|
||||
// Reuse existing editors for that id
|
||||
const QString tag = VcsBaseEditor::editorTag(DiffOutput, p.workingDir, p.files);
|
||||
const QString tag = VcsBaseEditor::editorTag(DiffOutput, p.workingDir.toString(), p.files);
|
||||
IEditor *existingEditor = VcsBaseEditor::locateEditorByTag(tag);
|
||||
// Split arguments according to size
|
||||
QStringList args;
|
||||
@@ -1704,14 +1696,14 @@ QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
|
||||
return dd->m_settings.mapToFileSystem(p4fileSpec);
|
||||
}
|
||||
|
||||
void PerforcePluginPrivate::setTopLevel(const QString &topLevel)
|
||||
void PerforcePluginPrivate::setTopLevel(const FilePath &topLevel)
|
||||
{
|
||||
if (m_settings.topLevel() == topLevel)
|
||||
return;
|
||||
|
||||
m_settings.setTopLevel(topLevel);
|
||||
m_settings.setTopLevel(topLevel.toString());
|
||||
|
||||
const QString msg = tr("Perforce repository: %1").arg(QDir::toNativeSeparators(topLevel));
|
||||
const QString msg = tr("Perforce repository: %1").arg(topLevel.toUserOutput());
|
||||
VcsOutputWindow::appendSilently(msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -144,14 +144,14 @@ bool PerforceSettings::defaultEnv() const
|
||||
return !customEnv.value(); // Note: negated
|
||||
}
|
||||
|
||||
QString PerforceSettings::topLevel() const
|
||||
FilePath PerforceSettings::topLevel() const
|
||||
{
|
||||
return m_topLevel;
|
||||
return FilePath::fromString(m_topLevel);
|
||||
}
|
||||
|
||||
QString PerforceSettings::topLevelSymLinkTarget() const
|
||||
FilePath PerforceSettings::topLevelSymLinkTarget() const
|
||||
{
|
||||
return m_topLevelSymLinkTarget;
|
||||
return FilePath::fromString(m_topLevelSymLinkTarget);
|
||||
}
|
||||
|
||||
void PerforceSettings::setTopLevel(const QString &t)
|
||||
@@ -252,10 +252,10 @@ PerforceSettingsPage::PerforceSettingsPage(PerforceSettings *settings)
|
||||
checker->deleteLater();
|
||||
});
|
||||
connect(checker, &PerforceChecker::succeeded, errorLabel,
|
||||
[errorLabel, testButton, checker](const QString &repo) {
|
||||
[errorLabel, testButton, checker](const FilePath &repo) {
|
||||
errorLabel->setStyleSheet({});
|
||||
errorLabel->setText(PerforceSettings::tr("Test succeeded (%1).")
|
||||
.arg(QDir::toNativeSeparators(repo)));
|
||||
.arg(repo.toUserOutput()));
|
||||
testButton->setEnabled(true);
|
||||
checker->deleteLater();
|
||||
});
|
||||
|
||||
@@ -69,8 +69,8 @@ public:
|
||||
int longTimeOutS() const { return timeOutS.value() * 10; }
|
||||
int timeOutMS() const { return timeOutS.value() * 1000; }
|
||||
|
||||
QString topLevel() const;
|
||||
QString topLevelSymLinkTarget() const;
|
||||
Utils::FilePath topLevel() const;
|
||||
Utils::FilePath topLevelSymLinkTarget() const;
|
||||
|
||||
void setTopLevel(const QString &);
|
||||
|
||||
|
||||
@@ -3867,10 +3867,9 @@ void ProjectExplorerPluginPrivate::deleteFile()
|
||||
folderNode->deleteFiles({filePath});
|
||||
|
||||
FileChangeBlocker changeGuard(currentNode->filePath());
|
||||
if (IVersionControl *vc =
|
||||
VcsManager::findVersionControlForDirectory(filePath.absolutePath().toString())) {
|
||||
if (IVersionControl *vc = VcsManager::findVersionControlForDirectory(filePath.absolutePath()))
|
||||
vc->vcsDelete(filePath);
|
||||
}
|
||||
|
||||
if (filePath.exists()) {
|
||||
if (!filePath.removeFile())
|
||||
QMessageBox::warning(ICore::dialogParent(), tr("Deleting File Failed"),
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -735,7 +736,7 @@ bool FlatModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
|
||||
if (it != vcsHash.constEnd())
|
||||
return it.value();
|
||||
VcsInfo vcsInfo;
|
||||
vcsInfo.vcs = Core::VcsManager::findVersionControlForDirectory(dir, &vcsInfo.repoDir);
|
||||
vcsInfo.vcs = VcsManager::findVersionControlForDirectory(FilePath::fromString(dir), &vcsInfo.repoDir);
|
||||
vcsHash.insert(dir, vcsInfo);
|
||||
return vcsInfo;
|
||||
};
|
||||
@@ -750,8 +751,7 @@ bool FlatModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
|
||||
switch (dlg.dropAction()) {
|
||||
case DropAction::CopyWithFiles: {
|
||||
FilePaths filesToAdd;
|
||||
Core::IVersionControl * const vcs = Core::VcsManager::findVersionControlForDirectory(
|
||||
targetDir.toString());
|
||||
IVersionControl * const vcs = VcsManager::findVersionControlForDirectory(targetDir);
|
||||
const bool addToVcs = vcs && vcs->supportsOperation(Core::IVersionControl::AddOperation);
|
||||
for (const FilePath &sourceFile : sourceFiles) {
|
||||
const FilePath targetFile = targetFilePath(sourceFile);
|
||||
|
||||
@@ -1000,10 +1000,10 @@ QString ContainerNode::displayName() const
|
||||
{
|
||||
QString name = m_project->displayName();
|
||||
|
||||
const QFileInfo fi = m_project->projectFilePath().toFileInfo();
|
||||
const QString dir = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
|
||||
const FilePath fp = m_project->projectFilePath();
|
||||
const FilePath dir = fp.isDir() ? fp.absoluteFilePath() : fp.absolutePath();
|
||||
if (Core::IVersionControl *vc = Core::VcsManager::findVersionControlForDirectory(dir)) {
|
||||
QString vcsTopic = vc->vcsTopic(FilePath::fromString(dir));
|
||||
QString vcsTopic = vc->vcsTopic(dir);
|
||||
if (!vcsTopic.isEmpty())
|
||||
name += " [" + vcsTopic + ']';
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ void ProjectTree::updateExternalFileWarning()
|
||||
return;
|
||||
// External file. Test if it under the same VCS
|
||||
QString topLevel;
|
||||
if (Core::VcsManager::findVersionControlForDirectory(projectDir.toString(), &topLevel)
|
||||
if (Core::VcsManager::findVersionControlForDirectory(projectDir, &topLevel)
|
||||
&& fileName.isChildOf(FilePath::fromString(topLevel))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -376,7 +376,8 @@ void ProjectWizardPage::initializeVersionControls()
|
||||
|
||||
QStringList versionControlChoices = QStringList(tr("<None>"));
|
||||
if (!m_commonDirectory.isEmpty()) {
|
||||
IVersionControl *managingControl = VcsManager::findVersionControlForDirectory(m_commonDirectory);
|
||||
IVersionControl *managingControl =
|
||||
VcsManager::findVersionControlForDirectory(FilePath::fromString(m_commonDirectory));
|
||||
if (managingControl) {
|
||||
// Under VCS
|
||||
if (managingControl->supportsOperation(IVersionControl::AddOperation)) {
|
||||
|
||||
@@ -45,7 +45,7 @@ bool VcsAnnotateTaskHandler::canHandle(const Task &task) const
|
||||
QFileInfo fi(task.file.toFileInfo());
|
||||
if (!fi.exists() || !fi.isFile() || !fi.isReadable())
|
||||
return false;
|
||||
IVersionControl *vc = VcsManager::findVersionControlForDirectory(fi.absolutePath());
|
||||
IVersionControl *vc = VcsManager::findVersionControlForDirectory(task.file.absolutePath());
|
||||
if (!vc)
|
||||
return false;
|
||||
return vc->supportsOperation(IVersionControl::AnnotateOperation);
|
||||
@@ -53,11 +53,10 @@ bool VcsAnnotateTaskHandler::canHandle(const Task &task) const
|
||||
|
||||
void VcsAnnotateTaskHandler::handle(const Task &task)
|
||||
{
|
||||
QFileInfo fi(task.file.toFileInfo());
|
||||
IVersionControl *vc = VcsManager::findVersionControlForDirectory(fi.absolutePath());
|
||||
IVersionControl *vc = VcsManager::findVersionControlForDirectory(task.file.absolutePath());
|
||||
QTC_ASSERT(vc, return);
|
||||
QTC_ASSERT(vc->supportsOperation(IVersionControl::AnnotateOperation), return);
|
||||
vc->vcsAnnotate(FilePath::fromString(fi.absoluteFilePath()), task.movedLine);
|
||||
vc->vcsAnnotate(task.file.absoluteFilePath(), task.movedLine);
|
||||
}
|
||||
|
||||
QAction *VcsAnnotateTaskHandler::createAction(QObject *parent) const
|
||||
|
||||
@@ -352,7 +352,7 @@ bool QbsBuildSystem::ensureWriteableQbsFile(const QString &file)
|
||||
if (!fi.isWritable()) {
|
||||
// Try via vcs manager
|
||||
IVersionControl *versionControl =
|
||||
VcsManager::findVersionControlForDirectory(fi.absolutePath());
|
||||
VcsManager::findVersionControlForDirectory(FilePath::fromString(fi.absolutePath()));
|
||||
if (!versionControl || !versionControl->vcsOpen(FilePath::fromString(file))) {
|
||||
bool makeWritable = QFile::setPermissions(file, fi.permissions() | QFile::WriteUser);
|
||||
if (!makeWritable) {
|
||||
|
||||
@@ -745,7 +745,8 @@ bool QmakePriFile::ensureWriteableProFile(const QString &file)
|
||||
QFileInfo fi(file);
|
||||
if (!fi.isWritable()) {
|
||||
// Try via vcs manager
|
||||
Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(fi.absolutePath());
|
||||
Core::IVersionControl *versionControl =
|
||||
Core::VcsManager::findVersionControlForDirectory(FilePath::fromString(fi.absolutePath()));
|
||||
if (!versionControl || !versionControl->vcsOpen(FilePath::fromString(file))) {
|
||||
bool makeWritable = QFile::setPermissions(file, fi.permissions() | QFile::WriteUser);
|
||||
if (!makeWritable) {
|
||||
|
||||
@@ -309,7 +309,8 @@ bool DocumentManager::createFile(const QString &filePath, const QString &content
|
||||
|
||||
void DocumentManager::addFileToVersionControl(const QString &directoryPath, const QString &newFilePath)
|
||||
{
|
||||
Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(directoryPath);
|
||||
Core::IVersionControl *versionControl =
|
||||
Core::VcsManager::findVersionControlForDirectory(FilePath::fromString(directoryPath));
|
||||
if (versionControl && versionControl->supportsOperation(Core::IVersionControl::AddOperation)) {
|
||||
const QMessageBox::StandardButton button
|
||||
= QMessageBox::question(Core::ICore::dialogParent(),
|
||||
|
||||
@@ -216,7 +216,8 @@ public:
|
||||
currentFile->appendIndentRange(Range(start, end + 1));
|
||||
currentFile->apply();
|
||||
|
||||
Core::IVersionControl *versionControl = Core::VcsManager::findVersionControlForDirectory(path);
|
||||
Core::IVersionControl *versionControl =
|
||||
Core::VcsManager::findVersionControlForDirectory(FilePath::fromString(path));
|
||||
if (versionControl
|
||||
&& versionControl->supportsOperation(Core::IVersionControl::AddOperation)) {
|
||||
const QMessageBox::StandardButton button = QMessageBox::question(
|
||||
|
||||
@@ -78,7 +78,7 @@ SubversionClient::SubversionClient(SubversionSettings *settings) : VcsBaseClient
|
||||
});
|
||||
}
|
||||
|
||||
bool SubversionClient::doCommit(const QString &repositoryRoot,
|
||||
bool SubversionClient::doCommit(const FilePath &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions) const
|
||||
@@ -97,7 +97,7 @@ bool SubversionClient::doCommit(const QString &repositoryRoot,
|
||||
return proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
}
|
||||
|
||||
void SubversionClient::commit(const QString &repositoryRoot,
|
||||
void SubversionClient::commit(const FilePath &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions)
|
||||
@@ -140,7 +140,7 @@ QStringList SubversionClient::addAuthenticationOptions(const SubversionSettings
|
||||
return rc;
|
||||
}
|
||||
|
||||
QString SubversionClient::synchronousTopic(const QString &repository) const
|
||||
QString SubversionClient::synchronousTopic(const FilePath &repository) const
|
||||
{
|
||||
QStringList args;
|
||||
|
||||
@@ -278,7 +278,7 @@ SubversionDiffEditorController *SubversionClient::findOrCreateDiffEditor(const Q
|
||||
return controller;
|
||||
}
|
||||
|
||||
void SubversionClient::diff(const QString &workingDirectory, const QStringList &files, const QStringList &extraOptions)
|
||||
void SubversionClient::diff(const FilePath &workingDirectory, const QStringList &files, const QStringList &extraOptions)
|
||||
{
|
||||
Q_UNUSED(extraOptions)
|
||||
|
||||
@@ -287,13 +287,13 @@ void SubversionClient::diff(const QString &workingDirectory, const QStringList &
|
||||
+ QLatin1String(".Diff.") + VcsBaseEditor::getTitleId(workingDirectory, files);
|
||||
const QString title = vcsEditorTitle(vcsCmdString, documentId);
|
||||
|
||||
SubversionDiffEditorController *controller = findOrCreateDiffEditor(documentId, workingDirectory, title,
|
||||
workingDirectory);
|
||||
SubversionDiffEditorController *controller =
|
||||
findOrCreateDiffEditor(documentId, workingDirectory.toString(), title, workingDirectory.toString());
|
||||
controller->setFilesList(files);
|
||||
controller->requestReload();
|
||||
}
|
||||
|
||||
void SubversionClient::log(const QString &workingDir,
|
||||
void SubversionClient::log(const FilePath &workingDir,
|
||||
const QStringList &files,
|
||||
const QStringList &extraOptions,
|
||||
bool enableAnnotationContextMenu)
|
||||
@@ -310,15 +310,16 @@ void SubversionClient::log(const QString &workingDir,
|
||||
VcsBaseClient::log(workingDir, escapeFiles(files), svnExtraOptions, enableAnnotationContextMenu);
|
||||
}
|
||||
|
||||
void SubversionClient::describe(const QString &workingDirectory, int changeNumber, const QString &title)
|
||||
void SubversionClient::describe(const FilePath &workingDirectory, int changeNumber, const QString &title)
|
||||
{
|
||||
const QString documentId = QLatin1String(Constants::SUBVERSION_PLUGIN)
|
||||
+ QLatin1String(".Describe.") + VcsBaseEditor::editorTag(DiffOutput,
|
||||
workingDirectory,
|
||||
workingDirectory.toString(),
|
||||
QStringList(),
|
||||
QString::number(changeNumber));
|
||||
|
||||
SubversionDiffEditorController *controller = findOrCreateDiffEditor(documentId, workingDirectory, title, workingDirectory);
|
||||
SubversionDiffEditorController *controller =
|
||||
findOrCreateDiffEditor(documentId, workingDirectory.toString(), title, workingDirectory.toString());
|
||||
controller->setChangeNumber(changeNumber);
|
||||
controller->requestReload();
|
||||
}
|
||||
|
||||
@@ -44,29 +44,30 @@ class SubversionClient : public VcsBase::VcsBaseClient
|
||||
public:
|
||||
SubversionClient(SubversionSettings *settings);
|
||||
|
||||
bool doCommit(const QString &repositoryRoot,
|
||||
bool doCommit(const Utils::FilePath &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions = QStringList()) const;
|
||||
void commit(const QString &repositoryRoot,
|
||||
const QStringList &extraOptions = {}) const;
|
||||
void commit(const Utils::FilePath &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions = QStringList()) override;
|
||||
const QStringList &extraOptions = {}) override;
|
||||
|
||||
void diff(const QString &workingDirectory, const QStringList &files,
|
||||
void diff(const Utils::FilePath &workingDirectory,
|
||||
const QStringList &files,
|
||||
const QStringList &extraOptions) override;
|
||||
|
||||
void log(const QString &workingDir,
|
||||
const QStringList &files = QStringList(),
|
||||
const QStringList &extraOptions = QStringList(),
|
||||
void log(const Utils::FilePath &workingDir,
|
||||
const QStringList &files = {},
|
||||
const QStringList &extraOptions = {},
|
||||
bool enableAnnotationContextMenu = false) override;
|
||||
|
||||
void describe(const QString &workingDirectory, int changeNumber, const QString &title);
|
||||
void describe(const Utils::FilePath &workingDirectory, int changeNumber, const QString &title);
|
||||
|
||||
// Add authorization options to the command line arguments.
|
||||
static QStringList addAuthenticationOptions(const SubversionSettings &settings);
|
||||
|
||||
QString synchronousTopic(const QString &repository) const;
|
||||
QString synchronousTopic(const Utils::FilePath &repository) const;
|
||||
|
||||
static QString escapeFile(const QString &file);
|
||||
static QStringList escapeFiles(const QStringList &files);
|
||||
|
||||
@@ -235,20 +235,20 @@ public:
|
||||
SubversionSubmitEditor *openSubversionSubmitEditor(const QString &fileName);
|
||||
|
||||
// IVersionControl
|
||||
bool vcsAdd(const QString &workingDir, const QString &fileName);
|
||||
bool vcsDelete(const QString &workingDir, const QString &fileName);
|
||||
bool vcsMove(const QString &workingDir, const QString &from, const QString &to);
|
||||
bool vcsCheckout(const QString &directory, const QByteArray &url);
|
||||
bool vcsAdd(const FilePath &workingDir, const QString &fileName);
|
||||
bool vcsDelete(const FilePath &workingDir, const QString &fileName);
|
||||
bool vcsMove(const FilePath &workingDir, const QString &from, const QString &to);
|
||||
bool vcsCheckout(const FilePath &directory, const QByteArray &url);
|
||||
|
||||
static SubversionPluginPrivate *instance();
|
||||
|
||||
QString monitorFile(const QString &repository) const;
|
||||
QString synchronousTopic(const QString &repository) const;
|
||||
SubversionResponse runSvn(const QString &workingDir,
|
||||
QString monitorFile(const FilePath &repository) const;
|
||||
QString synchronousTopic(const FilePath &repository) const;
|
||||
SubversionResponse runSvn(const FilePath &workingDir,
|
||||
const QStringList &arguments, int timeOutS,
|
||||
unsigned flags, QTextCodec *outputCodec = nullptr) const;
|
||||
void vcsAnnotateHelper(const QString &workingDir, const QString &file,
|
||||
const QString &revision = QString(), int lineNumber = -1);
|
||||
void vcsAnnotateHelper(const FilePath &workingDir, const QString &file,
|
||||
const QString &revision = {}, int lineNumber = -1);
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePluginPrivate::ActionState) override;
|
||||
@@ -282,20 +282,20 @@ private:
|
||||
Utils::Id id, const QString &source,
|
||||
QTextCodec *codec);
|
||||
|
||||
void filelog(const QString &workingDir,
|
||||
const QString &file = QString(),
|
||||
void filelog(const FilePath &workingDir,
|
||||
const QString &file = {},
|
||||
bool enableAnnotationContextMenu = false);
|
||||
void svnStatus(const QString &workingDir, const QString &relativePath = QString());
|
||||
void svnUpdate(const QString &workingDir, const QString &relativePath = QString());
|
||||
void svnStatus(const FilePath &workingDir, const QString &relativePath = {});
|
||||
void svnUpdate(const FilePath &workingDir, const QString &relativePath = {});
|
||||
bool checkSVNSubDir(const QDir &directory) const;
|
||||
void startCommit(const QString &workingDir, const QStringList &files = QStringList());
|
||||
void startCommit(const FilePath &workingDir, const QStringList &files = {});
|
||||
|
||||
const QStringList m_svnDirectories;
|
||||
|
||||
SubversionSettings m_settings;
|
||||
SubversionClient *m_client = nullptr;
|
||||
QString m_commitMessageFileName;
|
||||
QString m_commitRepository;
|
||||
FilePath m_commitRepository;
|
||||
|
||||
Core::CommandLocator *m_commandLocator = nullptr;
|
||||
Utils::ParameterAction *m_addAction = nullptr;
|
||||
@@ -690,7 +690,7 @@ void SubversionPluginPrivate::revertAll()
|
||||
QStringList args;
|
||||
args << QLatin1String("revert");
|
||||
args << SubversionClient::addAuthenticationOptions(m_settings);
|
||||
args << QLatin1String("--recursive") << state.topLevel();
|
||||
args << QLatin1String("--recursive") << state.topLevel().toString();
|
||||
const SubversionResponse revertResponse
|
||||
= runSvn(state.topLevel(), args, m_settings.timeout.value(),
|
||||
VcsCommand::SshPasswordPrompt | VcsCommand::ShowStdOut);
|
||||
@@ -781,7 +781,7 @@ void SubversionPluginPrivate::startCommitProject()
|
||||
/* Start commit of files of a single repository by displaying
|
||||
* template and files in a submit editor. On closing, the real
|
||||
* commit will start. */
|
||||
void SubversionPluginPrivate::startCommit(const QString &workingDir, const QStringList &files)
|
||||
void SubversionPluginPrivate::startCommit(const FilePath &workingDir, const QStringList &files)
|
||||
{
|
||||
if (!promptBeforeCommit())
|
||||
return;
|
||||
@@ -869,7 +869,7 @@ void SubversionPluginPrivate::updateRepository()
|
||||
svnUpdate(state.topLevel());
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::svnStatus(const QString &workingDir, const QString &relativePath)
|
||||
void SubversionPluginPrivate::svnStatus(const FilePath &workingDir, const QString &relativePath)
|
||||
{
|
||||
const VcsBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return);
|
||||
@@ -877,15 +877,15 @@ void SubversionPluginPrivate::svnStatus(const QString &workingDir, const QString
|
||||
args << SubversionClient::addAuthenticationOptions(m_settings);
|
||||
if (!relativePath.isEmpty())
|
||||
args.append(SubversionClient::escapeFile(relativePath));
|
||||
VcsOutputWindow::setRepository(workingDir);
|
||||
VcsOutputWindow::setRepository(workingDir.toString());
|
||||
runSvn(workingDir, args, m_settings.timeout.value(),
|
||||
VcsCommand::ShowStdOut | VcsCommand::ShowSuccessMessage);
|
||||
VcsOutputWindow::clearRepository();
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::filelog(const QString &workingDir,
|
||||
const QString &file,
|
||||
bool enableAnnotationContextMenu)
|
||||
void SubversionPluginPrivate::filelog(const FilePath &workingDir,
|
||||
const QString &file,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
m_client->log(workingDir, QStringList(file), QStringList(), enableAnnotationContextMenu);
|
||||
}
|
||||
@@ -897,7 +897,7 @@ void SubversionPluginPrivate::updateProject()
|
||||
svnUpdate(state.currentProjectTopLevel(), state.relativeCurrentProject());
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::svnUpdate(const QString &workingDir, const QString &relativePath)
|
||||
void SubversionPluginPrivate::svnUpdate(const FilePath &workingDir, const QString &relativePath)
|
||||
{
|
||||
QStringList args(QLatin1String("update"));
|
||||
args << SubversionClient::addAuthenticationOptions(m_settings);
|
||||
@@ -918,7 +918,7 @@ void SubversionPluginPrivate::annotateCurrentFile()
|
||||
vcsAnnotateHelper(state.currentFileTopLevel(), state.relativeCurrentFile());
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::vcsAnnotateHelper(const QString &workingDir, const QString &file,
|
||||
void SubversionPluginPrivate::vcsAnnotateHelper(const FilePath &workingDir, const QString &file,
|
||||
const QString &revision /* = QString() */,
|
||||
int lineNumber /* = -1 */)
|
||||
{
|
||||
@@ -947,7 +947,7 @@ void SubversionPluginPrivate::vcsAnnotateHelper(const QString &workingDir, const
|
||||
// Determine id
|
||||
const QStringList files = QStringList(file);
|
||||
const QString id = VcsBaseEditor::getTitleId(workingDir, files, revision);
|
||||
const QString tag = VcsBaseEditor::editorTag(AnnotateOutput, workingDir, files);
|
||||
const QString tag = VcsBaseEditor::editorTag(AnnotateOutput, workingDir.toString(), files);
|
||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
||||
editor->document()->setContents(response.stdOut.toUtf8());
|
||||
VcsBaseEditor::gotoLineOfEditor(editor, lineNumber);
|
||||
@@ -987,7 +987,7 @@ void SubversionPluginPrivate::vcsDescribe(const FilePath &source, const QString
|
||||
|
||||
const QString title = QString::fromLatin1("svn describe %1#%2").arg(fi.fileName(), changeNr);
|
||||
|
||||
m_client->describe(topLevel.toString(), number, title);
|
||||
m_client->describe(topLevel, number, title);
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::slotDescribe()
|
||||
@@ -1004,7 +1004,7 @@ void SubversionPluginPrivate::slotDescribe()
|
||||
return;
|
||||
|
||||
const int revision = inputDialog.intValue();
|
||||
vcsDescribe(FilePath::fromString(state.topLevel()), QString::number(revision));
|
||||
vcsDescribe(state.topLevel(), QString::number(revision));
|
||||
}
|
||||
|
||||
void SubversionPluginPrivate::commitFromEditor()
|
||||
@@ -1014,10 +1014,10 @@ void SubversionPluginPrivate::commitFromEditor()
|
||||
EditorManager::closeDocuments({submitEditor()->document()});
|
||||
}
|
||||
|
||||
SubversionResponse SubversionPluginPrivate::runSvn(const QString &workingDir,
|
||||
const QStringList &arguments,
|
||||
int timeOutS, unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
SubversionResponse SubversionPluginPrivate::runSvn(const FilePath &workingDir,
|
||||
const QStringList &arguments,
|
||||
int timeOutS, unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
{
|
||||
SubversionResponse response;
|
||||
if (m_settings.binaryPath.value().isEmpty()) {
|
||||
@@ -1067,10 +1067,10 @@ SubversionPluginPrivate *SubversionPluginPrivate::instance()
|
||||
return dd;
|
||||
}
|
||||
|
||||
QString SubversionPluginPrivate::monitorFile(const QString &repository) const
|
||||
QString SubversionPluginPrivate::monitorFile(const FilePath &repository) const
|
||||
{
|
||||
QTC_ASSERT(!repository.isEmpty(), return QString());
|
||||
QDir repoDir(repository);
|
||||
QDir repoDir(repository.toString());
|
||||
foreach (const QString &svnDir, m_svnDirectories) {
|
||||
if (repoDir.exists(svnDir)) {
|
||||
QFileInfo fi(repoDir.absoluteFilePath(svnDir + QLatin1String("/wc.db")));
|
||||
@@ -1081,12 +1081,12 @@ QString SubversionPluginPrivate::monitorFile(const QString &repository) const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString SubversionPluginPrivate::synchronousTopic(const QString &repository) const
|
||||
QString SubversionPluginPrivate::synchronousTopic(const FilePath &repository) const
|
||||
{
|
||||
return m_client->synchronousTopic(repository);
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsAdd(const QString &workingDir, const QString &rawFileName)
|
||||
bool SubversionPluginPrivate::vcsAdd(const FilePath &workingDir, const QString &rawFileName)
|
||||
{
|
||||
const QString file = QDir::toNativeSeparators(SubversionClient::escapeFile(rawFileName));
|
||||
QStringList args;
|
||||
@@ -1099,7 +1099,7 @@ bool SubversionPluginPrivate::vcsAdd(const QString &workingDir, const QString &r
|
||||
return !response.error;
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsDelete(const QString &workingDir, const QString &rawFileName)
|
||||
bool SubversionPluginPrivate::vcsDelete(const FilePath &workingDir, const QString &rawFileName)
|
||||
{
|
||||
const QString file = QDir::toNativeSeparators(SubversionClient::escapeFile(rawFileName));
|
||||
|
||||
@@ -1114,7 +1114,7 @@ bool SubversionPluginPrivate::vcsDelete(const QString &workingDir, const QString
|
||||
return !response.error;
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsMove(const QString &workingDir, const QString &from, const QString &to)
|
||||
bool SubversionPluginPrivate::vcsMove(const FilePath &workingDir, const QString &from, const QString &to)
|
||||
{
|
||||
QStringList args(QLatin1String("move"));
|
||||
args << SubversionClient::addAuthenticationOptions(m_settings);
|
||||
@@ -1127,7 +1127,7 @@ bool SubversionPluginPrivate::vcsMove(const QString &workingDir, const QString &
|
||||
return !response.error;
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsCheckout(const QString &directory, const QByteArray &url)
|
||||
bool SubversionPluginPrivate::vcsCheckout(const FilePath &directory, const QByteArray &url)
|
||||
{
|
||||
QUrl tempUrl = QUrl::fromEncoded(url);
|
||||
QString username = tempUrl.userName();
|
||||
@@ -1147,7 +1147,7 @@ bool SubversionPluginPrivate::vcsCheckout(const QString &directory, const QByteA
|
||||
args << QLatin1String("--password") << password;
|
||||
}
|
||||
|
||||
args << QLatin1String(tempUrl.toEncoded()) << directory;
|
||||
args << QLatin1String(tempUrl.toEncoded()) << directory.toString();
|
||||
|
||||
const SubversionResponse response
|
||||
= runSvn(directory, args, 10 * m_settings.timeout.value(), VcsCommand::SshPasswordPrompt);
|
||||
@@ -1184,8 +1184,7 @@ bool SubversionPluginPrivate::managesFile(const FilePath &workingDirectory, cons
|
||||
args << QLatin1String("status");
|
||||
args << SubversionClient::addAuthenticationOptions(m_settings)
|
||||
<< QDir::toNativeSeparators(SubversionClient::escapeFile(fileName));
|
||||
SubversionResponse response
|
||||
= runSvn(workingDirectory.toString(), args, m_settings.timeout.value(), 0);
|
||||
SubversionResponse response = runSvn(workingDirectory, args, m_settings.timeout.value(), 0);
|
||||
return response.stdOut.isEmpty() || response.stdOut.at(0) != QLatin1Char('?');
|
||||
}
|
||||
|
||||
@@ -1254,21 +1253,19 @@ bool SubversionPluginPrivate::vcsOpen(const FilePath & /* filePath */)
|
||||
|
||||
bool SubversionPluginPrivate::vcsAdd(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsAdd(fi.absolutePath(), fi.fileName());
|
||||
return vcsAdd(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsDelete(const FilePath &filePath)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
return vcsDelete(fi.absolutePath(), fi.fileName());
|
||||
return vcsDelete(filePath.parentDir(), filePath.fileName());
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsMove(const FilePath &from, const FilePath &to)
|
||||
{
|
||||
const QFileInfo fromInfo = from.toFileInfo();
|
||||
const QFileInfo toInfo = to.toFileInfo();
|
||||
return vcsMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||
return vcsMove(from.parentDir(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
|
||||
}
|
||||
|
||||
bool SubversionPluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
@@ -1278,8 +1275,7 @@ bool SubversionPluginPrivate::vcsCreateRepository(const FilePath &)
|
||||
|
||||
void SubversionPluginPrivate::vcsAnnotate(const FilePath &filePath, int line)
|
||||
{
|
||||
const QFileInfo fi = filePath.toFileInfo();
|
||||
vcsAnnotateHelper(fi.absolutePath(), fi.fileName(), QString(), line);
|
||||
vcsAnnotateHelper(filePath.parentDir(), filePath.fileName(), QString(), line);
|
||||
}
|
||||
|
||||
Core::ShellCommand *SubversionPluginPrivate::createInitialCheckoutCommand(const QString &url,
|
||||
@@ -1293,19 +1289,19 @@ Core::ShellCommand *SubversionPluginPrivate::createInitialCheckoutCommand(const
|
||||
args << QLatin1String(Subversion::Constants::NON_INTERACTIVE_OPTION);
|
||||
args << extraArgs << url << localName;
|
||||
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory.toString(), m_client->processEnvironment());
|
||||
auto command = new VcsBase::VcsCommand(baseDirectory, m_client->processEnvironment());
|
||||
command->addJob({m_settings.binaryPath.filePath(), args}, -1);
|
||||
return command;
|
||||
}
|
||||
|
||||
FilePath SubversionTopicCache::trackFile(const FilePath &repository)
|
||||
{
|
||||
return FilePath::fromString(m_plugin->monitorFile(repository.toString()));
|
||||
return FilePath::fromString(m_plugin->monitorFile(repository));
|
||||
}
|
||||
|
||||
QString SubversionTopicCache::refreshTopic(const FilePath &repository)
|
||||
{
|
||||
return m_plugin->synchronousTopic(repository.toString());
|
||||
return m_plugin->synchronousTopic(repository);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ FilePath VcsBaseClientImpl::vcsBinary() const
|
||||
return m_baseSettings->binaryPath.filePath();
|
||||
}
|
||||
|
||||
VcsCommand *VcsBaseClientImpl::createCommand(const QString &workingDirectory,
|
||||
VcsCommand *VcsBaseClientImpl::createCommand(const FilePath &workingDirectory,
|
||||
VcsBaseEditorWidget *editor,
|
||||
JobOutputBindMode mode) const
|
||||
{
|
||||
@@ -145,21 +145,14 @@ QString VcsBaseClientImpl::stripLastNewline(const QString &in)
|
||||
}
|
||||
|
||||
void VcsBaseClientImpl::vcsFullySynchronousExec(QtcProcess &proc,
|
||||
const QString &workingDir, const QStringList &args,
|
||||
const FilePath &workingDir, const QStringList &args,
|
||||
unsigned flags, int timeoutS, QTextCodec *codec) const
|
||||
{
|
||||
vcsFullySynchronousExec(proc, workingDir, {vcsBinary(), args}, flags, timeoutS, codec);
|
||||
}
|
||||
|
||||
void VcsBaseClientImpl::vcsFullySynchronousExec(QtcProcess &proc,
|
||||
const FilePath &workingDir, const QStringList &args,
|
||||
unsigned flags, int timeoutS, QTextCodec *codec) const
|
||||
{
|
||||
vcsFullySynchronousExec(proc, workingDir.toString(), {vcsBinary(), args}, flags, timeoutS, codec);
|
||||
}
|
||||
|
||||
void VcsBaseClientImpl::vcsFullySynchronousExec(QtcProcess &proc,
|
||||
const QString &workingDir, const CommandLine &cmdLine,
|
||||
const FilePath &workingDir, const CommandLine &cmdLine,
|
||||
unsigned flags, int timeoutS, QTextCodec *codec) const
|
||||
{
|
||||
VcsCommand command(workingDir, processEnvironment());
|
||||
@@ -175,7 +168,7 @@ void VcsBaseClientImpl::resetCachedVcsInfo(const FilePath &workingDir)
|
||||
Core::VcsManager::resetVersionControlForDirectory(workingDir);
|
||||
}
|
||||
|
||||
void VcsBaseClientImpl::annotateRevisionRequested(const QString &workingDirectory,
|
||||
void VcsBaseClientImpl::annotateRevisionRequested(const FilePath &workingDirectory,
|
||||
const QString &file, const QString &change,
|
||||
int line)
|
||||
{
|
||||
@@ -188,7 +181,7 @@ void VcsBaseClientImpl::annotateRevisionRequested(const QString &workingDirector
|
||||
annotate(workingDirectory, file, changeCopy, line);
|
||||
}
|
||||
|
||||
VcsCommand *VcsBaseClientImpl::vcsExec(const QString &workingDirectory, const QStringList &arguments,
|
||||
VcsCommand *VcsBaseClientImpl::vcsExec(const FilePath &workingDirectory, const QStringList &arguments,
|
||||
VcsBaseEditorWidget *editor, bool useOutputToWindow,
|
||||
unsigned additionalFlags, const QVariant &cookie) const
|
||||
{
|
||||
@@ -202,7 +195,8 @@ VcsCommand *VcsBaseClientImpl::vcsExec(const QString &workingDirectory, const QS
|
||||
return command;
|
||||
}
|
||||
|
||||
void VcsBaseClientImpl::vcsSynchronousExec(QtcProcess &proc, const QString &workingDir,
|
||||
void VcsBaseClientImpl::vcsSynchronousExec(QtcProcess &proc,
|
||||
const FilePath &workingDir,
|
||||
const QStringList &args,
|
||||
unsigned flags,
|
||||
QTextCodec *outputCodec) const
|
||||
@@ -292,17 +286,19 @@ bool VcsBaseClient::synchronousClone(const FilePath &workingDir,
|
||||
return proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
}
|
||||
|
||||
bool VcsBaseClient::synchronousAdd(const QString &workingDir, const QString &filename,
|
||||
bool VcsBaseClient::synchronousAdd(const FilePath &workingDir,
|
||||
const QString &relFileName,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args;
|
||||
args << vcsCommandString(AddCommand) << extraOptions << filename;
|
||||
args << vcsCommandString(AddCommand) << extraOptions << relFileName;
|
||||
QtcProcess proc;
|
||||
vcsFullySynchronousExec(proc, workingDir, args);
|
||||
return proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
}
|
||||
|
||||
bool VcsBaseClient::synchronousRemove(const QString &workingDir, const QString &filename,
|
||||
bool VcsBaseClient::synchronousRemove(const FilePath &workingDir,
|
||||
const QString &filename,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args;
|
||||
@@ -312,8 +308,9 @@ bool VcsBaseClient::synchronousRemove(const QString &workingDir, const QString &
|
||||
return proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
}
|
||||
|
||||
bool VcsBaseClient::synchronousMove(const QString &workingDir,
|
||||
const QString &from, const QString &to,
|
||||
bool VcsBaseClient::synchronousMove(const FilePath &workingDir,
|
||||
const QString &from,
|
||||
const QString &to,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args;
|
||||
@@ -323,7 +320,7 @@ bool VcsBaseClient::synchronousMove(const QString &workingDir,
|
||||
return proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
}
|
||||
|
||||
bool VcsBaseClient::synchronousPull(const QString &workingDir,
|
||||
bool VcsBaseClient::synchronousPull(const FilePath &workingDir,
|
||||
const QString &srcLocation,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
@@ -338,11 +335,11 @@ bool VcsBaseClient::synchronousPull(const QString &workingDir,
|
||||
vcsSynchronousExec(proc, workingDir, args, flags);
|
||||
const bool ok = proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
if (ok)
|
||||
emit changed(QVariant(workingDir));
|
||||
emit changed(QVariant(workingDir.toString()));
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool VcsBaseClient::synchronousPush(const QString &workingDir,
|
||||
bool VcsBaseClient::synchronousPush(const FilePath &workingDir,
|
||||
const QString &dstLocation,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
@@ -359,7 +356,7 @@ bool VcsBaseClient::synchronousPush(const QString &workingDir,
|
||||
}
|
||||
|
||||
VcsBaseEditorWidget *VcsBaseClient::annotate(
|
||||
const QString &workingDir, const QString &file, const QString &revision /* = QString() */,
|
||||
const FilePath &workingDir, const QString &file, const QString &revision /* = QString() */,
|
||||
int lineNumber /* = -1 */, const QStringList &extraOptions)
|
||||
{
|
||||
const QString vcsCmdString = vcsCommandString(AnnotateCommand);
|
||||
@@ -380,7 +377,7 @@ VcsBaseEditorWidget *VcsBaseClient::annotate(
|
||||
return editor;
|
||||
}
|
||||
|
||||
void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
|
||||
void VcsBaseClient::diff(const FilePath &workingDir, const QStringList &files,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
const QString vcsCmdString = vcsCommandString(DiffCommand);
|
||||
@@ -418,10 +415,11 @@ void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
|
||||
: VcsBaseEditor::getCodec(source);
|
||||
VcsCommand *command = createCommand(workingDir, editor);
|
||||
command->setCodec(codec);
|
||||
enqueueJob(command, args, workingDir, exitCodeInterpreter(DiffCommand));
|
||||
enqueueJob(command, args, workingDir.toString(), exitCodeInterpreter(DiffCommand));
|
||||
}
|
||||
|
||||
void VcsBaseClient::log(const QString &workingDir, const QStringList &files,
|
||||
void VcsBaseClient::log(const FilePath &workingDir,
|
||||
const QStringList &files,
|
||||
const QStringList &extraOptions,
|
||||
bool enableAnnotationContextMenu)
|
||||
{
|
||||
@@ -457,7 +455,7 @@ void VcsBaseClient::log(const QString &workingDir, const QStringList &files,
|
||||
enqueueJob(createCommand(workingDir, editor), args);
|
||||
}
|
||||
|
||||
void VcsBaseClient::revertFile(const QString &workingDir,
|
||||
void VcsBaseClient::revertFile(const FilePath &workingDir,
|
||||
const QString &file,
|
||||
const QString &revision,
|
||||
const QStringList &extraOptions)
|
||||
@@ -466,29 +464,31 @@ void VcsBaseClient::revertFile(const QString &workingDir,
|
||||
args << revisionSpec(revision) << extraOptions << file;
|
||||
// Indicate repository change or file list
|
||||
VcsCommand *cmd = createCommand(workingDir);
|
||||
cmd->setCookie(QStringList(workingDir + QLatin1Char('/') + file));
|
||||
cmd->setCookie(QStringList(workingDir.pathAppended(file).toString()));
|
||||
connect(cmd, &VcsCommand::success, this, &VcsBaseClient::changed, Qt::QueuedConnection);
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
|
||||
void VcsBaseClient::revertAll(const QString &workingDir, const QString &revision,
|
||||
void VcsBaseClient::revertAll(const FilePath &workingDir,
|
||||
const QString &revision,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args(vcsCommandString(RevertCommand));
|
||||
args << revisionSpec(revision) << extraOptions;
|
||||
// Indicate repository change or file list
|
||||
VcsCommand *cmd = createCommand(workingDir);
|
||||
cmd->setCookie(QStringList(workingDir));
|
||||
cmd->setCookie(QStringList(workingDir.toString()));
|
||||
connect(cmd, &VcsCommand::success, this, &VcsBaseClient::changed, Qt::QueuedConnection);
|
||||
enqueueJob(createCommand(workingDir), args);
|
||||
}
|
||||
|
||||
void VcsBaseClient::status(const QString &workingDir, const QString &file,
|
||||
void VcsBaseClient::status(const FilePath &workingDir,
|
||||
const QString &file,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args(vcsCommandString(StatusCommand));
|
||||
args << extraOptions << file;
|
||||
VcsOutputWindow::setRepository(workingDir);
|
||||
VcsOutputWindow::setRepository(workingDir.toString());
|
||||
VcsCommand *cmd = createCommand(workingDir, nullptr, VcsWindowOutputBind);
|
||||
connect(cmd, &VcsCommand::finished,
|
||||
VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository,
|
||||
@@ -496,7 +496,7 @@ void VcsBaseClient::status(const QString &workingDir, const QString &file,
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
|
||||
void VcsBaseClient::emitParsedStatus(const QString &repository, const QStringList &extraOptions)
|
||||
void VcsBaseClient::emitParsedStatus(const FilePath &repository, const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args(vcsCommandString(StatusCommand));
|
||||
args << extraOptions;
|
||||
@@ -543,7 +543,8 @@ void VcsBaseClient::setLogConfigCreator(ConfigCreator creator)
|
||||
m_logConfigCreator = std::move(creator);
|
||||
}
|
||||
|
||||
void VcsBaseClient::import(const QString &repositoryRoot, const QStringList &files,
|
||||
void VcsBaseClient::import(const FilePath &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args(vcsCommandString(ImportCommand));
|
||||
@@ -551,7 +552,8 @@ void VcsBaseClient::import(const QString &repositoryRoot, const QStringList &fil
|
||||
enqueueJob(createCommand(repositoryRoot), args);
|
||||
}
|
||||
|
||||
void VcsBaseClient::view(const QString &source, const QString &id,
|
||||
void VcsBaseClient::view(const QString &source,
|
||||
const QString &id,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args;
|
||||
@@ -563,22 +565,22 @@ void VcsBaseClient::view(const QString &source, const QString &id,
|
||||
VcsBaseEditor::getCodec(source), "view", id);
|
||||
|
||||
const QFileInfo fi(source);
|
||||
const QString workingDirPath = fi.isFile() ? fi.absolutePath() : source;
|
||||
const FilePath workingDirPath = FilePath::fromString(fi.isFile() ? fi.absolutePath() : source);
|
||||
enqueueJob(createCommand(workingDirPath, editor), args);
|
||||
}
|
||||
|
||||
void VcsBaseClient::update(const QString &repositoryRoot, const QString &revision,
|
||||
void VcsBaseClient::update(const FilePath &repositoryRoot, const QString &revision,
|
||||
const QStringList &extraOptions)
|
||||
{
|
||||
QStringList args(vcsCommandString(UpdateCommand));
|
||||
args << revisionSpec(revision) << extraOptions;
|
||||
VcsCommand *cmd = createCommand(repositoryRoot);
|
||||
cmd->setCookie(repositoryRoot);
|
||||
cmd->setCookie(repositoryRoot.toString());
|
||||
connect(cmd, &VcsCommand::success, this, &VcsBaseClient::changed, Qt::QueuedConnection);
|
||||
enqueueJob(cmd, args);
|
||||
}
|
||||
|
||||
void VcsBaseClient::commit(const QString &repositoryRoot,
|
||||
void VcsBaseClient::commit(const FilePath &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions)
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue) const;
|
||||
|
||||
VcsCommand *createCommand(const QString &workingDirectory,
|
||||
VcsCommand *createCommand(const Utils::FilePath &workingDirectory,
|
||||
VcsBaseEditorWidget *editor = nullptr,
|
||||
JobOutputBindMode mode = NoOutputBind) const;
|
||||
|
||||
@@ -86,40 +86,38 @@ public:
|
||||
virtual Utils::Environment processEnvironment() const;
|
||||
|
||||
// VCS functionality:
|
||||
virtual VcsBaseEditorWidget *annotate(
|
||||
const QString &workingDir, const QString &file, const QString &revision = QString(),
|
||||
int lineNumber = -1, const QStringList &extraOptions = QStringList()) = 0;
|
||||
virtual VcsBaseEditorWidget *annotate(const Utils::FilePath &workingDir,
|
||||
const QString &file,
|
||||
const QString &revision = {},
|
||||
int lineNumber = -1,
|
||||
const QStringList &extraOptions = {}) = 0;
|
||||
|
||||
static QStringList splitLines(const QString &s);
|
||||
|
||||
static QString stripLastNewline(const QString &in);
|
||||
|
||||
// Fully synchronous VCS execution (QProcess-based)
|
||||
void vcsFullySynchronousExec(Utils::QtcProcess &process,
|
||||
const QString &workingDir, const QStringList &args,
|
||||
unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const;
|
||||
void vcsFullySynchronousExec(Utils::QtcProcess &process,
|
||||
const QString &workingDir, const Utils::CommandLine &cmdLine,
|
||||
unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const;
|
||||
void vcsFullySynchronousExec(Utils::QtcProcess &process,
|
||||
const Utils::FilePath &workingDir, const QStringList &args,
|
||||
unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const;
|
||||
|
||||
void vcsFullySynchronousExec(Utils::QtcProcess &process,
|
||||
const Utils::FilePath &workingDir, const Utils::CommandLine &cmdLine,
|
||||
unsigned flags = 0, int timeoutS = -1, QTextCodec *codec = nullptr) const;
|
||||
|
||||
// Simple helper to execute a single command using createCommand and enqueueJob.
|
||||
VcsCommand *vcsExec(const QString &workingDirectory, const QStringList &arguments,
|
||||
VcsCommand *vcsExec(const Utils::FilePath &workingDirectory, const QStringList &arguments,
|
||||
VcsBaseEditorWidget *editor = nullptr, bool useOutputToWindow = false,
|
||||
unsigned additionalFlags = 0, const QVariant &cookie = QVariant()) const;
|
||||
unsigned additionalFlags = 0, const QVariant &cookie = {}) const;
|
||||
|
||||
protected:
|
||||
void resetCachedVcsInfo(const Utils::FilePath &workingDir);
|
||||
virtual void annotateRevisionRequested(const QString &workingDirectory, const QString &file,
|
||||
virtual void annotateRevisionRequested(const Utils::FilePath &workingDirectory, const QString &file,
|
||||
const QString &change, int line);
|
||||
|
||||
// Synchronous VCS execution using Utils::SynchronousProcess, with
|
||||
// log windows updating (using VcsBasePlugin::runVcs with flags)
|
||||
void vcsSynchronousExec(Utils::QtcProcess &proc,
|
||||
const QString &workingDir,
|
||||
const Utils::FilePath &workingDir,
|
||||
const QStringList &args,
|
||||
unsigned flags = 0,
|
||||
QTextCodec *outputCodec = nullptr) const;
|
||||
@@ -151,43 +149,55 @@ public:
|
||||
const QString &srcLocation,
|
||||
const QString &dstLocation,
|
||||
const QStringList &extraOptions = {});
|
||||
virtual bool synchronousAdd(const QString &workingDir, const QString &fileName,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual bool synchronousRemove(const QString &workingDir, const QString &fileName,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual bool synchronousMove(const QString &workingDir,
|
||||
virtual bool synchronousAdd(const Utils::FilePath &workingDir,
|
||||
const QString &relFileName,
|
||||
const QStringList &extraOptions = {});
|
||||
virtual bool synchronousRemove(const Utils::FilePath &workingDir,
|
||||
const QString &fileName,
|
||||
const QStringList &extraOptions = {});
|
||||
virtual bool synchronousMove(const Utils::FilePath &workingDir,
|
||||
const QString &from, const QString &to,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual bool synchronousPull(const QString &workingDir,
|
||||
const QStringList &extraOptions = {});
|
||||
virtual bool synchronousPull(const Utils::FilePath &workingDir,
|
||||
const QString &srcLocation,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual bool synchronousPush(const QString &workingDir,
|
||||
const QStringList &extraOptions = {});
|
||||
virtual bool synchronousPush(const Utils::FilePath &workingDir,
|
||||
const QString &dstLocation,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
VcsBaseEditorWidget *annotate(
|
||||
const QString &workingDir, const QString &file, const QString &revision = QString(),
|
||||
int lineNumber = -1, const QStringList &extraOptions = QStringList()) override;
|
||||
virtual void diff(const QString &workingDir, const QStringList &files = QStringList(),
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual void log(const QString &workingDir, const QStringList &files = QStringList(),
|
||||
const QStringList &extraOptions = QStringList(),
|
||||
const QStringList &extraOptions = {});
|
||||
VcsBaseEditorWidget *annotate(const Utils::FilePath &workingDir,
|
||||
const QString &file,
|
||||
const QString &revision = {},
|
||||
int lineNumber = -1,
|
||||
const QStringList &extraOptions = {}) override;
|
||||
virtual void diff(const Utils::FilePath &workingDir,
|
||||
const QStringList &files = {},
|
||||
const QStringList &extraOptions = {});
|
||||
virtual void log(const Utils::FilePath &workingDir,
|
||||
const QStringList &files = {},
|
||||
const QStringList &extraOptions = {},
|
||||
bool enableAnnotationContextMenu = false);
|
||||
virtual void status(const QString &workingDir, const QString &file = QString(),
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual void emitParsedStatus(const QString &repository,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual void revertFile(const QString &workingDir, const QString &file,
|
||||
const QString &revision = QString(),
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual void revertAll(const QString &workingDir, const QString &revision = QString(),
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual void import(const QString &repositoryRoot, const QStringList &files,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual void update(const QString &repositoryRoot, const QString &revision = QString(),
|
||||
const QStringList &extraOptions = QStringList());
|
||||
virtual void commit(const QString &repositoryRoot, const QStringList &files,
|
||||
virtual void status(const Utils::FilePath &workingDir,
|
||||
const QString &file = {},
|
||||
const QStringList &extraOptions = {});
|
||||
virtual void emitParsedStatus(const Utils::FilePath &repository,
|
||||
const QStringList &extraOptions = {});
|
||||
virtual void revertFile(const Utils::FilePath &workingDir,
|
||||
const QString &file,
|
||||
const QString &revision = {},
|
||||
const QStringList &extraOptions = {});
|
||||
virtual void revertAll(const Utils::FilePath &workingDir,
|
||||
const QString &revision = {},
|
||||
const QStringList &extraOptions = {});
|
||||
virtual void import(const Utils::FilePath &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QStringList &extraOptions = {});
|
||||
virtual void update(const Utils::FilePath &repositoryRoot,
|
||||
const QString &revision = {},
|
||||
const QStringList &extraOptions = {});
|
||||
virtual void commit(const Utils::FilePath &repositoryRoot,
|
||||
const QStringList &files,
|
||||
const QString &commitMessageFile,
|
||||
const QStringList &extraOptions = QStringList());
|
||||
const QStringList &extraOptions = {});
|
||||
|
||||
virtual Utils::FilePath findTopLevelForFile(const Utils::FilePath &/*file*/) const { return {}; }
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ void VcsBaseDiffEditorController::runCommand(const QList<QStringList> &args, uns
|
||||
// and "Waiting for data..." will be shown.
|
||||
d->cancelReload();
|
||||
|
||||
d->m_command = new VcsCommand(workingDirectory(), d->m_processEnvironment);
|
||||
d->m_command = new VcsCommand(FilePath::fromString(workingDirectory()), d->m_processEnvironment);
|
||||
d->m_command->setDisplayName(d->m_displayName);
|
||||
d->m_command->setCodec(codec ? codec : EditorManager::defaultTextCodec());
|
||||
d->m_commandResultProxy = new VcsCommandResultProxy(d->m_command.data(), d);
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
\sa VcsBase::VcsBaseEditorWidget
|
||||
*/
|
||||
|
||||
using namespace Core;
|
||||
using namespace TextEditor;
|
||||
using namespace Utils;
|
||||
|
||||
@@ -836,14 +837,14 @@ void VcsBaseEditorWidget::setHighlightingEnabled(bool e)
|
||||
dh->setEnabled(e);
|
||||
}
|
||||
|
||||
QString VcsBaseEditorWidget::workingDirectory() const
|
||||
FilePath VcsBaseEditorWidget::workingDirectory() const
|
||||
{
|
||||
return d->m_workingDirectory;
|
||||
return FilePath::fromString(d->m_workingDirectory);
|
||||
}
|
||||
|
||||
void VcsBaseEditorWidget::setWorkingDirectory(const QString &wd)
|
||||
void VcsBaseEditorWidget::setWorkingDirectory(const FilePath &wd)
|
||||
{
|
||||
d->m_workingDirectory = wd;
|
||||
d->m_workingDirectory = wd.toString();
|
||||
}
|
||||
|
||||
QTextCodec *VcsBaseEditorWidget::codec() const
|
||||
@@ -1297,6 +1298,11 @@ QTextCodec *VcsBaseEditor::getCodec(const QString &source)
|
||||
return sys;
|
||||
}
|
||||
|
||||
QTextCodec *VcsBaseEditor::getCodec(const FilePath &workingDirectory, const QStringList &files)
|
||||
{
|
||||
return getCodec(workingDirectory.toString(), files);
|
||||
}
|
||||
|
||||
QTextCodec *VcsBaseEditor::getCodec(const QString &workingDirectory, const QStringList &files)
|
||||
{
|
||||
if (files.empty())
|
||||
@@ -1349,13 +1355,12 @@ bool VcsBaseEditor::gotoLineOfEditor(Core::IEditor *e, int lineNumber)
|
||||
|
||||
// Return source file or directory string depending on parameters
|
||||
// ('git diff XX' -> 'XX' , 'git diff XX file' -> 'XX/file').
|
||||
QString VcsBaseEditor::getSource(const QString &workingDirectory,
|
||||
const QString &fileName)
|
||||
QString VcsBaseEditor::getSource(const FilePath &workingDirectory, const QString &fileName)
|
||||
{
|
||||
if (fileName.isEmpty())
|
||||
return workingDirectory;
|
||||
return workingDirectory.toString();
|
||||
|
||||
QString rc = workingDirectory;
|
||||
QString rc = workingDirectory.toString();
|
||||
const QChar slash = QLatin1Char('/');
|
||||
if (!rc.isEmpty() && !(rc.endsWith(slash) || rc.endsWith(QLatin1Char('\\'))))
|
||||
rc += slash;
|
||||
@@ -1363,15 +1368,14 @@ QString VcsBaseEditor::getSource(const QString &workingDirectory,
|
||||
return rc;
|
||||
}
|
||||
|
||||
QString VcsBaseEditor::getSource(const QString &workingDirectory,
|
||||
const QStringList &fileNames)
|
||||
QString VcsBaseEditor::getSource(const FilePath &workingDirectory, const QStringList &fileNames)
|
||||
{
|
||||
return fileNames.size() == 1 ?
|
||||
getSource(workingDirectory, fileNames.front()) :
|
||||
workingDirectory;
|
||||
return fileNames.size() == 1
|
||||
? getSource(workingDirectory, fileNames.front())
|
||||
: workingDirectory.toString();
|
||||
}
|
||||
|
||||
QString VcsBaseEditor::getTitleId(const QString &workingDirectory,
|
||||
QString VcsBaseEditor::getTitleId(const FilePath &workingDirectory,
|
||||
const QStringList &fileNames,
|
||||
const QString &revision)
|
||||
{
|
||||
@@ -1384,7 +1388,7 @@ QString VcsBaseEditor::getTitleId(const QString &workingDirectory,
|
||||
QString rc;
|
||||
switch (nonEmptyFileNames.size()) {
|
||||
case 0:
|
||||
rc = workingDirectory;
|
||||
rc = workingDirectory.toString();
|
||||
break;
|
||||
case 1:
|
||||
rc = nonEmptyFileNames.front();
|
||||
@@ -1454,13 +1458,14 @@ QString VcsBaseEditorWidget::findDiffFile(const QString &f) const
|
||||
if (sourceFileInfo.isFile())
|
||||
return sourceFileInfo.absoluteFilePath();
|
||||
|
||||
const QString topLevel = Core::VcsManager::findTopLevelForDirectory(sourceDir);
|
||||
const FilePath topLevel =
|
||||
VcsManager::findTopLevelForDirectory(FilePath::fromString(sourceDir));
|
||||
if (topLevel.isEmpty())
|
||||
return QString();
|
||||
|
||||
const QFileInfo topLevelFileInfo(topLevel + slash + f);
|
||||
if (topLevelFileInfo.isFile())
|
||||
return topLevelFileInfo.absoluteFilePath();
|
||||
const FilePath topLevelFile = topLevel.pathAppended(f);
|
||||
if (topLevelFile.isFile())
|
||||
return topLevelFile.absoluteFilePath().toString();
|
||||
}
|
||||
|
||||
// 3) Try working directory
|
||||
@@ -1488,7 +1493,7 @@ void VcsBaseEditorWidget::slotAnnotateRevision()
|
||||
QString workingDirectory = d->m_workingDirectory;
|
||||
if (workingDirectory.isEmpty())
|
||||
workingDirectory = QFileInfo(fileName).absolutePath();
|
||||
emit annotateRevisionRequested(workingDirectory,
|
||||
emit annotateRevisionRequested(FilePath::fromString(workingDirectory),
|
||||
QDir(workingDirectory).relativeFilePath(fileName),
|
||||
a->data().toString(), currentLine);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,8 @@ public:
|
||||
// The codec should be set on editors displaying diff or annotation
|
||||
// output.
|
||||
static QTextCodec *getCodec(const QString &source);
|
||||
static QTextCodec *getCodec(const QString &workingDirectory, const QStringList &files);
|
||||
static QTextCodec *getCodec(const Utils::FilePath &workingDirectory, const QStringList &files);
|
||||
static QTextCodec *getCodec(const QString &workingDirectory, const QStringList &files); // FIXME: Remove
|
||||
|
||||
// Utility to return the widget from the IEditor returned by the editor
|
||||
// manager which is a BaseTextEditor.
|
||||
@@ -111,13 +112,13 @@ public:
|
||||
// Convenience functions to determine the source to pass on to a diff
|
||||
// editor if one has a call consisting of working directory and file arguments.
|
||||
// ('git diff XX' -> 'XX' , 'git diff XX file' -> 'XX/file').
|
||||
static QString getSource(const QString &workingDirectory, const QString &fileName);
|
||||
static QString getSource(const QString &workingDirectory, const QStringList &fileNames);
|
||||
static QString getSource(const Utils::FilePath &workingDirectory, const QString &fileName);
|
||||
static QString getSource(const Utils::FilePath &workingDirectory, const QStringList &fileNames);
|
||||
// Convenience functions to determine an title/id to identify the editor
|
||||
// from the arguments (','-joined arguments or directory) + revision.
|
||||
static QString getTitleId(const QString &workingDirectory,
|
||||
static QString getTitleId(const Utils::FilePath &workingDirectory,
|
||||
const QStringList &fileNames,
|
||||
const QString &revision = QString());
|
||||
const QString &revision = {});
|
||||
|
||||
/* Tagging editors: Sometimes, an editor should be re-used, for example, when showing
|
||||
* a diff of the same file with different diff-options. In order to be able to find
|
||||
@@ -132,7 +133,7 @@ public:
|
||||
class VCSBASE_EXPORT VcsBaseEditorWidget : public TextEditor::TextEditorWidget
|
||||
{
|
||||
Q_PROPERTY(QString source READ source WRITE setSource)
|
||||
Q_PROPERTY(QString workingDirectory READ workingDirectory WRITE setWorkingDirectory)
|
||||
Q_PROPERTY(Utils::FilePath workingDirectory READ workingDirectory WRITE setWorkingDirectory)
|
||||
Q_PROPERTY(QTextCodec *codec READ codec WRITE setCodec)
|
||||
Q_PROPERTY(QString annotateRevisionTextFormat READ annotateRevisionTextFormat WRITE setAnnotateRevisionTextFormat)
|
||||
Q_PROPERTY(bool isFileLogAnnotateEnabled READ isFileLogAnnotateEnabled WRITE setFileLogAnnotateEnabled)
|
||||
@@ -198,8 +199,8 @@ public:
|
||||
void setCodec(QTextCodec *);
|
||||
|
||||
// Base directory for diff views
|
||||
QString workingDirectory() const;
|
||||
void setWorkingDirectory(const QString &wd);
|
||||
Utils::FilePath workingDirectory() const;
|
||||
void setWorkingDirectory(const Utils::FilePath &wd);
|
||||
|
||||
int firstLineNumber() const;
|
||||
void setFirstLineNumber(int firstLineNumber);
|
||||
@@ -220,7 +221,7 @@ signals:
|
||||
// handled by the editor manager for convenience. They are emitted
|
||||
// for LogOutput/AnnotateOutput content types.
|
||||
void describeRequested(const Utils::FilePath &source, const QString &change);
|
||||
void annotateRevisionRequested(const QString &workingDirectory, const QString &file,
|
||||
void annotateRevisionRequested(const Utils::FilePath &workingDirectory, const QString &file,
|
||||
const QString &change, int lineNumber);
|
||||
void diffChunkApplied(const VcsBase::DiffChunk &dc);
|
||||
void diffChunkReverted(const VcsBase::DiffChunk &dc);
|
||||
|
||||
@@ -227,14 +227,14 @@ StateListener::StateListener(QObject *parent) : QObject(parent)
|
||||
|
||||
QString StateListener::windowTitleVcsTopic(const QString &filePath)
|
||||
{
|
||||
QString searchPath;
|
||||
FilePath searchPath;
|
||||
if (!filePath.isEmpty()) {
|
||||
searchPath = QFileInfo(filePath).absolutePath();
|
||||
searchPath = FilePath::fromString(filePath).absolutePath();
|
||||
} else {
|
||||
// use single project's information if there is only one loaded.
|
||||
const QList<Project *> projects = SessionManager::projects();
|
||||
if (projects.size() == 1)
|
||||
searchPath = projects.first()->projectDirectory().toString();
|
||||
searchPath = projects.first()->projectDirectory();
|
||||
}
|
||||
if (searchPath.isEmpty())
|
||||
return QString();
|
||||
@@ -291,8 +291,8 @@ void StateListener::slotStateChanged()
|
||||
state.currentFileDirectory = currentFi.absolutePath();
|
||||
state.currentFileName = currentFi.fileName();
|
||||
}
|
||||
fileControl = VcsManager::findVersionControlForDirectory(state.currentFileDirectory,
|
||||
&state.currentFileTopLevel);
|
||||
fileControl = VcsManager::findVersionControlForDirectory(
|
||||
FilePath::fromString(state.currentFileDirectory), &state.currentFileTopLevel);
|
||||
}
|
||||
|
||||
if (!fileControl)
|
||||
@@ -308,8 +308,8 @@ void StateListener::slotStateChanged()
|
||||
if (currentProject) {
|
||||
state.currentProjectPath = currentProject->projectDirectory().toString();
|
||||
state.currentProjectName = currentProject->displayName();
|
||||
projectControl = VcsManager::findVersionControlForDirectory(state.currentProjectPath,
|
||||
&state.currentProjectTopLevel);
|
||||
projectControl = VcsManager::findVersionControlForDirectory(
|
||||
FilePath::fromString(state.currentProjectPath), &state.currentProjectTopLevel);
|
||||
if (projectControl) {
|
||||
// If we have both, let the file's one take preference
|
||||
if (fileControl && projectControl != fileControl)
|
||||
@@ -381,14 +381,14 @@ QString VcsBasePluginState::currentFileName() const
|
||||
return data->m_state.currentFileName;
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::currentFileTopLevel() const
|
||||
FilePath VcsBasePluginState::currentFileTopLevel() const
|
||||
{
|
||||
return data->m_state.currentFileTopLevel;
|
||||
return FilePath::fromString(data->m_state.currentFileTopLevel);
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::currentFileDirectory() const
|
||||
FilePath VcsBasePluginState::currentFileDirectory() const
|
||||
{
|
||||
return data->m_state.currentFileDirectory;
|
||||
return FilePath::fromString(data->m_state.currentFileDirectory);
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::relativeCurrentFile() const
|
||||
@@ -407,9 +407,9 @@ QString VcsBasePluginState::currentPatchFileDisplayName() const
|
||||
return data->m_state.currentPatchFileDisplayName;
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::currentProjectPath() const
|
||||
FilePath VcsBasePluginState::currentProjectPath() const
|
||||
{
|
||||
return data->m_state.currentProjectPath;
|
||||
return FilePath::fromString(data->m_state.currentProjectPath);
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::currentProjectName() const
|
||||
@@ -417,9 +417,9 @@ QString VcsBasePluginState::currentProjectName() const
|
||||
return data->m_state.currentProjectName;
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::currentProjectTopLevel() const
|
||||
FilePath VcsBasePluginState::currentProjectTopLevel() const
|
||||
{
|
||||
return data->m_state.currentProjectTopLevel;
|
||||
return FilePath::fromString(data->m_state.currentProjectTopLevel);
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::relativeCurrentProject() const
|
||||
@@ -435,9 +435,9 @@ bool VcsBasePluginState::hasTopLevel() const
|
||||
return data->m_state.hasFile() || data->m_state.hasProject();
|
||||
}
|
||||
|
||||
QString VcsBasePluginState::topLevel() const
|
||||
FilePath VcsBasePluginState::topLevel() const
|
||||
{
|
||||
return hasFile() ? data->m_state.currentFileTopLevel : data->m_state.currentProjectTopLevel;
|
||||
return FilePath::fromString(hasFile() ? data->m_state.currentFileTopLevel : data->m_state.currentProjectTopLevel);
|
||||
}
|
||||
|
||||
bool VcsBasePluginState::equals(const Internal::State &rhs) const
|
||||
@@ -638,27 +638,28 @@ void VcsBasePluginPrivate::createRepository()
|
||||
{
|
||||
QTC_ASSERT(supportsOperation(IVersionControl::CreateRepositoryOperation), return);
|
||||
// Find current starting directory
|
||||
QString directory;
|
||||
FilePath directory;
|
||||
if (const Project *currentProject = ProjectTree::currentProject())
|
||||
directory = currentProject->projectFilePath().absolutePath().toString();
|
||||
directory = currentProject->projectFilePath().absolutePath();
|
||||
// Prompt for a directory that is not under version control yet
|
||||
QWidget *mw = ICore::dialogParent();
|
||||
do {
|
||||
directory = QFileDialog::getExistingDirectory(mw, tr("Choose Repository Directory"), directory);
|
||||
directory = FileUtils::getExistingDirectory(tr("Choose Repository Directory"), directory);
|
||||
if (directory.isEmpty())
|
||||
return;
|
||||
const IVersionControl *managingControl = VcsManager::findVersionControlForDirectory(directory);
|
||||
if (managingControl == nullptr)
|
||||
break;
|
||||
const QString question = tr("The directory \"%1\" is already managed by a version control system (%2)."
|
||||
" Would you like to specify another directory?").arg(directory, managingControl->displayName());
|
||||
" Would you like to specify another directory?")
|
||||
.arg(directory.toUserOutput(), managingControl->displayName());
|
||||
|
||||
if (!ask(mw, tr("Repository already under version control"), question))
|
||||
return;
|
||||
} while (true);
|
||||
// Create
|
||||
const bool rc = vcsCreateRepository(FilePath::fromString(directory));
|
||||
const QString nativeDir = QDir::toNativeSeparators(directory);
|
||||
const bool rc = vcsCreateRepository(directory);
|
||||
const QString nativeDir = directory.toUserOutput();
|
||||
if (rc) {
|
||||
QMessageBox::information(mw, tr("Repository Created"),
|
||||
tr("A version control repository has been created in %1.").
|
||||
|
||||
@@ -79,8 +79,8 @@ public:
|
||||
// Current file.
|
||||
QString currentFile() const;
|
||||
QString currentFileName() const;
|
||||
QString currentFileDirectory() const;
|
||||
QString currentFileTopLevel() const;
|
||||
Utils::FilePath currentFileDirectory() const;
|
||||
Utils::FilePath currentFileTopLevel() const;
|
||||
// Convenience: Returns file relative to top level.
|
||||
QString relativeCurrentFile() const;
|
||||
|
||||
@@ -90,9 +90,9 @@ public:
|
||||
QString currentPatchFileDisplayName() const;
|
||||
|
||||
// Current project.
|
||||
QString currentProjectPath() const;
|
||||
Utils::FilePath currentProjectPath() const;
|
||||
QString currentProjectName() const;
|
||||
QString currentProjectTopLevel() const;
|
||||
Utils::FilePath currentProjectTopLevel() const;
|
||||
/* Convenience: Returns project path relative to top level if it
|
||||
* differs from top level (else empty string) as an argument list to do
|
||||
* eg a 'vcs diff <args>' */
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
|
||||
// Top level directory for actions on the top level. Preferably
|
||||
// the file one.
|
||||
QString topLevel() const;
|
||||
Utils::FilePath topLevel() const;
|
||||
|
||||
bool equals(const VcsBasePluginState &rhs) const;
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
QToolBar *m_toolWidget = nullptr;
|
||||
VcsBaseSubmitEditorParameters m_parameters;
|
||||
QString m_displayName;
|
||||
QString m_checkScriptWorkingDirectory;
|
||||
FilePath m_checkScriptWorkingDirectory;
|
||||
SubmitEditorFile m_file;
|
||||
|
||||
QPointer<QAction> m_diffAction;
|
||||
@@ -352,10 +352,10 @@ Core::IDocument *VcsBaseSubmitEditor::document() const
|
||||
|
||||
QString VcsBaseSubmitEditor::checkScriptWorkingDirectory() const
|
||||
{
|
||||
return d->m_checkScriptWorkingDirectory;
|
||||
return d->m_checkScriptWorkingDirectory.toString();
|
||||
}
|
||||
|
||||
void VcsBaseSubmitEditor::setCheckScriptWorkingDirectory(const QString &s)
|
||||
void VcsBaseSubmitEditor::setCheckScriptWorkingDirectory(const FilePath &s)
|
||||
{
|
||||
d->m_checkScriptWorkingDirectory = s;
|
||||
}
|
||||
@@ -638,13 +638,13 @@ bool VcsBaseSubmitEditor::checkSubmitMessage(QString *errorMessage) const
|
||||
return rc;
|
||||
}
|
||||
|
||||
static inline QString msgCheckScript(const QString &workingDir, const QString &cmd)
|
||||
static QString msgCheckScript(const FilePath &workingDir, const QString &cmd)
|
||||
{
|
||||
const QString nativeCmd = QDir::toNativeSeparators(cmd);
|
||||
return workingDir.isEmpty() ?
|
||||
VcsBaseSubmitEditor::tr("Executing %1").arg(nativeCmd) :
|
||||
VcsBaseSubmitEditor::tr("Executing [%1] %2").
|
||||
arg(QDir::toNativeSeparators(workingDir), nativeCmd);
|
||||
arg(workingDir.toUserOutput(), nativeCmd);
|
||||
}
|
||||
|
||||
bool VcsBaseSubmitEditor::runSubmitMessageCheckScript(const QString &checkScript, QString *errorMessage) const
|
||||
|
||||
@@ -66,7 +66,6 @@ class VCSBASE_EXPORT VcsBaseSubmitEditor : public Core::IEditor
|
||||
Q_PROPERTY(QAbstractItemView::SelectionMode fileListSelectionMode READ fileListSelectionMode WRITE setFileListSelectionMode DESIGNABLE true)
|
||||
Q_PROPERTY(bool lineWrap READ lineWrap WRITE setLineWrap DESIGNABLE true)
|
||||
Q_PROPERTY(int lineWrapWidth READ lineWrapWidth WRITE setLineWrapWidth DESIGNABLE true)
|
||||
Q_PROPERTY(QString checkScriptWorkingDirectory READ checkScriptWorkingDirectory WRITE setCheckScriptWorkingDirectory DESIGNABLE true)
|
||||
Q_PROPERTY(bool emptyFileListEnabled READ isEmptyFileListEnabled WRITE setEmptyFileListEnabled DESIGNABLE true)
|
||||
|
||||
protected:
|
||||
@@ -106,7 +105,7 @@ public:
|
||||
void setLineWrapWidth(int);
|
||||
|
||||
QString checkScriptWorkingDirectory() const;
|
||||
void setCheckScriptWorkingDirectory(const QString &);
|
||||
void setCheckScriptWorkingDirectory(const Utils::FilePath &);
|
||||
|
||||
Core::IDocument *document() const override;
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@ using namespace Utils;
|
||||
|
||||
namespace VcsBase {
|
||||
|
||||
VcsCommand::VcsCommand(const QString &workingDirectory, const Environment &environment) :
|
||||
Core::ShellCommand(workingDirectory, environment),
|
||||
VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &environment) :
|
||||
Core::ShellCommand(workingDirectory.toString(), environment),
|
||||
m_preventRepositoryChanged(false)
|
||||
{
|
||||
VcsOutputWindow::setRepository(workingDirectory);
|
||||
VcsOutputWindow::setRepository(workingDirectory.toString());
|
||||
setDisableUnixTerminal();
|
||||
m_sshPrompt = VcsBase::sshPrompt();
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
ExpectRepoChanges = 0x2000, // Expect changes in repository by the command
|
||||
};
|
||||
|
||||
VcsCommand(const QString &defaultWorkingDirectory, const Utils::Environment &environment);
|
||||
VcsCommand(const Utils::FilePath &defaultWorkingDirectory, const Utils::Environment &environment);
|
||||
|
||||
const Utils::Environment processEnvironment() const override;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ Utils::OutputLineParser::Result VcsOutputLineParser::handleLine(const QString &t
|
||||
return {Status::Done, linkSpecs};
|
||||
}
|
||||
|
||||
bool VcsOutputLineParser::handleVcsLink(const QString &workingDirectory, const QString &href)
|
||||
bool VcsOutputLineParser::handleVcsLink(const FilePath &workingDirectory, const QString &href)
|
||||
{
|
||||
using namespace Core;
|
||||
QTC_ASSERT(!href.isEmpty(), return false);
|
||||
@@ -75,12 +75,12 @@ bool VcsOutputLineParser::handleVcsLink(const QString &workingDirectory, const Q
|
||||
return true;
|
||||
}
|
||||
if (IVersionControl *vcs = VcsManager::findVersionControlForDirectory(workingDirectory))
|
||||
return vcs->handleLink(FilePath::fromString(workingDirectory), href);
|
||||
return vcs->handleLink(workingDirectory, href);
|
||||
return false;
|
||||
}
|
||||
|
||||
void VcsOutputLineParser::fillLinkContextMenu(
|
||||
QMenu *menu, const QString &workingDirectory, const QString &href)
|
||||
QMenu *menu, const FilePath &workingDirectory, const QString &href)
|
||||
{
|
||||
QTC_ASSERT(!href.isEmpty(), return);
|
||||
if (href.startsWith("http://") || href.startsWith("https://")) {
|
||||
@@ -91,7 +91,7 @@ void VcsOutputLineParser::fillLinkContextMenu(
|
||||
return;
|
||||
}
|
||||
if (Core::IVersionControl *vcs = Core::VcsManager::findVersionControlForDirectory(workingDirectory))
|
||||
vcs->fillLinkContextMenu(menu, FilePath::fromString(workingDirectory), href);
|
||||
vcs->fillLinkContextMenu(menu, workingDirectory, href);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ class VcsOutputLineParser : public Utils::OutputLineParser
|
||||
Q_OBJECT
|
||||
public:
|
||||
VcsOutputLineParser();
|
||||
void fillLinkContextMenu(QMenu *menu, const QString &workingDirectory, const QString &href);
|
||||
bool handleVcsLink(const QString &workingDirectory, const QString &href);
|
||||
void fillLinkContextMenu(QMenu *menu, const Utils::FilePath &workingDirectory, const QString &href);
|
||||
bool handleVcsLink(const Utils::FilePath &workingDirectory, const QString &href);
|
||||
|
||||
private:
|
||||
Result handleLine(const QString &text, Utils::OutputFormat format) override;
|
||||
|
||||
@@ -177,7 +177,7 @@ void OutputWindowPlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||
if (!repository.isEmpty()) {
|
||||
if (VcsOutputLineParser * const p = parser()) {
|
||||
if (!href.isEmpty())
|
||||
p->fillLinkContextMenu(menu, repository, href);
|
||||
p->fillLinkContextMenu(menu, FilePath::fromString(repository), href);
|
||||
}
|
||||
}
|
||||
QAction *openAction = nullptr;
|
||||
@@ -229,7 +229,7 @@ void OutputWindowPlainTextEdit::handleLink(const QPoint &pos)
|
||||
if (outputFormatter()->handleFileLink(href))
|
||||
return;
|
||||
if (VcsOutputLineParser * const p = parser())
|
||||
p->handleVcsLink(repository, href);
|
||||
p->handleVcsLink(FilePath::fromString(repository), href);
|
||||
}
|
||||
|
||||
void OutputWindowPlainTextEdit::appendLines(const QString &s, const QString &repository)
|
||||
|
||||
@@ -112,7 +112,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
[]() -> QString {
|
||||
IVersionControl *vc = nullptr;
|
||||
if (Project *project = ProjectTree::currentProject())
|
||||
vc = VcsManager::findVersionControlForDirectory(project->projectDirectory().toString());
|
||||
vc = VcsManager::findVersionControlForDirectory(project->projectDirectory());
|
||||
return vc ? vc->displayName() : QString();
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
IVersionControl *vc = nullptr;
|
||||
QString topLevel;
|
||||
if (Project *project = ProjectTree::currentProject())
|
||||
vc = VcsManager::findVersionControlForDirectory(project->projectDirectory().toString(), &topLevel);
|
||||
vc = VcsManager::findVersionControlForDirectory(project->projectDirectory(), &topLevel);
|
||||
return vc ? vc->vcsTopic(FilePath::fromString(topLevel)) : QString();
|
||||
});
|
||||
|
||||
@@ -130,7 +130,7 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
tr("The top level path to the repository the current project is in."),
|
||||
[]() -> QString {
|
||||
if (Project *project = ProjectTree::currentProject())
|
||||
return VcsManager::findTopLevelForDirectory(project->projectDirectory().toString());
|
||||
return VcsManager::findTopLevelForDirectory(project->projectDirectory()).toString();
|
||||
return QString();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user