forked from qt-creator/qt-creator
VCS[git]: Added git fetch
This commit is contained in:
@@ -1679,6 +1679,16 @@ void GitClient::revert(const QStringList &files, bool revertStaging)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GitClient::synchronousFetch(const QString &workingDirectory)
|
||||||
|
{
|
||||||
|
QStringList arguments(QLatin1String("fetch"));
|
||||||
|
// Disable UNIX terminals to suppress SSH prompting.
|
||||||
|
const unsigned flags = VCSBase::VCSBasePlugin::SshPasswordPrompt|VCSBase::VCSBasePlugin::ShowStdOutInLogWindow
|
||||||
|
|VCSBase::VCSBasePlugin::ShowSuccessMessage;
|
||||||
|
const Utils::SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags);
|
||||||
|
return resp.result == Utils::SynchronousProcessResponse::Finished;
|
||||||
|
}
|
||||||
|
|
||||||
bool GitClient::synchronousPull(const QString &workingDirectory)
|
bool GitClient::synchronousPull(const QString &workingDirectory)
|
||||||
{
|
{
|
||||||
return synchronousPull(workingDirectory, m_settings.pullRebase);
|
return synchronousPull(workingDirectory, m_settings.pullRebase);
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ public:
|
|||||||
unsigned gitVersion(bool silent, QString *errorMessage = 0);
|
unsigned gitVersion(bool silent, QString *errorMessage = 0);
|
||||||
QString gitVersionString(bool silent, QString *errorMessage = 0);
|
QString gitVersionString(bool silent, QString *errorMessage = 0);
|
||||||
|
|
||||||
|
bool synchronousFetch(const QString &workingDirectory);
|
||||||
bool synchronousPull(const QString &workingDirectory);
|
bool synchronousPull(const QString &workingDirectory);
|
||||||
bool synchronousPush(const QString &workingDirectory);
|
bool synchronousPush(const QString &workingDirectory);
|
||||||
|
|
||||||
|
|||||||
@@ -437,6 +437,10 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
globalcontext, true, SLOT(stash()));
|
globalcontext, true, SLOT(stash()));
|
||||||
actionCommand.first->setToolTip(tr("Saves the current state of your work and resets the repository."));
|
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,
|
createRepositoryAction(actionManager, gitContainer,
|
||||||
tr("Pull"), QLatin1String("Git.Pull"),
|
tr("Pull"), QLatin1String("Git.Pull"),
|
||||||
globalcontext, true, SLOT(pull()));
|
globalcontext, true, SLOT(pull()));
|
||||||
@@ -760,6 +764,11 @@ bool GitPlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEdi
|
|||||||
return closeEditor;
|
return closeEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GitPlugin::fetch()
|
||||||
|
{
|
||||||
|
m_gitClient->synchronousFetch(currentState().topLevel());
|
||||||
|
}
|
||||||
|
|
||||||
void GitPlugin::pull()
|
void GitPlugin::pull()
|
||||||
{
|
{
|
||||||
const VCSBase::VCSBasePluginState state = currentState();
|
const VCSBase::VCSBasePluginState state = currentState();
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ private slots:
|
|||||||
void stashSnapshot();
|
void stashSnapshot();
|
||||||
void branchList();
|
void branchList();
|
||||||
void stashList();
|
void stashList();
|
||||||
|
void fetch();
|
||||||
void pull();
|
void pull();
|
||||||
void push();
|
void push();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user