Git: Add a toggle button for Follow Renames on Log

Fixes: QTCREATORBUG-22826
Change-Id: I6d5075dfe16bc3c5d0914dc182523f0295379396
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2019-08-31 22:53:08 +03:00
committed by Orgad Shaneh
parent 4b1987ba1f
commit ad6968f45f
3 changed files with 8 additions and 1 deletions

View File

@@ -635,6 +635,10 @@ public:
tr("Show textual graph log.")); tr("Show textual graph log."));
mapSetting(graphButton, settings.boolPointer(GitSettings::graphLogKey)); mapSetting(graphButton, settings.boolPointer(GitSettings::graphLogKey));
QAction *followButton = addToggleButton("--follow", tr("Follow"),
tr("Show log also for previous names of the file."));
mapSetting(followButton, settings.boolPointer(GitSettings::followRenamesKey));
addButton(tr("Reload"), Utils::Icons::RELOAD.icon()); addButton(tr("Reload"), Utils::Icons::RELOAD.icon());
} }
}; };
@@ -1032,7 +1036,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
arguments << argWidget->arguments(); arguments << argWidget->arguments();
if (!fileName.isEmpty()) if (!fileName.isEmpty())
arguments << "--follow" << "--" << fileName; arguments << "--" << fileName;
vcsExec(workingDir, arguments, editor); vcsExec(workingDir, arguments, editor);
} }

View File

@@ -45,6 +45,7 @@ const QLatin1String GitSettings::logDiffKey("LogDiff");
const QLatin1String GitSettings::repositoryBrowserCmd("RepositoryBrowserCmd"); const QLatin1String GitSettings::repositoryBrowserCmd("RepositoryBrowserCmd");
const QLatin1String GitSettings::graphLogKey("GraphLog"); const QLatin1String GitSettings::graphLogKey("GraphLog");
const QLatin1String GitSettings::firstParentKey("FirstParent"); const QLatin1String GitSettings::firstParentKey("FirstParent");
const QLatin1String GitSettings::followRenamesKey("FollowRenames");
const QLatin1String GitSettings::lastResetIndexKey("LastResetIndex"); const QLatin1String GitSettings::lastResetIndexKey("LastResetIndex");
GitSettings::GitSettings() GitSettings::GitSettings()
@@ -66,6 +67,7 @@ GitSettings::GitSettings()
declareKey(repositoryBrowserCmd, QString()); declareKey(repositoryBrowserCmd, QString());
declareKey(graphLogKey, false); declareKey(graphLogKey, false);
declareKey(firstParentKey, false); declareKey(firstParentKey, false);
declareKey(followRenamesKey, true);
declareKey(lastResetIndexKey, 0); declareKey(lastResetIndexKey, 0);
} }

View File

@@ -56,6 +56,7 @@ public:
static const QLatin1String repositoryBrowserCmd; static const QLatin1String repositoryBrowserCmd;
static const QLatin1String graphLogKey; static const QLatin1String graphLogKey;
static const QLatin1String firstParentKey; static const QLatin1String firstParentKey;
static const QLatin1String followRenamesKey;
static const QLatin1String lastResetIndexKey; static const QLatin1String lastResetIndexKey;
Utils::FilePath gitExecutable(bool *ok = nullptr, QString *errorMessage = nullptr) const; Utils::FilePath gitExecutable(bool *ok = nullptr, QString *errorMessage = nullptr) const;