P4: Allow for reversal of unchanged files

Allow for reversal of unchanged files in perforce: Just close them again.

Task-number: QTCREATORBUG-3786
Change-Id: I52266b9f7d0bbaf3139cf9fd0ee5e3b47e7a3d58
Reviewed-on: http://codereview.qt.nokia.com/2501
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
This commit is contained in:
Tobias Hunger
2011-08-02 09:40:04 +00:00
parent 4b6d4d08f0
commit dd5ccf3d85

View File

@@ -489,12 +489,15 @@ void PerforcePlugin::revertCurrentFile()
if (result.error)
return;
// "foo.cpp - file(s) not opened on this client."
if (result.stdOut.isEmpty() || result.stdOut.contains(QLatin1String(" - ")))
// also revert when the output is empty: The file is unchanged but open then.
if (result.stdOut.contains(QLatin1String(" - ")) || result.stdErr.contains(QLatin1String(" - ")))
return;
const bool doNotRevert = QMessageBox::warning(0, tr("p4 revert"),
tr("The file has been changed. Do you want to revert it?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No;
bool doNotRevert = false;
if (!result.stdOut.isEmpty())
doNotRevert = (QMessageBox::warning(0, tr("p4 revert"),
tr("The file has been changed. Do you want to revert it?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No);
if (doNotRevert)
return;