本文整理汇总了C++中GitClient::synchronousReset方法的典型用法代码示例。如果您正苦于以下问题:C++ GitClient::synchronousReset方法的具体用法?C++ GitClient::synchronousReset怎么用?C++ GitClient::synchronousReset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitClient
的用法示例。
在下文中一共展示了GitClient::synchronousReset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkout
void BranchDialog::checkout()
{
if (!Core::DocumentManager::saveAllModifiedDocuments())
return;
QModelIndex idx = selectedIndex();
const QString currentBranch = m_model->fullName(m_model->currentBranch());
const QString nextBranch = m_model->fullName(idx);
const QString popMessageStart = QCoreApplication::applicationName() +
QLatin1Char(' ') + nextBranch + QLatin1String("-AutoStash ");
BranchCheckoutDialog branchCheckoutDialog(this, currentBranch, nextBranch);
GitClient *gitClient = GitPlugin::instance()->client();
if (gitClient->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules)) != GitClient::StatusChanged)
branchCheckoutDialog.foundNoLocalChanges();
QList<Stash> stashes;
gitClient->synchronousStashList(m_repository, &stashes);
foreach (const Stash &stash, stashes) {
if (stash.message.startsWith(popMessageStart)) {
branchCheckoutDialog.foundStashForNextBranch();
break;
}
}
if (!branchCheckoutDialog.hasLocalChanges() &&
!branchCheckoutDialog.hasStashForNextBranch()) {
// No local changes and no Auto Stash - no need to open dialog
m_model->checkoutBranch(idx);
} else if (branchCheckoutDialog.exec() == QDialog::Accepted) {
if (branchCheckoutDialog.makeStashOfCurrentBranch()) {
if (gitClient->synchronousStash(m_repository,
currentBranch + QLatin1String("-AutoStash")).isEmpty()) {
return;
}
} else if (branchCheckoutDialog.moveLocalChangesToNextBranch()) {
if (!gitClient->beginStashScope(m_repository, QLatin1String("Checkout"), NoPrompt))
return;
} else if (branchCheckoutDialog.discardLocalChanges()) {
if (!gitClient->synchronousReset(m_repository))
return;
}
m_model->checkoutBranch(idx);
QString stashName;
gitClient->synchronousStashList(m_repository, &stashes);
foreach (const Stash &stash, stashes) {
if (stash.message.startsWith(popMessageStart)) {
stashName = stash.name;
break;
}
}
if (branchCheckoutDialog.moveLocalChangesToNextBranch())
gitClient->endStashScope(m_repository);
else if (branchCheckoutDialog.popStashOfNextBranch())
gitClient->synchronousStashRestore(m_repository, stashName, true);
}
enableButtons();
}