forked from qt-creator/qt-creator
Merge remote branch 'origin/2.1'
Conflicts: README doc/qt-html-templates.qdocconf doc/qtcreator.qdoc doc/qtcreator.qdocconf share/qtcreator/templates/wizards/qtcreatorplugin/MyPlugin.pluginspec src/app/Info.plist src/plugins/bineditor/BinEditor.pluginspec src/plugins/bookmarks/Bookmarks.pluginspec src/plugins/classview/ClassView.pluginspec src/plugins/cmakeprojectmanager/CMakeProjectManager.pluginspec src/plugins/coreplugin/Core.pluginspec src/plugins/coreplugin/coreconstants.h src/plugins/cpaster/CodePaster.pluginspec src/plugins/cppeditor/CppEditor.pluginspec src/plugins/cpptools/CppTools.pluginspec src/plugins/cvs/CVS.pluginspec src/plugins/debugger/Debugger.pluginspec src/plugins/debugger/breakhandler.cpp src/plugins/designer/Designer.pluginspec src/plugins/fakevim/FakeVim.pluginspec src/plugins/find/Find.pluginspec src/plugins/genericprojectmanager/GenericProjectManager.pluginspec src/plugins/git/ScmGit.pluginspec src/plugins/helloworld/HelloWorld.pluginspec src/plugins/help/Help.pluginspec src/plugins/imageviewer/ImageViewer.pluginspec src/plugins/locator/Locator.pluginspec src/plugins/mercurial/Mercurial.pluginspec src/plugins/perforce/Perforce.pluginspec src/plugins/projectexplorer/ProjectExplorer.pluginspec src/plugins/qmldesigner/QmlDesigner.pluginspec src/plugins/qmljseditor/QmlJSEditor.pluginspec src/plugins/qmljsinspector/QmlJSInspector.pluginspec src/plugins/qmlprojectmanager/QmlProjectManager.pluginspec src/plugins/qt4projectmanager/Qt4ProjectManager.pluginspec src/plugins/regexp/RegExp.pluginspec src/plugins/resourceeditor/ResourceEditor.pluginspec src/plugins/snippets/Snippets.pluginspec src/plugins/subversion/Subversion.pluginspec src/plugins/tasklist/TaskList.pluginspec src/plugins/texteditor/TextEditor.pluginspec src/plugins/vcsbase/VCSBase.pluginspec src/plugins/welcome/Welcome.pluginspec tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp tests/manual/fakevim/fakevim.pro tests/manual/ssh/errorhandling/main.cpp
This commit is contained in:
@@ -55,7 +55,7 @@ QString ChangeSelectionDialog::repository() const
|
||||
|
||||
void ChangeSelectionDialog::setRepository(const QString &s)
|
||||
{
|
||||
m_ui.repositoryEdit->setText(s);
|
||||
m_ui.repositoryEdit->setText(QDir::toNativeSeparators(s));
|
||||
}
|
||||
|
||||
void ChangeSelectionDialog::selectWorkingDirectory()
|
||||
|
||||
@@ -41,10 +41,13 @@ namespace Git {
|
||||
struct CloneWizardPagePrivate {
|
||||
CloneWizardPagePrivate();
|
||||
|
||||
bool urlIsLocal(const QString &url);
|
||||
|
||||
const QString mainLinePostfix;
|
||||
const QString gitPostFix;
|
||||
const QString protocolDelimiter;
|
||||
QCheckBox *deleteMasterCheckBox;
|
||||
QString headBranch;
|
||||
};
|
||||
|
||||
CloneWizardPagePrivate::CloneWizardPagePrivate() :
|
||||
@@ -55,6 +58,15 @@ CloneWizardPagePrivate::CloneWizardPagePrivate() :
|
||||
{
|
||||
}
|
||||
|
||||
bool CloneWizardPagePrivate::urlIsLocal(const QString &url)
|
||||
{
|
||||
if (url.startsWith(QLatin1String("file://"))
|
||||
|| url.startsWith(QLatin1Char('/'))
|
||||
|| url.at(0).isLetter() && url.at(1) == QChar(':') && url.at(2) == QChar('\\'))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
CloneWizardPage::CloneWizardPage(QWidget *parent) :
|
||||
VCSBase::BaseCheckoutWizardPage(parent),
|
||||
d(new CloneWizardPagePrivate)
|
||||
@@ -63,7 +75,8 @@ CloneWizardPage::CloneWizardPage(QWidget *parent) :
|
||||
setSubTitle(tr("Specify repository URL, checkout directory and path."));
|
||||
setRepositoryLabel(tr("Clone URL:"));
|
||||
d->deleteMasterCheckBox = new QCheckBox(tr("Delete master branch"));
|
||||
addControl(d->deleteMasterCheckBox);
|
||||
d->deleteMasterCheckBox->setToolTip(tr("Delete the master branch after checking out the repository."));
|
||||
addLocalControl(d->deleteMasterCheckBox);
|
||||
setDeleteMasterBranch(true);
|
||||
}
|
||||
|
||||
@@ -88,7 +101,8 @@ QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const
|
||||
* 'user@host:qt/qt.git', 'http://host/qt/qt.git' 'local repo'
|
||||
* ------> 'qt' . */
|
||||
|
||||
QString url = urlIn.trimmed();
|
||||
QString url = urlIn.trimmed().replace(QChar('\\'), QChar('/'));
|
||||
|
||||
const QChar slash = QLatin1Char('/');
|
||||
// remove host
|
||||
const int protocolDelimiterPos = url.indexOf(d->protocolDelimiter); // "://"
|
||||
@@ -114,8 +128,9 @@ QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const
|
||||
}
|
||||
// fix invalid characters
|
||||
const QChar dash = QLatin1Char('-');
|
||||
url.replace(slash, dash);
|
||||
url.replace(QLatin1Char('.'), dash);
|
||||
url.replace(QRegExp(QLatin1String("[^0-9a-zA-Z_-]")), dash);
|
||||
// trim leading dashes (they are annoying and get created when using local pathes)
|
||||
url.replace(QRegExp(QLatin1String("^-+")), QString());
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -128,33 +143,34 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizardPage::createCheckoutJob(
|
||||
|
||||
const QString binary = client->binary();
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("clone") << repository() << checkoutDir;
|
||||
|
||||
VCSBase::ProcessCheckoutJob *job = new VCSBase::ProcessCheckoutJob;
|
||||
const QProcessEnvironment env = client->processEnvironment();
|
||||
|
||||
// 1) Basic checkout step
|
||||
QStringList args;
|
||||
args << QLatin1String("clone") << repository() << checkoutDir;
|
||||
job->addStep(binary, args, workingDirectory, env);
|
||||
const QString checkoutBranch = branch();
|
||||
|
||||
// 2) Checkout branch, change to checkoutDir
|
||||
const QString masterBranch = QLatin1String("master");
|
||||
if (!checkoutBranch.isEmpty() && checkoutBranch != masterBranch) {
|
||||
if (!checkoutBranch.isEmpty() && checkoutBranch != d->headBranch) {
|
||||
// Create branch
|
||||
args.clear();
|
||||
args << QLatin1String("branch") << QLatin1String("--track")
|
||||
<< checkoutBranch << (QLatin1String("origin/") + checkoutBranch);
|
||||
job->addStep(binary, args, *checkoutPath, env);
|
||||
if (!d->urlIsLocal(repository())) {
|
||||
args.clear();
|
||||
args << QLatin1String("branch") << QLatin1String("--track")
|
||||
<< checkoutBranch << (QLatin1String("origin/") + checkoutBranch);
|
||||
job->addStep(binary, args, *checkoutPath, env);
|
||||
}
|
||||
// Checkout branch
|
||||
args.clear();
|
||||
args << QLatin1String("checkout") << checkoutBranch;
|
||||
job->addStep(binary, args, *checkoutPath, env);
|
||||
// Delete master if desired
|
||||
if (deleteMasterBranch()) {
|
||||
if (deleteMasterBranch() && d->headBranch != QLatin1String("<detached HEAD>")) {
|
||||
// Make sure we only have the requested branch:
|
||||
args.clear();
|
||||
args << QLatin1String("branch") << QLatin1String("-D") << masterBranch;
|
||||
job->addStep(binary, args, *checkoutPath, env);
|
||||
args << QLatin1String("branch") << QLatin1String("-D") << d->headBranch;
|
||||
}
|
||||
job->addStep(binary, args, *checkoutPath, env);
|
||||
}
|
||||
|
||||
return QSharedPointer<VCSBase::AbstractCheckoutJob>(job);
|
||||
@@ -163,11 +179,16 @@ QSharedPointer<VCSBase::AbstractCheckoutJob> CloneWizardPage::createCheckoutJob(
|
||||
QStringList CloneWizardPage::branches(const QString &repository, int *current)
|
||||
{
|
||||
// Run git on remote repository if an URL was specified.
|
||||
*current = 0;
|
||||
*current = -1;
|
||||
d->headBranch.clear();
|
||||
|
||||
if (repository.isEmpty())
|
||||
return QStringList();
|
||||
const QStringList branches = Internal::GitPlugin::instance()->gitClient()->synchronousRepositoryBranches(repository);
|
||||
*current = branches.indexOf(QLatin1String("master"));
|
||||
if (!branches.isEmpty()) {
|
||||
*current = 0; // default branch is always returned first!
|
||||
d->headBranch = branches.at(0);
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,8 @@ void GitClient::diff(const QString &workingDirectory,
|
||||
commonDiffArgs << QLatin1String("diff") << QLatin1String(noColorOption);
|
||||
if (m_settings.diffPatience)
|
||||
commonDiffArgs << QLatin1String("--patience");
|
||||
if (m_settings.ignoreSpaceChanges)
|
||||
commonDiffArgs << QLatin1String("--ignore-space-change");
|
||||
if (unstagedFileNames.empty() && stagedFileNames.empty()) {
|
||||
QStringList arguments(commonDiffArgs);
|
||||
arguments << diffArgs;
|
||||
@@ -396,7 +398,7 @@ void GitClient::blame(const QString &workingDirectory,
|
||||
qDebug() << "blame" << workingDirectory << fileName << lineNumber;
|
||||
QStringList arguments(QLatin1String("blame"));
|
||||
arguments << QLatin1String("--root");
|
||||
if (m_plugin->settings().spaceIgnorantBlame)
|
||||
if (m_plugin->settings().ignoreSpaceChanges)
|
||||
arguments << QLatin1String("-w");
|
||||
arguments << QLatin1String("--") << fileName;
|
||||
if (!revision.isEmpty())
|
||||
@@ -1272,29 +1274,45 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory,
|
||||
return StatusFailed;
|
||||
}
|
||||
// Unchanged (output text depending on whether -u was passed)
|
||||
if (outputText.contains("nothing to commit")
|
||||
|| outputText.contains("nothing added to commit but untracked files present"))
|
||||
if (outputText.contains("nothing to commit"))
|
||||
return StatusUnchanged;
|
||||
if (outputText.contains("nothing added to commit but untracked files present"))
|
||||
return untracked ? StatusChanged : StatusUnchanged;
|
||||
return StatusChanged;
|
||||
}
|
||||
|
||||
// Quietly retrieve branch list of remote repository URL
|
||||
//
|
||||
// The branch HEAD is pointing to is always returned first.
|
||||
QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryURL)
|
||||
{
|
||||
QStringList arguments(QLatin1String("ls-remote"));
|
||||
arguments << QLatin1String("--heads") << repositoryURL;
|
||||
arguments << repositoryURL << QLatin1String("HEAD") << QLatin1String("refs/heads/*");
|
||||
const unsigned flags =
|
||||
VCSBase::VCSBasePlugin::SshPasswordPrompt|
|
||||
VCSBase::VCSBasePlugin::SuppressStdErrInLogWindow|
|
||||
VCSBase::VCSBasePlugin::SuppressFailMessageInLogWindow;
|
||||
const Utils::SynchronousProcessResponse resp = synchronousGit(QString(), arguments, flags);
|
||||
QStringList branches;
|
||||
branches << "<detached HEAD>";
|
||||
QString headSha;
|
||||
if (resp.result == Utils::SynchronousProcessResponse::Finished) {
|
||||
// split "82bfad2f51d34e98b18982211c82220b8db049b<tab>refs/heads/master"
|
||||
foreach(const QString &line, resp.stdOut.split(QLatin1Char('\n'))) {
|
||||
if (line.endsWith("\tHEAD")) {
|
||||
Q_ASSERT(headSha.isNull());
|
||||
headSha = line.left(line.indexOf(QChar('\t')));
|
||||
continue;
|
||||
}
|
||||
|
||||
const int slashPos = line.lastIndexOf(QLatin1Char('/'));
|
||||
if (slashPos != -1)
|
||||
branches.push_back(line.mid(slashPos + 1));
|
||||
const QString branchName = line.mid(slashPos + 1);
|
||||
if (slashPos != -1) {
|
||||
if (line.startsWith(headSha))
|
||||
branches[0] = branchName;
|
||||
else
|
||||
branches.push_back(branchName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
|
||||
@@ -313,19 +313,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
m_menuAction = gitContainer->menu()->menuAction();
|
||||
|
||||
ParameterActionCommandPair parameterActionCommand
|
||||
= createFileAction(actionManager, gitContainer,
|
||||
tr("Diff Current File"), tr("Diff \"%1\""),
|
||||
QLatin1String("Git.Diff"), globalcontext, true,
|
||||
SLOT(diffCurrentFile()));
|
||||
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+D")));
|
||||
|
||||
parameterActionCommand
|
||||
= createFileAction(actionManager, gitContainer,
|
||||
tr("Log File"), tr("Log of \"%1\""),
|
||||
QLatin1String("Git.Log"), globalcontext, true, SLOT(logFile()));
|
||||
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+L")));
|
||||
|
||||
parameterActionCommand
|
||||
= createFileAction(actionManager, gitContainer,
|
||||
tr("Blame"), tr("Blame for \"%1\""),
|
||||
QLatin1String("Git.Blame"),
|
||||
@@ -334,16 +321,20 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
|
||||
parameterActionCommand
|
||||
= createFileAction(actionManager, gitContainer,
|
||||
tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""),
|
||||
QLatin1String("Git.UndoUnstaged"), globalcontext,
|
||||
true, SLOT(undoUnstagedFileChanges()));
|
||||
tr("Diff Current File"), tr("Diff of \"%1\""),
|
||||
QLatin1String("Git.Diff"), globalcontext, true,
|
||||
SLOT(diffCurrentFile()));
|
||||
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+D")));
|
||||
|
||||
parameterActionCommand
|
||||
= createFileAction(actionManager, gitContainer,
|
||||
tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""),
|
||||
QLatin1String("Git.Undo"), globalcontext,
|
||||
true, SLOT(undoFileChanges()));
|
||||
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+U")));
|
||||
= createFileAction(actionManager, gitContainer,
|
||||
tr("Log Current File"), tr("Log of \"%1\""),
|
||||
QLatin1String("Git.Log"), globalcontext, true, SLOT(logFile()));
|
||||
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+L")));
|
||||
|
||||
|
||||
// ------
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.File"), this));
|
||||
|
||||
parameterActionCommand
|
||||
= createFileAction(actionManager, gitContainer,
|
||||
@@ -356,6 +347,21 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"),
|
||||
QLatin1String("Git.Unstage"), globalcontext, true, SLOT(unstageFile()));
|
||||
|
||||
parameterActionCommand
|
||||
= createFileAction(actionManager, gitContainer,
|
||||
tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""),
|
||||
QLatin1String("Git.UndoUnstaged"), globalcontext,
|
||||
true, SLOT(undoUnstagedFileChanges()));
|
||||
|
||||
parameterActionCommand
|
||||
= createFileAction(actionManager, gitContainer,
|
||||
tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""),
|
||||
QLatin1String("Git.Undo"), globalcontext,
|
||||
true, SLOT(undoFileChanges()));
|
||||
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+U")));
|
||||
|
||||
|
||||
// ------------
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Project"), this));
|
||||
|
||||
parameterActionCommand
|
||||
@@ -379,107 +385,102 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
QLatin1String("Git.CleanProject"), globalcontext,
|
||||
true, SLOT(cleanProject()));
|
||||
|
||||
|
||||
// --------------
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Repository"), this));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Diff Repository"), QLatin1String("Git.DiffRepository"),
|
||||
tr("Diff"), QLatin1String("Git.DiffRepository"),
|
||||
globalcontext, true, SLOT(diffRepository()));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Repository Status"), QLatin1String("Git.StatusRepository"),
|
||||
tr("Log"), QLatin1String("Git.LogRepository"),
|
||||
globalcontext, true, &GitClient::graphLog);
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Status"), QLatin1String("Git.StatusRepository"),
|
||||
globalcontext, true, &GitClient::status);
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Log Repository"), QLatin1String("Git.LogRepository"),
|
||||
globalcontext, true, &GitClient::graphLog);
|
||||
|
||||
// Apply current file as patch is handled specially.
|
||||
parameterActionCommand =
|
||||
createParameterAction(actionManager, gitContainer,
|
||||
tr("Apply Patch"), tr("Apply \"%1\""),
|
||||
QLatin1String("Git.ApplyCurrentFilePatch"),
|
||||
globalcontext, true);
|
||||
m_applyCurrentFilePatchAction = parameterActionCommand.first;
|
||||
connect(m_applyCurrentFilePatchAction, SIGNAL(triggered()), this,
|
||||
SLOT(applyCurrentFilePatch()));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Apply Patch..."), QLatin1String("Git.ApplyPatch"),
|
||||
globalcontext, true, SLOT(promptApplyPatch()));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Undo Repository Changes"), QLatin1String("Git.UndoRepository"),
|
||||
tr("Reset..."), QLatin1String("Git.UndoRepository"),
|
||||
globalcontext, false, SLOT(undoRepositoryChanges()));
|
||||
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Clean..."), QLatin1String("Git.CleanRepository"),
|
||||
globalcontext, true, SLOT(cleanRepository()));
|
||||
|
||||
m_createRepositoryAction = new QAction(tr("Create Repository..."), this);
|
||||
Core::Command *createRepositoryCommand = actionManager->registerAction(m_createRepositoryAction, "Git.CreateRepository", globalcontext);
|
||||
connect(m_createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
|
||||
gitContainer->addAction(createRepositoryCommand);
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Clean Repository..."), QLatin1String("Git.CleanRepository"),
|
||||
globalcontext, true, SLOT(cleanRepository()));
|
||||
// --------------
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Info"), this));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Launch gitk"), QLatin1String("Git.LaunchGitK"),
|
||||
globalcontext, true, &GitClient::launchGitK);
|
||||
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Global"), this));
|
||||
|
||||
ActionCommandPair actionCommand =
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Stash Snapshot..."), QLatin1String("Git.StashSnapshot"),
|
||||
globalcontext, true, SLOT(stashSnapshot()));
|
||||
actionCommand.first->setToolTip(tr("Saves the current state of your work."));
|
||||
|
||||
actionCommand = createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Stash"), QLatin1String("Git.Stash"),
|
||||
globalcontext, true, SLOT(stash()));
|
||||
actionCommand.first->setToolTip(tr("Saves the current state of your work and resets the repository."));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Fetch"), QLatin1String("Git.Fetch"),
|
||||
globalcontext, true, SLOT(fetch()));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Pull"), QLatin1String("Git.Pull"),
|
||||
globalcontext, true, SLOT(pull()));
|
||||
|
||||
actionCommand = createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Stash Pop"), QLatin1String("Git.StashPop"),
|
||||
globalcontext, true, &GitClient::stashPop);
|
||||
actionCommand.first->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
|
||||
|
||||
actionCommand = createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Commit..."), QLatin1String("Git.Commit"),
|
||||
globalcontext, true, SLOT(startCommit()));
|
||||
actionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+C")));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Amend Last Commit..."), QLatin1String("Git.AmendCommit"),
|
||||
globalcontext, true, SLOT(startAmendCommit()));
|
||||
|
||||
actionCommand = createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Push"), QLatin1String("Git.Push"),
|
||||
globalcontext, true, SLOT(push()));
|
||||
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Branch"), this));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Branches..."), QLatin1String("Git.BranchList"),
|
||||
globalcontext, false, SLOT(branchList()));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Stashes..."), QLatin1String("Git.StashList"),
|
||||
globalcontext, false, SLOT(stashList()));
|
||||
|
||||
m_showAction = new QAction(tr("Show Commit..."), this);
|
||||
Core::Command *showCommitCommand = actionManager->registerAction(m_showAction, "Git.ShowCommit", globalcontext);
|
||||
connect(m_showAction, SIGNAL(triggered()), this, SLOT(showCommit()));
|
||||
gitContainer->addAction(showCommitCommand);
|
||||
|
||||
// Subversion in a submenu.
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Subversion"), this));
|
||||
|
||||
// --------------
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.RarelyUsed"), this));
|
||||
|
||||
Core::ActionContainer *patchMenu = actionManager->createMenu(Core::Id("Git.PatchMenu"));
|
||||
patchMenu->menu()->setTitle(tr("Patch"));
|
||||
gitContainer->addMenu(patchMenu);
|
||||
|
||||
// Apply current file as patch is handled specially.
|
||||
parameterActionCommand =
|
||||
createParameterAction(actionManager, patchMenu,
|
||||
tr("Apply from Editor"), tr("Apply \"%1\""),
|
||||
QLatin1String("Git.ApplyCurrentFilePatch"),
|
||||
globalcontext, true);
|
||||
m_applyCurrentFilePatchAction = parameterActionCommand.first;
|
||||
connect(m_applyCurrentFilePatchAction, SIGNAL(triggered()), this,
|
||||
SLOT(applyCurrentFilePatch()));
|
||||
|
||||
createRepositoryAction(actionManager, patchMenu,
|
||||
tr("Apply from File..."), QLatin1String("Git.ApplyPatch"),
|
||||
globalcontext, true, SLOT(promptApplyPatch()));
|
||||
|
||||
Core::ActionContainer *stashMenu = actionManager->createMenu(Core::Id("Git.StashMenu"));
|
||||
stashMenu->menu()->setTitle(tr("Stash"));
|
||||
gitContainer->addMenu(stashMenu);
|
||||
|
||||
createRepositoryAction(actionManager, stashMenu,
|
||||
tr("Stashes..."), QLatin1String("Git.StashList"),
|
||||
globalcontext, false, SLOT(stashList()));
|
||||
|
||||
stashMenu->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.StashMenuPush"), this));
|
||||
|
||||
ActionCommandPair actionCommand =
|
||||
createRepositoryAction(actionManager, stashMenu,
|
||||
tr("Stash"), QLatin1String("Git.Stash"),
|
||||
globalcontext, true, SLOT(stash()));
|
||||
actionCommand.first->setToolTip(tr("Saves the current state of your work and resets the repository."));
|
||||
|
||||
actionCommand = createRepositoryAction(actionManager, stashMenu,
|
||||
tr("Take Snapshot..."), QLatin1String("Git.StashSnapshot"),
|
||||
globalcontext, true, SLOT(stashSnapshot()));
|
||||
actionCommand.first->setToolTip(tr("Saves the current state of your work."));
|
||||
|
||||
stashMenu->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.StashMenuPop"), this));
|
||||
|
||||
actionCommand = createRepositoryAction(actionManager, stashMenu,
|
||||
tr("Stash Pop"), QLatin1String("Git.StashPop"),
|
||||
globalcontext, true, &GitClient::stashPop);
|
||||
actionCommand.first->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
|
||||
|
||||
Core::ActionContainer *subversionMenu = actionManager->createMenu(Core::Id("Git.Subversion"));
|
||||
subversionMenu->menu()->setTitle(tr("Subversion"));
|
||||
gitContainer->addMenu(subversionMenu);
|
||||
@@ -492,6 +493,34 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
tr("Fetch"), QLatin1String("Git.Subversion.Fetch"),
|
||||
globalcontext, false, &GitClient::synchronousSubversionFetch);
|
||||
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.PushPull"), this));
|
||||
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Global"), this));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Fetch"), QLatin1String("Git.Fetch"),
|
||||
globalcontext, true, SLOT(fetch()));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Pull"), QLatin1String("Git.Pull"),
|
||||
globalcontext, true, SLOT(pull()));
|
||||
|
||||
actionCommand = createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Push"), QLatin1String("Git.Push"),
|
||||
globalcontext, true, SLOT(push()));
|
||||
|
||||
actionCommand = createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Commit..."), QLatin1String("Git.Commit"),
|
||||
globalcontext, true, SLOT(startCommit()));
|
||||
actionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+C")));
|
||||
|
||||
createRepositoryAction(actionManager, gitContainer,
|
||||
tr("Amend Last Commit..."), QLatin1String("Git.AmendCommit"),
|
||||
globalcontext, true, SLOT(startAmendCommit()));
|
||||
|
||||
// Subversion in a submenu.
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Subversion"), this));
|
||||
|
||||
if (0) {
|
||||
const QList<QAction*> snapShotActions = createSnapShotTestActions();
|
||||
const int count = snapShotActions.size();
|
||||
@@ -593,7 +622,7 @@ void GitPlugin::undoRepositoryChanges()
|
||||
{
|
||||
const VCSBase::VCSBasePluginState state = currentState();
|
||||
QTC_ASSERT(state.hasTopLevel(), return)
|
||||
const QString msg = tr("Would you like to revert all pending changes to the repository\n%1?").arg(state.topLevel());
|
||||
const QString msg = tr("Revert all pending changes to the repository\n%1?").arg(QDir::toNativeSeparators(state.topLevel()));
|
||||
const QMessageBox::StandardButton answer
|
||||
= QMessageBox::question(m_core->mainWindow(),
|
||||
tr("Revert"), msg,
|
||||
|
||||
@@ -44,7 +44,7 @@ static const char timeoutKeyC[] = "TimeOut";
|
||||
static const char pullRebaseKeyC[] = "PullRebase";
|
||||
static const char promptToSubmitKeyC[] = "PromptForSubmit";
|
||||
static const char omitAnnotationDateKeyC[] = "OmitAnnotationDate";
|
||||
static const char spaceIgnorantBlameKeyC[] = "SpaceIgnorantBlame";
|
||||
static const char ignoreSpaceChangesC[] = "SpaceIgnorantBlame";
|
||||
static const char diffPatienceKeyC[] = "DiffPatience";
|
||||
static const char winSetHomeEnvironmentKeyC[] = "WinSetHomeEnvironment";
|
||||
static const char gitkOptionsKeyC[] = "GitKOptions";
|
||||
@@ -69,7 +69,7 @@ GitSettings::GitSettings() :
|
||||
pullRebase(bool(defaultPullRebase)),
|
||||
promptToSubmit(true),
|
||||
omitAnnotationDate(false),
|
||||
spaceIgnorantBlame(true),
|
||||
ignoreSpaceChanges(true),
|
||||
diffPatience(true),
|
||||
winSetHomeEnvironment(false)
|
||||
{
|
||||
@@ -85,7 +85,7 @@ void GitSettings::fromSettings(QSettings *settings)
|
||||
pullRebase = settings->value(QLatin1String(pullRebaseKeyC), bool(defaultPullRebase)).toBool();
|
||||
promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool();
|
||||
omitAnnotationDate = settings->value(QLatin1String(omitAnnotationDateKeyC), false).toBool();
|
||||
spaceIgnorantBlame = settings->value(QLatin1String(spaceIgnorantBlameKeyC), true).toBool();
|
||||
ignoreSpaceChanges = settings->value(QLatin1String(ignoreSpaceChangesC), true).toBool();
|
||||
diffPatience = settings->value(QLatin1String(diffPatienceKeyC), true).toBool();
|
||||
winSetHomeEnvironment = settings->value(QLatin1String(winSetHomeEnvironmentKeyC), false).toBool();
|
||||
gitkOptions = settings->value(QLatin1String(gitkOptionsKeyC)).toString();
|
||||
@@ -102,7 +102,7 @@ void GitSettings::toSettings(QSettings *settings) const
|
||||
settings->setValue(QLatin1String(pullRebaseKeyC), pullRebase);
|
||||
settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit);
|
||||
settings->setValue(QLatin1String(omitAnnotationDateKeyC), omitAnnotationDate);
|
||||
settings->setValue(QLatin1String(spaceIgnorantBlameKeyC), spaceIgnorantBlame);
|
||||
settings->setValue(QLatin1String(ignoreSpaceChangesC), ignoreSpaceChanges);
|
||||
settings->setValue(QLatin1String(diffPatienceKeyC), diffPatience);
|
||||
settings->setValue(QLatin1String(winSetHomeEnvironmentKeyC), winSetHomeEnvironment);
|
||||
settings->setValue(QLatin1String(gitkOptionsKeyC), gitkOptions);
|
||||
@@ -114,7 +114,7 @@ bool GitSettings::equals(const GitSettings &s) const
|
||||
return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount
|
||||
&& timeoutSeconds == s.timeoutSeconds && promptToSubmit == s.promptToSubmit
|
||||
&& pullRebase == s.pullRebase
|
||||
&& omitAnnotationDate == s.omitAnnotationDate && spaceIgnorantBlame == s.spaceIgnorantBlame
|
||||
&& omitAnnotationDate == s.omitAnnotationDate && ignoreSpaceChanges == s.ignoreSpaceChanges
|
||||
&& diffPatience == s.diffPatience && winSetHomeEnvironment == s.winSetHomeEnvironment
|
||||
&& gitkOptions == s.gitkOptions;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ struct GitSettings
|
||||
bool pullRebase;
|
||||
bool promptToSubmit;
|
||||
bool omitAnnotationDate;
|
||||
bool spaceIgnorantBlame;
|
||||
bool ignoreSpaceChanges;
|
||||
bool diffPatience;
|
||||
bool winSetHomeEnvironment;
|
||||
QString gitkOptions;
|
||||
|
||||
@@ -122,7 +122,6 @@ GitSubmitEditorWidget::GitSubmitEditorWidget(QWidget *parent) :
|
||||
|
||||
m_emailValidator = new QRegExpValidator(QRegExp(QLatin1String("[^@ ]+@[^@ ]+\\.[a-zA-Z]+")), this);
|
||||
|
||||
m_gitSubmitPanelUi.emailLineEdit->setValidator(m_emailValidator);
|
||||
connect(m_gitSubmitPanelUi.authorLineEdit, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(authorInformationChanged()));
|
||||
connect(m_gitSubmitPanelUi.emailLineEdit, SIGNAL(textChanged(QString)),
|
||||
@@ -152,18 +151,21 @@ void GitSubmitEditorWidget::setPanelData(const GitSubmitEditorPanelData &data)
|
||||
|
||||
bool GitSubmitEditorWidget::canSubmit() const
|
||||
{
|
||||
if (m_gitSubmitPanelUi.authorLineEdit->text().isEmpty()
|
||||
|| !emailIsValid())
|
||||
if (m_gitSubmitPanelUi.invalidAuthorLabel->isVisible()
|
||||
|| m_gitSubmitPanelUi.invalidEmailLabel->isVisible())
|
||||
return false;
|
||||
return SubmitEditorWidget::canSubmit();
|
||||
}
|
||||
|
||||
void GitSubmitEditorWidget::authorInformationChanged()
|
||||
{
|
||||
bool bothEmpty = m_gitSubmitPanelUi.authorLineEdit->text().isEmpty() &&
|
||||
m_gitSubmitPanelUi.emailLineEdit->text().isEmpty();
|
||||
|
||||
m_gitSubmitPanelUi.invalidAuthorLabel->
|
||||
setVisible(m_gitSubmitPanelUi.authorLineEdit->text().isEmpty());
|
||||
setVisible(m_gitSubmitPanelUi.authorLineEdit->text().isEmpty() && !bothEmpty);
|
||||
m_gitSubmitPanelUi.invalidEmailLabel->
|
||||
setVisible(!emailIsValid());
|
||||
setVisible(!emailIsValid() && !bothEmpty);
|
||||
|
||||
updateSubmitAction();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ GitSettings SettingsPageWidget::settings() const
|
||||
rc.pullRebase = m_ui.pullRebaseCheckBox->isChecked();
|
||||
rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked();
|
||||
rc.omitAnnotationDate = m_ui.omitAnnotationDataCheckBox->isChecked();
|
||||
rc.spaceIgnorantBlame = m_ui.spaceIgnorantBlameCheckBox->isChecked();
|
||||
rc.ignoreSpaceChanges = m_ui.spaceIgnorantBlameCheckBox->isChecked();
|
||||
rc.diffPatience = m_ui.diffPatienceCheckBox->isChecked();
|
||||
rc.winSetHomeEnvironment = m_ui.winHomeCheckBox->isChecked();
|
||||
rc.gitkOptions = m_ui.gitkOptionsLineEdit->text().trimmed();
|
||||
@@ -90,7 +90,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s)
|
||||
m_ui.pullRebaseCheckBox->setChecked(s.pullRebase);
|
||||
m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit);
|
||||
m_ui.omitAnnotationDataCheckBox->setChecked(s.omitAnnotationDate);
|
||||
m_ui.spaceIgnorantBlameCheckBox->setChecked(s.spaceIgnorantBlame);
|
||||
m_ui.spaceIgnorantBlameCheckBox->setChecked(s.ignoreSpaceChanges);
|
||||
m_ui.diffPatienceCheckBox->setChecked(s.diffPatience);
|
||||
m_ui.winHomeCheckBox->setChecked(s.winSetHomeEnvironment);
|
||||
m_ui.gitkOptionsLineEdit->setText(s.gitkOptions);
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<ui version="4.0">
|
||||
<class>Git::Internal::SettingsPage</class>
|
||||
<widget class="QWidget" name="Git::Internal::SettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>361</width>
|
||||
<height>444</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="environmentGroupBox">
|
||||
@@ -130,7 +138,7 @@
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="spaceIgnorantBlameCheckBox">
|
||||
<property name="text">
|
||||
<string>Ignore whitespace changes in annotation</string>
|
||||
<string>Ignore whitespace changes in annotation and diff</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <vcsbase/vcsbaseoutputwindow.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QModelIndex>
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtGui/QStandardItemModel>
|
||||
@@ -167,7 +168,7 @@ QString StashDialog::msgRepositoryLabel(const QString &repository)
|
||||
{
|
||||
return repository.isEmpty() ?
|
||||
tr("<No repository>") :
|
||||
tr("Repository: %1").arg(repository);
|
||||
tr("Repository: %1").arg(QDir::toNativeSeparators(repository));
|
||||
}
|
||||
|
||||
void StashDialog::refresh(const QString &repository, bool force)
|
||||
|
||||
Reference in New Issue
Block a user