forked from qt-creator/qt-creator
VCS: Linkify file names in diff output
Fixes: QTCREATORBUG-27309 Change-Id: I1236b3fb5a34d762b4eb42320cdb9ac5ec7e38a2 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
ffd69f0428
commit
b997d095a1
@@ -4,6 +4,7 @@
|
|||||||
#include "vcsoutputformatter.h"
|
#include "vcsoutputformatter.h"
|
||||||
|
|
||||||
#include <coreplugin/iversioncontrol.h>
|
#include <coreplugin/iversioncontrol.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -24,7 +25,8 @@ VcsOutputLineParser::VcsOutputLineParser() :
|
|||||||
R"((https?://\S*))" // https://codereview.org/c/1234
|
R"((https?://\S*))" // https://codereview.org/c/1234
|
||||||
R"(|\b(v[0-9]+\.[0-9]+\.[0-9]+[\-A-Za-z0-9]*))" // v0.1.2-beta3
|
R"(|\b(v[0-9]+\.[0-9]+\.[0-9]+[\-A-Za-z0-9]*))" // v0.1.2-beta3
|
||||||
R"(|\b(?<!mode )([0-9a-f]{6,}(?:\.{2,3}[0-9a-f]{6,})" // 789acf or 123abc..456cde
|
R"(|\b(?<!mode )([0-9a-f]{6,}(?:\.{2,3}[0-9a-f]{6,})" // 789acf or 123abc..456cde
|
||||||
R"(|\^+|~\d+)?)\b)") // or 789acf^ or 123abc~99
|
R"(|\^+|~\d+)?)\b)" // or 789acf^ or 123abc~99
|
||||||
|
R"(|(?<=\b[ab]/)\S+)") // a/path/to/file.cpp
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,8 +56,14 @@ bool VcsOutputLineParser::handleVcsLink(const FilePath &workingDirectory, const
|
|||||||
QDesktopServices::openUrl(QUrl(href));
|
QDesktopServices::openUrl(QUrl(href));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (IVersionControl *vcs = VcsManager::findVersionControlForDirectory(workingDirectory))
|
if (IVersionControl *vcs = VcsManager::findVersionControlForDirectory(workingDirectory)) {
|
||||||
|
const FilePath file = workingDirectory.pathAppended(href);
|
||||||
|
if (file.exists()) {
|
||||||
|
EditorManager::openEditor(file);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return vcs->handleLink(workingDirectory, href);
|
return vcs->handleLink(workingDirectory, href);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user