Prevent unnecessary dialog when updating with no new changes
FossilOrigin-Name: f718ab845eb859700e230090f2fcbc7ddb068e62
This commit is contained in:
parent
3987a35083
commit
8e21224a5e
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Added\ssupport\sfor\stagging\srevisions
|
||||
D 2015-05-02T18:23:46.760
|
||||
C Prevent\sunnecessary\sdialog\swhen\supdating\swith\sno\snew\schanges
|
||||
D 2015-05-03T09:22:18.712
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -200,14 +200,14 @@ F src/Fossil.cpp 8abdf4c95dfd2728fb11a2a07ea5c05eabba27d6
|
||||
F src/Fossil.h 7954818fa3168d56901f8549ca5ae56987f48a6a
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp 03761f68b681f469b3c01cff7ff6a084c90c1fb4
|
||||
F src/MainWindow.cpp b7d4d636adeb84fece029e234c5eae89576c2dcf
|
||||
F src/MainWindow.h e8b8be6b33e68a894d6ed84597f4767c83daf750
|
||||
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
|
||||
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
|
||||
F src/UpdateDialog.cpp 5f9ff02aeed08ab3a69d0a9a3b3efeefbc38f3d4
|
||||
F src/UpdateDialog.h 93c6ad9bd814f23e431c67bcd01928f33e10a80b
|
||||
F src/Utils.cpp f78728e0817b1db23007ba0d2c5c26980ee7ebca
|
||||
F src/Utils.h 8ad68bd227bd999eb6ea92a70bb4be2d6788d912
|
||||
F src/Utils.cpp 0a95368bb776a5c34c5baa94e490795ac28085db
|
||||
F src/Utils.h 9cc125f59b8d46ff47bbde4c2cf9bc77f8e2553b
|
||||
F src/Workspace.cpp fca14549ff85125a9fb7fd8a2722198055ea9f9a
|
||||
F src/Workspace.h 8c965e73a966432e45ce80f4a223167eeafc3abe
|
||||
F src/main.cpp 2ac8badc2a63fa123ceae53382ce24cfe1b5a54b
|
||||
@ -220,7 +220,7 @@ F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||
F ui/MainWindow.ui 90bbd2df0afd46e82d4a850882a22f30d3bffe38
|
||||
F ui/SettingsDialog.ui 2b7c2870e0054b0f4106f495d85d02c0b814df8b
|
||||
F ui/UpdateDialog.ui 636fd495d481ade1f20a65f79b538b9a49bbf1fa
|
||||
P 48ae56dfa79bc35a51145dd9549e4f3760e76b7f
|
||||
R 6c39d1dbde8de7bab3b96245abf117bf
|
||||
P 579a9a1fb06478cd37359eb106dcabc9c9c5fa5c
|
||||
R 30503d6fb517411a767917fc163e9df3
|
||||
U kostas
|
||||
Z 1552aaa7605ace7a9b84f678a9f0da07
|
||||
Z 75fb60e450053acd43b176a1071af21e
|
||||
|
@ -1 +1 @@
|
||||
579a9a1fb06478cd37359eb106dcabc9c9c5fa5c
|
||||
f718ab845eb859700e230090f2fcbc7ddb068e62
|
@ -85,33 +85,6 @@ struct TreeViewItem
|
||||
Q_DECLARE_METATYPE(TreeViewItem)
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
static QStringMap MakeKeyValues(QStringList lines)
|
||||
{
|
||||
QStringMap res;
|
||||
|
||||
foreach(QString l, lines)
|
||||
{
|
||||
l = l.trimmed();
|
||||
int index = l.indexOf(' ');
|
||||
|
||||
QString key;
|
||||
QString value;
|
||||
if(index!=-1)
|
||||
{
|
||||
key = l.left(index).trimmed();
|
||||
value = l.mid(index).trimmed();
|
||||
}
|
||||
else
|
||||
key = l;
|
||||
|
||||
res.insert(key, value);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspacePath) :
|
||||
QMainWindow(parent),
|
||||
@ -1476,11 +1449,15 @@ void MainWindow::on_actionUpdate_triggered()
|
||||
if(!fossil().updateRepository(res, "", true))
|
||||
return;
|
||||
|
||||
// FIXME: parse "changes: None. Already up-to-date" and avoid dialog
|
||||
|
||||
if(res.length()==0)
|
||||
return;
|
||||
|
||||
QStringMap kv;
|
||||
ParseProperties(kv, res, ':');
|
||||
// If no changes exit
|
||||
if(kv.contains("changes") && kv["changes"].indexOf("None."))
|
||||
return;
|
||||
|
||||
if(!FileActionDialog::run(this, tr("Update"), tr("The following files will be updated.")+"\n"+tr("Are you sure?"), res))
|
||||
return;
|
||||
|
||||
@ -1505,7 +1482,8 @@ void MainWindow::loadFossilSettings()
|
||||
if(!fossil().getFossilSettings(out))
|
||||
return;
|
||||
|
||||
QStringMap kv = MakeKeyValues(out);
|
||||
QStringMap kv;
|
||||
ParseProperties(kv, out);
|
||||
|
||||
for(Settings::mappings_t::iterator it=settings.GetMappings().begin(); it!=settings.GetMappings().end(); ++it)
|
||||
{
|
||||
@ -2213,6 +2191,12 @@ void MainWindow::updateRevision(const QString &revision)
|
||||
if(res.length()==0)
|
||||
return;
|
||||
|
||||
QStringMap kv;
|
||||
ParseProperties(kv, res, ':');
|
||||
// If no changes exit
|
||||
if(kv.contains("changes") && kv["changes"].indexOf("None."))
|
||||
return;
|
||||
|
||||
if(!FileActionDialog::run(this, tr("Update"), tr("The following files will be updated.")+"\n"+tr("Are you sure?"), res))
|
||||
return;
|
||||
|
||||
|
@ -306,3 +306,26 @@ bool ShowExplorerMenu(HWND hwnd, const QString &path, const QPoint &qpoint)
|
||||
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ParseProperties(QStringMap &properties, const QStringList &lines, QChar separator)
|
||||
{
|
||||
properties.clear();
|
||||
foreach(QString l, lines)
|
||||
{
|
||||
l = l.trimmed();
|
||||
int index = l.indexOf(separator);
|
||||
|
||||
QString key;
|
||||
QString value;
|
||||
if(index!=-1)
|
||||
{
|
||||
key = l.left(index).trimmed();
|
||||
value = l.mid(index).trimmed();
|
||||
}
|
||||
else
|
||||
key = l;
|
||||
|
||||
properties.insert(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QMessageBox>
|
||||
#include <QMap>
|
||||
|
||||
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
|
||||
#define FOSSIL_CHECKOUT1 "_FOSSIL_"
|
||||
@ -14,6 +15,9 @@ QMessageBox::StandardButton DialogQuery(QWidget *parent, const QString &title, c
|
||||
QString QuotePath(const QString &path);
|
||||
QStringList QuotePaths(const QStringList &paths);
|
||||
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
void ParseProperties(QStringMap &properties, const QStringList &lines, QChar separator=' ');
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
bool ShowExplorerMenu(HWND hwnd, const QString &path, const QPoint &qpoint);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user