forked from qt-creator/qt-creator
Svn: add "Verbose" option for log command
Change-Id: If58a98ff45ceba251c6972099d38d2ce506422c9 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -59,9 +59,23 @@ using namespace Core;
|
|||||||
namespace Subversion {
|
namespace Subversion {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class SubversionLogParameterWidget : public VcsBaseEditorParameterWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
SubversionLogParameterWidget(SubversionSettings *settings, QWidget *parent = 0) :
|
||||||
|
VcsBaseEditorParameterWidget(parent)
|
||||||
|
{
|
||||||
|
mapSetting(addToggleButton(QLatin1String("--verbose"), tr("Verbose"),
|
||||||
|
tr("Show files changed in each revision")),
|
||||||
|
settings->boolPointer(SubversionSettings::logVerboseKey));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
SubversionClient::SubversionClient(SubversionSettings *settings) :
|
SubversionClient::SubversionClient(SubversionSettings *settings) :
|
||||||
VcsBaseClient(settings)
|
VcsBaseClient(settings)
|
||||||
{
|
{
|
||||||
|
setLogParameterWidgetCreator([=] { return new SubversionLogParameterWidget(settings); });
|
||||||
}
|
}
|
||||||
|
|
||||||
SubversionSettings *SubversionClient::settings() const
|
SubversionSettings *SubversionClient::settings() const
|
||||||
@@ -102,8 +116,10 @@ void SubversionClient::commit(const QString &repositoryRoot,
|
|||||||
|
|
||||||
Core::Id SubversionClient::vcsEditorKind(VcsCommandTag cmd) const
|
Core::Id SubversionClient::vcsEditorKind(VcsCommandTag cmd) const
|
||||||
{
|
{
|
||||||
// TODO: add some code here
|
switch (cmd) {
|
||||||
Q_UNUSED(cmd)
|
case VcsBaseClient::LogCommand: return Constants::SUBVERSION_LOG_EDITOR_ID;
|
||||||
|
case VcsBaseClient::AnnotateCommand: return Constants::SUBVERSION_BLAME_EDITOR_ID;
|
||||||
|
}
|
||||||
return Core::Id();
|
return Core::Id();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,6 +355,27 @@ void SubversionClient::diff(const QString &workingDirectory, const QStringList &
|
|||||||
reloader->requestReload();
|
reloader->requestReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SubversionClient::log(const QString &workingDir,
|
||||||
|
const QStringList &files,
|
||||||
|
const QStringList &extraOptions,
|
||||||
|
bool enableAnnotationContextMenu)
|
||||||
|
{
|
||||||
|
const auto logCount = settings()->intValue(SubversionSettings::logCountKey);
|
||||||
|
QStringList svnExtraOptions =
|
||||||
|
QStringList(extraOptions)
|
||||||
|
<< SubversionClient::addAuthenticationOptions(*settings());
|
||||||
|
if (logCount > 0)
|
||||||
|
svnExtraOptions << QLatin1String("-l") << QString::number(logCount);
|
||||||
|
|
||||||
|
QStringList nativeFiles;
|
||||||
|
foreach (const QString& file, files)
|
||||||
|
nativeFiles.append(QDir::toNativeSeparators(file));
|
||||||
|
|
||||||
|
// subversion stores log in UTF-8 and returns it back in user system locale.
|
||||||
|
// So we do not need to encode it.
|
||||||
|
VcsBaseClient::log(workingDir, files, svnExtraOptions, enableAnnotationContextMenu);
|
||||||
|
}
|
||||||
|
|
||||||
void SubversionClient::describe(const QString &workingDirectory, int changeNumber, const QString &title)
|
void SubversionClient::describe(const QString &workingDirectory, int changeNumber, const QString &title)
|
||||||
{
|
{
|
||||||
const QString documentId = VcsBaseEditor::editorTag(DiffOutput,
|
const QString documentId = VcsBaseEditor::editorTag(DiffOutput,
|
||||||
|
@@ -63,6 +63,12 @@ public:
|
|||||||
|
|
||||||
void diff(const QString &workingDirectory, const QStringList &files,
|
void diff(const QString &workingDirectory, const QStringList &files,
|
||||||
const QStringList &extraOptions);
|
const QStringList &extraOptions);
|
||||||
|
|
||||||
|
void log(const QString &workingDir,
|
||||||
|
const QStringList &files = QStringList(),
|
||||||
|
const QStringList &extraOptions = QStringList(),
|
||||||
|
bool enableAnnotationContextMenu = false) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void describe(const QString &workingDirectory, int changeNumber, const QString &title);
|
void describe(const QString &workingDirectory, int changeNumber, const QString &title);
|
||||||
QString findTopLevelForFile(const QFileInfo &file) const;
|
QString findTopLevelForFile(const QFileInfo &file) const;
|
||||||
QStringList revisionSpec(const QString &revision) const;
|
QStringList revisionSpec(const QString &revision) const;
|
||||||
|
@@ -770,41 +770,7 @@ void SubversionPlugin::filelog(const QString &workingDir,
|
|||||||
const QString &file,
|
const QString &file,
|
||||||
bool enableAnnotationContextMenu)
|
bool enableAnnotationContextMenu)
|
||||||
{
|
{
|
||||||
// no need for temp file
|
m_client->log(workingDir, QStringList(file), QStringList(), enableAnnotationContextMenu);
|
||||||
QStringList args(QLatin1String("log"));
|
|
||||||
args << SubversionClient::addAuthenticationOptions(settings());
|
|
||||||
if (m_settings.intValue(SubversionSettings::logCountKey) > 0) {
|
|
||||||
args << QLatin1String("-l")
|
|
||||||
<< QString::number(m_settings.intValue(SubversionSettings::logCountKey));
|
|
||||||
}
|
|
||||||
if (!file.isEmpty())
|
|
||||||
args.append(QDir::toNativeSeparators(file));
|
|
||||||
|
|
||||||
// subversion stores log in UTF-8 and returns it back in user system locale.
|
|
||||||
// So we do not need to encode it.
|
|
||||||
const SubversionResponse response =
|
|
||||||
runSvn(workingDir, args, m_settings.timeOutMs(),
|
|
||||||
SshPasswordPrompt, 0/*codec*/);
|
|
||||||
if (response.error)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Re-use an existing view if possible to support
|
|
||||||
// the common usage pattern of continuously changing and diffing a file
|
|
||||||
|
|
||||||
const QString id = VcsBaseEditor::getTitleId(workingDir, QStringList(file));
|
|
||||||
const QString tag = VcsBaseEditor::editorTag(LogOutput, workingDir,
|
|
||||||
QStringList(file));
|
|
||||||
if (IEditor *editor = VcsBaseEditor::locateEditorByTag(tag)) {
|
|
||||||
editor->document()->setContents(response.stdOut.toUtf8());
|
|
||||||
EditorManager::activateEditor(editor);
|
|
||||||
} else {
|
|
||||||
const QString title = QString::fromLatin1("svn log %1").arg(id);
|
|
||||||
const QString source = VcsBaseEditor::getSource(workingDir, file);
|
|
||||||
IEditor *newEditor = showOutputInEditor(title, response.stdOut, LogOutput, source, /*codec*/0);
|
|
||||||
VcsBaseEditor::tagEditor(newEditor, tag);
|
|
||||||
if (enableAnnotationContextMenu)
|
|
||||||
VcsBaseEditor::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubversionPlugin::updateProject()
|
void SubversionPlugin::updateProject()
|
||||||
|
@@ -43,6 +43,7 @@ const QLatin1String SubversionSettings::userKey("User");
|
|||||||
const QLatin1String SubversionSettings::passwordKey("Password");
|
const QLatin1String SubversionSettings::passwordKey("Password");
|
||||||
const QLatin1String SubversionSettings::spaceIgnorantAnnotationKey("SpaceIgnorantAnnotation");
|
const QLatin1String SubversionSettings::spaceIgnorantAnnotationKey("SpaceIgnorantAnnotation");
|
||||||
const QLatin1String SubversionSettings::diffIgnoreWhiteSpaceKey("DiffIgnoreWhiteSpace");
|
const QLatin1String SubversionSettings::diffIgnoreWhiteSpaceKey("DiffIgnoreWhiteSpace");
|
||||||
|
const QLatin1String SubversionSettings::logVerboseKey("LogVerbose");
|
||||||
|
|
||||||
SubversionSettings::SubversionSettings()
|
SubversionSettings::SubversionSettings()
|
||||||
{
|
{
|
||||||
@@ -54,6 +55,7 @@ SubversionSettings::SubversionSettings()
|
|||||||
declareKey(passwordKey, QLatin1String(""));
|
declareKey(passwordKey, QLatin1String(""));
|
||||||
declareKey(spaceIgnorantAnnotationKey, true);
|
declareKey(spaceIgnorantAnnotationKey, true);
|
||||||
declareKey(diffIgnoreWhiteSpaceKey, false);
|
declareKey(diffIgnoreWhiteSpaceKey, false);
|
||||||
|
declareKey(logVerboseKey, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubversionSettings::hasAuthentication() const
|
bool SubversionSettings::hasAuthentication() const
|
||||||
|
@@ -44,6 +44,7 @@ public:
|
|||||||
static const QLatin1String passwordKey;
|
static const QLatin1String passwordKey;
|
||||||
static const QLatin1String spaceIgnorantAnnotationKey;
|
static const QLatin1String spaceIgnorantAnnotationKey;
|
||||||
static const QLatin1String diffIgnoreWhiteSpaceKey;
|
static const QLatin1String diffIgnoreWhiteSpaceKey;
|
||||||
|
static const QLatin1String logVerboseKey;
|
||||||
|
|
||||||
SubversionSettings();
|
SubversionSettings();
|
||||||
bool hasAuthentication() const;
|
bool hasAuthentication() const;
|
||||||
|
Reference in New Issue
Block a user