forked from qt-creator/qt-creator
Git: Support entry list in reflog
Change-Id: Ic24eff465c6870f42c1964a8700cc6f0b2c0dce5 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
857102748d
commit
ee05e49f79
@@ -1065,7 +1065,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
|||||||
void GitClient::reflog(const QString &workingDirectory, const QString &ref)
|
void GitClient::reflog(const QString &workingDirectory, const QString &ref)
|
||||||
{
|
{
|
||||||
const QString title = tr("Git Reflog \"%1\"").arg(workingDirectory);
|
const QString title = tr("Git Reflog \"%1\"").arg(workingDirectory);
|
||||||
const Id editorId = Git::Constants::GIT_LOG_EDITOR_ID;
|
const Id editorId = Git::Constants::GIT_REFLOG_EDITOR_ID;
|
||||||
// Creating document might change the referenced workingDirectory. Store a copy and use it.
|
// Creating document might change the referenced workingDirectory. Store a copy and use it.
|
||||||
const QString workingDir = workingDirectory;
|
const QString workingDir = workingDirectory;
|
||||||
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, workingDir, codecFor(CodecLogOutput),
|
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, workingDir, codecFor(CodecLogOutput),
|
||||||
|
@@ -36,6 +36,8 @@ const char GIT_SVN_LOG_EDITOR_ID[] = "Git SVN Log Editor";
|
|||||||
const char GIT_SVN_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git SVN Log Editor");
|
const char GIT_SVN_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git SVN Log Editor");
|
||||||
const char GIT_LOG_EDITOR_ID[] = "Git Log Editor";
|
const char GIT_LOG_EDITOR_ID[] = "Git Log Editor";
|
||||||
const char GIT_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Log Editor");
|
const char GIT_LOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Log Editor");
|
||||||
|
const char GIT_REFLOG_EDITOR_ID[] = "Git Reflog Editor";
|
||||||
|
const char GIT_REFLOG_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Reflog Editor");
|
||||||
const char GIT_BLAME_EDITOR_ID[] = "Git Annotation Editor";
|
const char GIT_BLAME_EDITOR_ID[] = "Git Annotation Editor";
|
||||||
const char GIT_BLAME_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Annotation Editor");
|
const char GIT_BLAME_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Annotation Editor");
|
||||||
const char GIT_COMMIT_TEXT_EDITOR_ID[] = "Git Commit Editor";
|
const char GIT_COMMIT_TEXT_EDITOR_ID[] = "Git Commit Editor";
|
||||||
|
@@ -129,13 +129,27 @@ private:
|
|||||||
GitClient *m_client;
|
GitClient *m_client;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class GitReflogEditorWidget : public GitEditorWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GitReflogEditorWidget()
|
||||||
|
{
|
||||||
|
setLogEntryPattern(QRegExp("^([0-9a-f]{8,}) [^}]*\\}: .*$"));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString revisionSubject(const QTextBlock &inBlock) const override
|
||||||
|
{
|
||||||
|
const QString text = inBlock.text();
|
||||||
|
return text.mid(text.indexOf(' ') + 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class GitLogEditorWidget : public QWidget
|
class GitLogEditorWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(Git::Internal::GitLogEditorWidget);
|
Q_DECLARE_TR_FUNCTIONS(Git::Internal::GitLogEditorWidget);
|
||||||
public:
|
public:
|
||||||
GitLogEditorWidget()
|
GitLogEditorWidget(GitEditorWidget *gitEditor)
|
||||||
{
|
{
|
||||||
auto gitEditor = new GitEditorWidget;
|
|
||||||
auto vlayout = new QVBoxLayout;
|
auto vlayout = new QVBoxLayout;
|
||||||
auto hlayout = new QHBoxLayout;
|
auto hlayout = new QHBoxLayout;
|
||||||
vlayout->setSpacing(0);
|
vlayout->setSpacing(0);
|
||||||
@@ -175,6 +189,13 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class Editor>
|
||||||
|
class GitLogEditorWidgetT : public GitLogEditorWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GitLogEditorWidgetT() : GitLogEditorWidget(new Editor) {}
|
||||||
|
};
|
||||||
|
|
||||||
const unsigned minimumRequiredVersion = 0x010900;
|
const unsigned minimumRequiredVersion = 0x010900;
|
||||||
|
|
||||||
const VcsBaseSubmitEditorParameters submitParameters {
|
const VcsBaseSubmitEditorParameters submitParameters {
|
||||||
@@ -198,6 +219,13 @@ const VcsBaseEditorParameters logEditorParameters {
|
|||||||
"text/vnd.qtcreator.git.log"
|
"text/vnd.qtcreator.git.log"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const VcsBaseEditorParameters reflogEditorParameters {
|
||||||
|
LogOutput,
|
||||||
|
Git::Constants::GIT_REFLOG_EDITOR_ID,
|
||||||
|
Git::Constants::GIT_REFLOG_EDITOR_DISPLAY_NAME,
|
||||||
|
"text/vnd.qtcreator.git.reflog"
|
||||||
|
};
|
||||||
|
|
||||||
const VcsBaseEditorParameters blameEditorParameters {
|
const VcsBaseEditorParameters blameEditorParameters {
|
||||||
AnnotateOutput,
|
AnnotateOutput,
|
||||||
Git::Constants::GIT_BLAME_EDITOR_ID,
|
Git::Constants::GIT_BLAME_EDITOR_ID,
|
||||||
@@ -397,7 +425,13 @@ public:
|
|||||||
|
|
||||||
VcsEditorFactory logEditorFactory {
|
VcsEditorFactory logEditorFactory {
|
||||||
&logEditorParameters,
|
&logEditorParameters,
|
||||||
[] { return new GitLogEditorWidget; },
|
[] { return new GitLogEditorWidgetT<GitEditorWidget>; },
|
||||||
|
std::bind(&GitPluginPrivate::describe, this, _1, _2)
|
||||||
|
};
|
||||||
|
|
||||||
|
VcsEditorFactory reflogEditorFactory {
|
||||||
|
&reflogEditorParameters,
|
||||||
|
[] { return new GitLogEditorWidgetT<GitReflogEditorWidget>; },
|
||||||
std::bind(&GitPluginPrivate::describe, this, _1, _2)
|
std::bind(&GitPluginPrivate::describe, this, _1, _2)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user