Wrapped "clone" "diff" "commit"
FossilOrigin-Name: 1207f87a560c9d077c00367a4270c693f7cceee0
This commit is contained in:
parent
895770b14b
commit
a7e759e6a6
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Wrapped\s"push"\sand\s"pull"
|
||||
D 2015-04-26T18:26:39.720
|
||||
C Wrapped\s"clone"\s"diff"\s"commit"
|
||||
D 2015-04-26T18:55:05.691
|
||||
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 4fbc6cbebfa20008c575e0d52d4eafe4b18caf99
|
||||
F src/Bridge.h 8c266069dfe6cfb1a870b09e20c568fb506a0829
|
||||
F src/Bridge.cpp 08019d2826accd56f370981aba8ede3f04c82ccf
|
||||
F src/Bridge.h 329b3e81008d779f4d100f370b41601d49ca025a
|
||||
F src/BrowserWidget.cpp 8b8f545cdff4a4188edc698a1b4777f5df46f056
|
||||
F src/BrowserWidget.h 764d66aa9a93b890298bd0301097739cb4e16597
|
||||
F src/CloneDialog.cpp 812ef7d361c16da21540b7047c9d4d5e74f18539
|
||||
@ -200,8 +200,8 @@ F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp e585e885e496697d180e021deb514b04acdce659
|
||||
F src/MainWindow.h 11328bb6544faca0175b64a88809f13e1da0f488
|
||||
F src/MainWindow.cpp 9016287b46f4d057ea84f438b043723ae611367a
|
||||
F src/MainWindow.h a727aea9b2b453c79682f61157b38a76a873060a
|
||||
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
|
||||
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
|
||||
F src/Utils.cpp f78728e0817b1db23007ba0d2c5c26980ee7ebca
|
||||
@ -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 8d81e12735d7c999ea5fca07c4c1683b68a5ad66
|
||||
R bea6f8fdaa1d3a52307231819083669e
|
||||
P ab5fd401a09cc503168a86761b95c28e52d2875a
|
||||
R 7a32a7081f2b847eaec01d12ff3d24ec
|
||||
U kostas
|
||||
Z ced14dfb75cb5108cd5ba6e92482ad2b
|
||||
Z e11abbb88941df5fe0d707b72a7e29b8
|
||||
|
@ -1 +1 @@
|
||||
ab5fd401a09cc503168a86761b95c28e52d2875a
|
||||
1207f87a560c9d077c00367a4270c693f7cceee0
|
@ -121,6 +121,81 @@ bool Bridge::pullRepository()
|
||||
return runFossil(QStringList() << "pull");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::cloneRepository(const QString& repository, const QUrl& url, const QUrl& proxyUrl)
|
||||
{
|
||||
// Actual command
|
||||
QStringList cmd = QStringList() << "clone";
|
||||
|
||||
// Log Command
|
||||
QStringList logcmd = QStringList() << "fossil" << "clone";
|
||||
|
||||
QString source = url.toString();
|
||||
QString logsource = url.toString(QUrl::RemovePassword);
|
||||
if(url.isLocalFile())
|
||||
{
|
||||
source = url.toLocalFile();
|
||||
logsource = source;
|
||||
}
|
||||
cmd << source << repository;
|
||||
logcmd << logsource << repository;
|
||||
|
||||
if(!proxyUrl.isEmpty())
|
||||
{
|
||||
cmd << "--proxy" << proxyUrl.toString();
|
||||
logcmd << "--proxy" << proxyUrl.toString(QUrl::RemovePassword);
|
||||
}
|
||||
|
||||
log("<b>>"+logcmd.join(" ")+"</b><br>", true);
|
||||
|
||||
// Clone Repo
|
||||
if(!runFossil(cmd, 0, RUNFLAGS_SILENT_INPUT))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::diffFile(const QString &repoFile)
|
||||
{
|
||||
// Run the diff detached
|
||||
return runFossil(QStringList() << "gdiff" << QuotePath(repoFile), 0, RUNFLAGS_DETACHED);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::commitFiles(const QStringList& fileList, const QString& comment)
|
||||
{
|
||||
// Do commit
|
||||
QString comment_fname;
|
||||
{
|
||||
QTemporaryFile temp_file;
|
||||
if(!temp_file.open())
|
||||
return false;
|
||||
|
||||
comment_fname = temp_file.fileName();
|
||||
}
|
||||
|
||||
QFile comment_file(comment_fname);
|
||||
if(!comment_file.open(QIODevice::WriteOnly))
|
||||
return false;
|
||||
|
||||
// Write BOM
|
||||
comment_file.write(reinterpret_cast<const char *>(UTF8_BOM), sizeof(UTF8_BOM));
|
||||
|
||||
// Write Comment
|
||||
comment_file.write(comment.toUtf8());
|
||||
comment_file.close();
|
||||
|
||||
// Generate fossil parameters.
|
||||
QStringList params;
|
||||
params << "commit" << "--message-file" << QuotePath(comment_fname);
|
||||
params << QuotePaths(fileList);
|
||||
|
||||
runFossil(params);
|
||||
QFile::remove(comment_fname);
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::stashList(stashmap_t& stashes)
|
||||
{
|
||||
|
@ -88,13 +88,18 @@ public:
|
||||
bool closeRepository();
|
||||
bool pushRepository();
|
||||
bool pullRepository();
|
||||
bool cloneRepository(const QString &repository, const QUrl &url, const QUrl &proxyUrl);
|
||||
|
||||
bool uiRunning() const;
|
||||
bool startUI(const QString &httpPort);
|
||||
void stopUI();
|
||||
|
||||
bool listFiles(QStringList& files);
|
||||
bool listFiles(QStringList &files);
|
||||
bool stashList(stashmap_t &stashes);
|
||||
bool diffFile(const QString &repoFile);
|
||||
bool commitFiles(const QStringList &fileList, const QString &comment);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
void log(const QString &text, bool isHTML=false)
|
||||
|
@ -524,6 +524,7 @@ void MainWindow::on_actionCloneRepository_triggered()
|
||||
|
||||
stopUI();
|
||||
|
||||
#ifndef BRIDGE_ENABLED
|
||||
// Actual command
|
||||
QStringList cmd = QStringList() << "clone";
|
||||
|
||||
@ -550,6 +551,9 @@ void MainWindow::on_actionCloneRepository_triggered()
|
||||
|
||||
// Clone Repo
|
||||
if(!runFossil(cmd, 0, RUNFLAGS_SILENT_INPUT))
|
||||
#else
|
||||
if(!bridge.cloneRepository(repository, url, url_proxy))
|
||||
#endif
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not clone the repository"), QMessageBox::Ok);
|
||||
return;
|
||||
@ -1736,10 +1740,14 @@ void MainWindow::getStashViewSelection(QStringList &stashNames, bool allIfEmpty)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool MainWindow::diffFile(QString repoFile)
|
||||
bool MainWindow::diffFile(const QString &repoFile)
|
||||
{
|
||||
#ifndef BRIDGE_ENABLED
|
||||
// Run the diff detached
|
||||
return runFossil(QStringList() << "gdiff" << QuotePath(repoFile), 0, RUNFLAGS_DETACHED);
|
||||
#else
|
||||
return bridge.diffFile(repoFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -1956,6 +1964,7 @@ void MainWindow::on_actionCommit_triggered()
|
||||
return;
|
||||
|
||||
// Do commit
|
||||
#ifndef BRIDGE_ENABLED
|
||||
QString comment_fname;
|
||||
{
|
||||
QTemporaryFile temp_file;
|
||||
@ -1997,6 +2006,21 @@ void MainWindow::on_actionCommit_triggered()
|
||||
|
||||
runFossil(params);
|
||||
QFile::remove(comment_fname);
|
||||
#else
|
||||
QStringList files;
|
||||
|
||||
// When a subset of files has been selected, explicitely specify each file.
|
||||
// Otherwise all files will be implicitly committed by fossil. This is necessary
|
||||
// when committing after a merge where fossil thinks that we are trying to do
|
||||
// a partial commit which is not permitted.
|
||||
QStringList all_modified_files;
|
||||
getAllFilenames(all_modified_files, RepoFile::TYPE_MODIFIED);
|
||||
|
||||
if(commit_files.size() != all_modified_files.size())
|
||||
files = commit_files;
|
||||
|
||||
bridge.commitFiles(files, msg);
|
||||
#endif
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class MainWindow : public QMainWindow
|
||||
public:
|
||||
explicit MainWindow(Settings &_settings, QWidget *parent = 0, QString *workspacePath = 0);
|
||||
~MainWindow();
|
||||
bool diffFile(QString repoFile);
|
||||
bool diffFile(const QString& repoFile);
|
||||
void fullRefresh();
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user