Wrapped "stash" and all remaining calls
We now use explicit calls for non-setting based fossil options (eg remote-url) FossilOrigin-Name: bbbd2f42e643fbd912b6b3a5cc0b744f14cd56b0
This commit is contained in:
parent
79c351c043
commit
be2856d060
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Wrapped\s"settings"
|
||||
D 2015-04-27T15:53:09.050
|
||||
C Wrapped\s"stash"\sand\sall\sremaining\scalls\nWe\snow\suse\sexplicit\scalls\sfor\snon-setting\sbased\sfossil\soptions\s(eg\sremote-url)
|
||||
D 2015-04-27T18:12:04.670
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -184,8 +184,8 @@ F rsrc/icons/fuel.icns 81e535004b62db801a02f3e15d0a33afc9d4070b
|
||||
F rsrc/icons/fuel.ico eb529ab3332a17b9302ef3e851db5b9ebce2a038
|
||||
F rsrc/icons/fuel.png 40daf53b7f6bdcdd0d6aa5ef433d078ec5ea4342
|
||||
F rsrc/resources.qrc 4098be128fd6c045db933d041fe8844b14643a6f
|
||||
F src/Bridge.cpp aa2ebe96902c441f6b39c32f7d38ea7ffab9405d
|
||||
F src/Bridge.h 64ad587c13537066a2294ad76134077a19c4006f
|
||||
F src/Bridge.cpp c7e897ffb89a3cb6ff60931426378dbb60b0432d
|
||||
F src/Bridge.h 4222ac4d1e899516ed62df0e0575d98d10ebac40
|
||||
F src/BrowserWidget.cpp 8b8f545cdff4a4188edc698a1b4777f5df46f056
|
||||
F src/BrowserWidget.h 764d66aa9a93b890298bd0301097739cb4e16597
|
||||
F src/CloneDialog.cpp 812ef7d361c16da21540b7047c9d4d5e74f18539
|
||||
@ -200,7 +200,7 @@ F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp afbca2ef960db0a7adc35b6ce67005203625802b
|
||||
F src/MainWindow.cpp e4136c247097be4bfb38aff1e21e39b96af503e9
|
||||
F src/MainWindow.h a727aea9b2b453c79682f61157b38a76a873060a
|
||||
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
|
||||
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
|
||||
@ -215,7 +215,7 @@ F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f
|
||||
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||
F ui/MainWindow.ui 8677f5c8bca5bf7561d5f64bfdd0cef5157c6ac7
|
||||
F ui/SettingsDialog.ui 2b7c2870e0054b0f4106f495d85d02c0b814df8b
|
||||
P 77ff1ae8697fa89d87f3ca03fc50cf40ce537f24
|
||||
R a372585b2168c96a373b54d319b9d7d6
|
||||
P 2b7585554eaec0b930d78171ee9c6855637cd7ab
|
||||
R 9c542f6043c5ab3e327b2d8ba71458b7
|
||||
U kostas
|
||||
Z c575daebd28a465ba5a799a992716136
|
||||
Z af9c2eb95a699b2e5bce089794310af1
|
||||
|
@ -1 +1 @@
|
||||
2b7585554eaec0b930d78171ee9c6855637cd7ab
|
||||
bbbd2f42e643fbd912b6b3a5cc0b744f14cd56b0
|
@ -309,6 +309,48 @@ bool Bridge::getFossilSettings(QStringList &result)
|
||||
return runFossil(QStringList() << "settings", &result, RUNFLAGS_SILENT_ALL);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::setFossilSetting(const QString& name, const QString& value, bool global)
|
||||
{
|
||||
QStringList params;
|
||||
|
||||
if(value.isEmpty())
|
||||
params << "unset" << name;
|
||||
else
|
||||
params << "settings" << name << value;
|
||||
|
||||
if(global)
|
||||
params << "-global";
|
||||
|
||||
return runFossil(params);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::setRemoteUrl(const QString& url)
|
||||
{
|
||||
QString u = url;
|
||||
|
||||
if(url.isEmpty())
|
||||
u = "off";
|
||||
|
||||
// Run as silent to avoid displaying credentials in the log
|
||||
// FIXME: maybe use a QUrl instead
|
||||
return runFossil(QStringList() << "remote-url" << u, 0, RUNFLAGS_SILENT_INPUT);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::stashNew(const QStringList& fileList, const QString& name, bool revert)
|
||||
{
|
||||
// Do Stash
|
||||
// Snapshot just records the changes into the stash
|
||||
QString command = "snapshot";
|
||||
|
||||
// Save also reverts the stashed files
|
||||
if(revert)
|
||||
command = "save";
|
||||
|
||||
return runFossil(QStringList() << "stash" << command << "-m" << name << QuotePaths(fileList));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::stashList(stashmap_t& stashes)
|
||||
@ -348,6 +390,24 @@ bool Bridge::stashList(stashmap_t& stashes)
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::stashApply(const QString& name)
|
||||
{
|
||||
return runFossil(QStringList() << "stash" << "apply" << name);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::stashDrop(const QString& name)
|
||||
{
|
||||
return runFossil(QStringList() << "stash" << "apply" << name);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::stashDiff(const QString& name)
|
||||
{
|
||||
return runFossil(QStringList() << "stash" << "diff" << name, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static QString ParseFossilQuery(QString line)
|
||||
{
|
||||
@ -459,6 +519,10 @@ bool Bridge::runFossilRaw(const QStringList &args, QStringList *output, int *exi
|
||||
QTextDecoder *decoder = codec->makeDecoder();
|
||||
Q_ASSERT(decoder);
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
size_t input_index = 0;
|
||||
#endif
|
||||
|
||||
while(true)
|
||||
{
|
||||
QProcess::ProcessState state = process.state();
|
||||
@ -483,7 +547,7 @@ bool Bridge::runFossilRaw(const QStringList &args, QStringList *output, int *exi
|
||||
|
||||
#ifdef QT_DEBUG // Log fossil output in debug builds
|
||||
if(!input.isEmpty())
|
||||
qDebug() << input;
|
||||
qDebug() << "[" << ++input_index << "] '" << input.data() << "'\n";
|
||||
#endif
|
||||
|
||||
buffer += decoder->toUnicode(input);
|
||||
@ -536,8 +600,8 @@ bool Bridge::runFossilRaw(const QStringList &args, QStringList *output, int *exi
|
||||
QStringList log_lines = buffer.left(last_line_start).split(EOL_MARK);
|
||||
for(int l=0; l<log_lines.length(); ++l)
|
||||
{
|
||||
// Do not output the last line if it not complete
|
||||
if(l==log_lines.length()-1 && buffer[buffer.length()-1] != EOL_MARK )
|
||||
// Do not output the last line if it not complete. The first one should be ok though
|
||||
if(l>0 && l==log_lines.length()-1 && buffer[buffer.length()-1] != EOL_MARK )
|
||||
continue;
|
||||
|
||||
QString line = log_lines[l].trimmed();
|
||||
|
10
src/Bridge.h
10
src/Bridge.h
@ -97,7 +97,6 @@ public:
|
||||
void stopUI();
|
||||
|
||||
bool listFiles(QStringList &files);
|
||||
bool stashList(stashmap_t &stashes);
|
||||
bool diffFile(const QString &repoFile);
|
||||
bool commitFiles(const QStringList &fileList, const QString &comment);
|
||||
bool addFiles(const QStringList& fileList);
|
||||
@ -107,6 +106,15 @@ public:
|
||||
bool undoRepository(QStringList& result, bool explainOnly);
|
||||
bool updateRepository(QStringList& result, bool explainOnly);
|
||||
bool getFossilSettings(QStringList& result);
|
||||
bool setFossilSetting(const QString &name, const QString &value, bool global);
|
||||
bool setRemoteUrl(const QString &url);
|
||||
|
||||
bool stashNew(const QStringList& fileList, const QString& name, bool revert);
|
||||
bool stashList(stashmap_t &stashes);
|
||||
bool stashApply(const QString& name);
|
||||
bool stashDrop(const QString& name);
|
||||
bool stashDiff(const QString& name);
|
||||
|
||||
private:
|
||||
void log(const QString &text, bool isHTML=false)
|
||||
{
|
||||
|
@ -1441,7 +1441,7 @@ QString MainWindow::getFossilPath()
|
||||
return fossil_exe;
|
||||
}
|
||||
#else
|
||||
|
||||
#if 1
|
||||
bool MainWindow::runFossil(const QStringList &args, QStringList *output, int runFlags)
|
||||
{
|
||||
// Make StatusBar message
|
||||
@ -1453,6 +1453,7 @@ bool MainWindow::runFossil(const QStringList &args, QStringList *output, int run
|
||||
return bridge.runFossil(args, output, runFlags);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::applySettings()
|
||||
@ -2314,7 +2315,9 @@ void MainWindow::loadFossilSettings()
|
||||
Settings::Setting::SettingType type = it->Type;
|
||||
|
||||
// Command types we issue directly on fossil
|
||||
if(type == Settings::Setting::TYPE_FOSSIL_COMMAND)
|
||||
|
||||
//if(type == Settings::Setting::TYPE_FOSSIL_COMMAND)
|
||||
if(name == FOSSIL_SETTING_REMOTE_URL)
|
||||
{
|
||||
// Retrieve existing url
|
||||
QStringList out;
|
||||
@ -2324,6 +2327,8 @@ void MainWindow::loadFossilSettings()
|
||||
continue;
|
||||
}
|
||||
|
||||
Q_ASSERT(type == Settings::Setting::TYPE_FOSSIL_GLOBAL || type == Settings::Setting::TYPE_FOSSIL_LOCAL);
|
||||
|
||||
// Otherwise it must be a fossil setting
|
||||
if(!kv.contains(name))
|
||||
continue;
|
||||
@ -2360,16 +2365,23 @@ void MainWindow::on_actionSettings_triggered()
|
||||
Settings::Setting::SettingType type = it.value().Type;
|
||||
|
||||
// Command types we issue directly on fossil
|
||||
if(type == Settings::Setting::TYPE_FOSSIL_COMMAND)
|
||||
// FIXME: major uglyness with settings management
|
||||
//if(type == Settings::Setting::TYPE_FOSSIL_COMMAND)
|
||||
if(name == FOSSIL_SETTING_REMOTE_URL)
|
||||
{
|
||||
// Run as silent to avoid displaying credentials in the log
|
||||
#ifndef BRIDGE_H
|
||||
runFossil(QStringList() << "remote-url" << QuotePath(it.value().Value.toString()), 0, RUNFLAGS_SILENT_INPUT);
|
||||
#else
|
||||
bridge.setRemoteUrl(it.value().Value.toString());
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
Q_ASSERT(type == Settings::Setting::TYPE_FOSSIL_GLOBAL || type == Settings::Setting::TYPE_FOSSIL_LOCAL);
|
||||
|
||||
QString value = it.value().Value.toString();
|
||||
#ifndef BRIDGE_H
|
||||
QStringList params;
|
||||
|
||||
if(value.isEmpty())
|
||||
@ -2381,6 +2393,9 @@ void MainWindow::on_actionSettings_triggered()
|
||||
params << "-global";
|
||||
|
||||
runFossil(params);
|
||||
#else
|
||||
bridge.setFossilSetting(name, value, type == Settings::Setting::TYPE_FOSSIL_GLOBAL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -2681,11 +2696,15 @@ void MainWindow::on_actionNewStash_triggered()
|
||||
}
|
||||
|
||||
// Do Stash
|
||||
#ifndef BRIDGE_ENABLED
|
||||
QString command = "snapshot";
|
||||
if(revert)
|
||||
command = "save";
|
||||
|
||||
runFossil(QStringList() << "stash" << command << "-m" << stash_name << QuotePaths(stashed_files) );
|
||||
#else
|
||||
bridge.stashNew(stashed_files, stash_name, revert);
|
||||
#endif
|
||||
refresh();
|
||||
}
|
||||
|
||||
@ -2705,7 +2724,11 @@ void MainWindow::on_actionApplyStash_triggered()
|
||||
stashmap_t::iterator id_it = stashMap.find(*it);
|
||||
Q_ASSERT(id_it!=stashMap.end());
|
||||
|
||||
#ifndef BRIDGE_ENABLED
|
||||
if(!runFossil(QStringList() << "stash" << "apply" << *id_it))
|
||||
#else
|
||||
if(!bridge.stashApply(*id_it))
|
||||
#endif
|
||||
{
|
||||
log(tr("Stash application aborted due to errors")+"\n");
|
||||
return;
|
||||
@ -2717,8 +2740,12 @@ void MainWindow::on_actionApplyStash_triggered()
|
||||
{
|
||||
stashmap_t::iterator id_it = stashMap.find(*it);
|
||||
Q_ASSERT(id_it!=stashMap.end());
|
||||
|
||||
#ifndef BRIDGE_ENABLED
|
||||
if(!runFossil(QStringList() << "stash" << "drop" << *id_it))
|
||||
#else
|
||||
if(!bridge.stashDrop(*id_it))
|
||||
#endif
|
||||
|
||||
{
|
||||
log(tr("Stash deletion aborted due to errors")+"\n");
|
||||
return;
|
||||
@ -2746,7 +2773,11 @@ void MainWindow::on_actionDeleteStash_triggered()
|
||||
stashmap_t::iterator id_it = stashMap.find(*it);
|
||||
Q_ASSERT(id_it!=stashMap.end());
|
||||
|
||||
#ifndef BRIDGE_ENABLED
|
||||
if(!runFossil(QStringList() << "stash" << "drop" << *id_it))
|
||||
#else
|
||||
if(!bridge.stashDrop(*id_it))
|
||||
#endif
|
||||
{
|
||||
log(tr("Stash deletion aborted due to errors")+"\n");
|
||||
return;
|
||||
@ -2769,7 +2800,11 @@ void MainWindow::on_actionDiffStash_triggered()
|
||||
Q_ASSERT(id_it!=stashMap.end());
|
||||
|
||||
// Run diff
|
||||
#ifndef BRIDGE_ENABLED
|
||||
runFossil(QStringList() << "stash" << "diff" << *id_it, 0);
|
||||
#else
|
||||
bridge.stashDiff(*id_it);
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -2882,7 +2917,11 @@ void MainWindow::dropEvent(QDropEvent *event)
|
||||
return;
|
||||
|
||||
// Do Add
|
||||
#ifndef BRIDGE_ENABLED
|
||||
runFossil(QStringList() << "add" << QuotePaths(newfiles) );
|
||||
#else
|
||||
bridge.addFiles(newfiles);
|
||||
#endif
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user