forked from qt-creator/qt-creator
Git: Move hasRemotes out of panel data
It is input only, and doesn't belong to the panel Also rename it enablePush Change-Id: I9d5e2246ce76854a54b02e69980214dd35a402ee Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
589d9c7773
commit
c07eaa2a25
@@ -54,7 +54,6 @@ void GitSubmitEditorPanelData::clear()
|
|||||||
email.clear();
|
email.clear();
|
||||||
bypassHooks = false;
|
bypassHooks = false;
|
||||||
pushAction = NoPush;
|
pushAction = NoPush;
|
||||||
hasRemotes = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GitSubmitEditorPanelData::authorString() const
|
QString GitSubmitEditorPanelData::authorString() const
|
||||||
@@ -79,7 +78,9 @@ QDebug operator<<(QDebug d, const GitSubmitEditorPanelData &data)
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommitData::CommitData(CommitType type) : commitType(type)
|
CommitData::CommitData(CommitType type)
|
||||||
|
: commitType(type)
|
||||||
|
, enablePush(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +89,7 @@ void CommitData::clear()
|
|||||||
panelInfo.clear();
|
panelInfo.clear();
|
||||||
panelData.clear();
|
panelData.clear();
|
||||||
amendSHA1.clear();
|
amendSHA1.clear();
|
||||||
|
enablePush = false;
|
||||||
|
|
||||||
files.clear();
|
files.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ struct GitSubmitEditorPanelData
|
|||||||
QString email;
|
QString email;
|
||||||
bool bypassHooks;
|
bool bypassHooks;
|
||||||
PushAction pushAction;
|
PushAction pushAction;
|
||||||
bool hasRemotes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QDebug operator<<(QDebug d, const GitSubmitEditorPanelData &);
|
QDebug operator<<(QDebug d, const GitSubmitEditorPanelData &);
|
||||||
@@ -115,6 +114,7 @@ public:
|
|||||||
QString commitEncoding;
|
QString commitEncoding;
|
||||||
GitSubmitEditorPanelInfo panelInfo;
|
GitSubmitEditorPanelInfo panelInfo;
|
||||||
GitSubmitEditorPanelData panelData;
|
GitSubmitEditorPanelData panelData;
|
||||||
|
bool enablePush;
|
||||||
|
|
||||||
QList<StateFilePair> files;
|
QList<StateFilePair> files;
|
||||||
|
|
||||||
|
|||||||
@@ -3045,7 +3045,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
commitData.panelData.hasRemotes = !synchronousRemotesList(repoDirectory).isEmpty();
|
commitData.enablePush = !synchronousRemotesList(repoDirectory).isEmpty();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ void GitSubmitEditor::setCommitData(const CommitData &d)
|
|||||||
m_amendSHA1 = d.amendSHA1;
|
m_amendSHA1 = d.amendSHA1;
|
||||||
|
|
||||||
GitSubmitEditorWidget *w = submitEditorWidget();
|
GitSubmitEditorWidget *w = submitEditorWidget();
|
||||||
w->initialize(m_commitType, m_workingDirectory, d.panelData, d.panelInfo);
|
w->initialize(m_commitType, m_workingDirectory, d.panelData, d.panelInfo, d.enablePush);
|
||||||
w->setHasUnmerged(false);
|
w->setHasUnmerged(false);
|
||||||
|
|
||||||
setEmptyFileListEnabled(m_commitType == AmendCommit); // Allow for just correcting the message
|
setEmptyFileListEnabled(m_commitType == AmendCommit); // Allow for just correcting the message
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ void GitSubmitEditorWidget::setHasUnmerged(bool e)
|
|||||||
void GitSubmitEditorWidget::initialize(CommitType commitType,
|
void GitSubmitEditorWidget::initialize(CommitType commitType,
|
||||||
const QString &repository,
|
const QString &repository,
|
||||||
const GitSubmitEditorPanelData &data,
|
const GitSubmitEditorPanelData &data,
|
||||||
const GitSubmitEditorPanelInfo &info)
|
const GitSubmitEditorPanelInfo &info,
|
||||||
|
bool enablePush)
|
||||||
{
|
{
|
||||||
if (m_isInitialized)
|
if (m_isInitialized)
|
||||||
return;
|
return;
|
||||||
@@ -108,7 +109,7 @@ void GitSubmitEditorWidget::initialize(CommitType commitType,
|
|||||||
setPanelData(data);
|
setPanelData(data);
|
||||||
setPanelInfo(info);
|
setPanelInfo(info);
|
||||||
|
|
||||||
if (data.hasRemotes && commitType != FixupCommit) {
|
if (enablePush && commitType != FixupCommit) {
|
||||||
QMenu *menu = new QMenu(this);
|
QMenu *menu = new QMenu(this);
|
||||||
menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot()));
|
menu->addAction(tr("&Commit only"), this, SLOT(commitOnlySlot()));
|
||||||
menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot()));
|
menu->addAction(tr("Commit and &Push"), this, SLOT(commitAndPushSlot()));
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ public:
|
|||||||
void initialize(CommitType commitType,
|
void initialize(CommitType commitType,
|
||||||
const QString &repository,
|
const QString &repository,
|
||||||
const GitSubmitEditorPanelData &data,
|
const GitSubmitEditorPanelData &data,
|
||||||
const GitSubmitEditorPanelInfo &info);
|
const GitSubmitEditorPanelInfo &info,
|
||||||
|
bool enablePush);
|
||||||
void refreshLog(const QString &repository);
|
void refreshLog(const QString &repository);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user