Fossil internal API cleanup
FossilOrigin-Name: ef3e63fb4f82a4a6224f6616f0f70e5546a39243
This commit is contained in:
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
|||||||
C Removed\sfossil()\sconvenience\sfunction
|
C Fossil\sinternal\sAPI\scleanup
|
||||||
D 2015-08-27T09:33:10.940
|
D 2015-08-27T11:05:58.941
|
||||||
F .fossil-settings/manifest a09a968bf05a50058f3ad50132730b719bc39e76
|
F .fossil-settings/manifest a09a968bf05a50058f3ad50132730b719bc39e76
|
||||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||||
@ -226,13 +226,13 @@ F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8
|
|||||||
F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
|
F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
|
||||||
F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
||||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||||
F src/Fossil.cpp fa8cdb249fb39b9cb2bc79793ffc6a2be00a0dfc
|
F src/Fossil.cpp b5da32dd0e273e4ad7935eee3838f04c48bbb249
|
||||||
F src/Fossil.h 7acbd4a9d43f6a11c183dbffd73b71d54a4c5108
|
F src/Fossil.h 4cfb517eaa7ef5b4791e3184bc4bf69a5fabbe01
|
||||||
F src/FslSettingsDialog.cpp e00907d493fba469e48a008aecda88426350b5ac
|
F src/FslSettingsDialog.cpp e00907d493fba469e48a008aecda88426350b5ac
|
||||||
F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7
|
F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7
|
||||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||||
F src/MainWindow.cpp b94d6963f9fd00a81821e28d871eb21dc4764bac
|
F src/MainWindow.cpp f4dc8ec160b51853ecd6de639c04cb1a5be80395
|
||||||
F src/MainWindow.h b01b04325edb926dfb289c2701e6c52e056f9708
|
F src/MainWindow.h b01b04325edb926dfb289c2701e6c52e056f9708
|
||||||
F src/RemoteDialog.cpp d5d39871f319bb760405736ba0caa9e83ec51ea3
|
F src/RemoteDialog.cpp d5d39871f319bb760405736ba0caa9e83ec51ea3
|
||||||
F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d
|
F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d
|
||||||
@ -246,7 +246,7 @@ F src/SettingsDialog.cpp fa0c70eaf0fa7edb15de302d041cdb552fe523d5
|
|||||||
F src/SettingsDialog.h 5eb3ae2cbb00ab5544e1889860f5376f69fe47cd
|
F src/SettingsDialog.h 5eb3ae2cbb00ab5544e1889860f5376f69fe47cd
|
||||||
F src/Utils.cpp fb9fe1caeef47dca310079f8f10b41c838defaa5
|
F src/Utils.cpp fb9fe1caeef47dca310079f8f10b41c838defaa5
|
||||||
F src/Utils.h 4563194b65d0a903ba71b3fec8fc870a8a610f76
|
F src/Utils.h 4563194b65d0a903ba71b3fec8fc870a8a610f76
|
||||||
F src/Workspace.cpp 6f15ea480579f357a3e01dacd1d62c2621961478
|
F src/Workspace.cpp 0548001c0975f84151dc93989cc03e4adaab48f5
|
||||||
F src/Workspace.h 50970993b6f49c0f4dc55ba5954e7e4c2a723539
|
F src/Workspace.h 50970993b6f49c0f4dc55ba5954e7e4c2a723539
|
||||||
F src/main.cpp d8c65ea5e54102e4989fef9fd8cfd4f13ef8a8f0
|
F src/main.cpp d8c65ea5e54102e4989fef9fd8cfd4f13ef8a8f0
|
||||||
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
||||||
@ -261,7 +261,7 @@ F ui/MainWindow.ui e2a18caa7482b3ee0dff477592cdc9574b35fe4f
|
|||||||
F ui/RemoteDialog.ui 424b2d4a3d0162f84fdccf6af02c1cfce07a06f5
|
F ui/RemoteDialog.ui 424b2d4a3d0162f84fdccf6af02c1cfce07a06f5
|
||||||
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
|
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
|
||||||
F ui/SettingsDialog.ui 2e1b6ce7a49100088c5649292c1319e62e0302e1
|
F ui/SettingsDialog.ui 2e1b6ce7a49100088c5649292c1319e62e0302e1
|
||||||
P 7f22404a2284727f7d41d9f00eac2992b6d848f0
|
P 203cc502bcde134935f524fe2dd44a89e228bc62
|
||||||
R 5caf3fc3d2a436faa8ec84feeb9e7642
|
R 38747b7d7999456737da84f056a30072
|
||||||
U Kostas
|
U Kostas
|
||||||
Z 9e495907b04c2ed51de7c9e81eace801
|
Z 98ed98eef89244353213a69a7b31ff7b
|
||||||
|
@ -1 +1 @@
|
|||||||
203cc502bcde134935f524fe2dd44a89e228bc62
|
ef3e63fb4f82a4a6224f6616f0f70e5546a39243
|
@ -10,14 +10,23 @@
|
|||||||
|
|
||||||
static const unsigned char UTF8_BOM[] = { 0xEF, 0xBB, 0xBF };
|
static const unsigned char UTF8_BOM[] = { 0xEF, 0xBB, 0xBF };
|
||||||
|
|
||||||
// 19: [5c46757d4b9765] on 2012-04-22 04:41:15
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static const QRegExp REGEX_STASH("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
|
Fossil::Fossil()
|
||||||
|
: operationAborted(false)
|
||||||
// Listening for HTTP requests on TCP port 8081
|
, uiCallback(0)
|
||||||
static const QRegExp REGEX_PORT(".*TCP port ([0-9]+)\\n", Qt::CaseSensitive);
|
{
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
RepoStatus Fossil::getRepoStatus()
|
void Fossil::Init(UICallback *callback)
|
||||||
|
{
|
||||||
|
uiCallback = callback;
|
||||||
|
fossilPath.clear();
|
||||||
|
workspacePath.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
Fossil::WorkspaceState Fossil::getWorkspaceState()
|
||||||
{
|
{
|
||||||
QStringList res;
|
QStringList res;
|
||||||
int exit_code = EXIT_FAILURE;
|
int exit_code = EXIT_FAILURE;
|
||||||
@ -25,7 +34,7 @@ RepoStatus Fossil::getRepoStatus()
|
|||||||
// We need to determine the reason why fossil has failed
|
// We need to determine the reason why fossil has failed
|
||||||
// so we delay processing of the exit_code
|
// so we delay processing of the exit_code
|
||||||
if(!runFossilRaw(QStringList() << "info", &res, &exit_code, RUNFLAGS_SILENT_ALL))
|
if(!runFossilRaw(QStringList() << "info", &res, &exit_code, RUNFLAGS_SILENT_ALL))
|
||||||
return REPO_NOT_FOUND;
|
return WORKSPACE_STATE_NOTFOUND;
|
||||||
|
|
||||||
bool run_ok = exit_code == EXIT_SUCCESS;
|
bool run_ok = exit_code == EXIT_SUCCESS;
|
||||||
|
|
||||||
@ -42,9 +51,9 @@ RepoStatus Fossil::getRepoStatus()
|
|||||||
if(key=="fossil")
|
if(key=="fossil")
|
||||||
{
|
{
|
||||||
if(value=="incorrect repository schema version")
|
if(value=="incorrect repository schema version")
|
||||||
return REPO_OLD_SCHEMA;
|
return WORKSPACE_STATE_OLDSCHEMA;
|
||||||
else if(value=="not within an open checkout")
|
else if(value=="not within an open checkout")
|
||||||
return REPO_NOT_FOUND;
|
return WORKSPACE_STATE_NOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(run_ok)
|
if(run_ok)
|
||||||
@ -70,11 +79,11 @@ RepoStatus Fossil::getRepoStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return run_ok ? REPO_OK : REPO_NOT_FOUND;
|
return run_ok ? WORKSPACE_STATE_OK : WORKSPACE_STATE_NOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::openRepository(const QString& repositoryPath, const QString& workspacePath)
|
bool Fossil::createWorkspace(const QString& repositoryPath, const QString& workspacePath)
|
||||||
{
|
{
|
||||||
QFileInfo fi(repositoryPath);
|
QFileInfo fi(repositoryPath);
|
||||||
|
|
||||||
@ -82,7 +91,7 @@ bool Fossil::openRepository(const QString& repositoryPath, const QString& worksp
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
QString abspath = fi.absoluteFilePath();
|
QString abspath = fi.absoluteFilePath();
|
||||||
setWorkspacePath(workspacePath);
|
setWorkspace(workspacePath);
|
||||||
setRepositoryFile(abspath);
|
setRepositoryFile(abspath);
|
||||||
|
|
||||||
if(!runFossil(QStringList() << "open" << QuotePath(abspath)))
|
if(!runFossil(QStringList() << "open" << QuotePath(abspath)))
|
||||||
@ -92,7 +101,7 @@ bool Fossil::openRepository(const QString& repositoryPath, const QString& worksp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::newRepository(const QString& repositoryPath)
|
bool Fossil::createRepository(const QString& repositoryPath)
|
||||||
{
|
{
|
||||||
QFileInfo fi(repositoryPath);
|
QFileInfo fi(repositoryPath);
|
||||||
|
|
||||||
@ -105,16 +114,22 @@ bool Fossil::newRepository(const QString& repositoryPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::closeRepository()
|
bool Fossil::closeWorkspace()
|
||||||
{
|
{
|
||||||
if(!runFossil(QStringList() << "close"))
|
if(!runFossil(QStringList() << "close"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
stopUI();
|
stopUI();
|
||||||
setWorkspacePath("");
|
setWorkspace("");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void Fossil::setWorkspace(const QString &_workspacePath)
|
||||||
|
{
|
||||||
|
workspacePath = _workspacePath;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::listFiles(QStringList &files)
|
bool Fossil::listFiles(QStringList &files)
|
||||||
{
|
{
|
||||||
@ -122,13 +137,13 @@ bool Fossil::listFiles(QStringList &files)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::status(QStringList &result)
|
bool Fossil::statusWorkspace(QStringList &result)
|
||||||
{
|
{
|
||||||
return runFossil(QStringList() << "status", &result, RUNFLAGS_SILENT_ALL);
|
return runFossil(QStringList() << "status", &result, RUNFLAGS_SILENT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::pushRepository(const QUrl &url)
|
bool Fossil::pushWorkspace(const QUrl &url)
|
||||||
{
|
{
|
||||||
QStringList params;
|
QStringList params;
|
||||||
params << "push";
|
params << "push";
|
||||||
@ -158,7 +173,7 @@ bool Fossil::pushRepository(const QUrl &url)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::pullRepository(const QUrl &url)
|
bool Fossil::pullWorkspace(const QUrl &url)
|
||||||
{
|
{
|
||||||
QStringList params;
|
QStringList params;
|
||||||
params << "pull";
|
params << "pull";
|
||||||
@ -223,7 +238,7 @@ bool Fossil::cloneRepository(const QString& repository, const QUrl& url, const Q
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::getFossilVersion(QString& version)
|
bool Fossil::getExeVersion(QString& version)
|
||||||
{
|
{
|
||||||
QStringList res;
|
QStringList res;
|
||||||
if(!runFossil(QStringList() << "version", &res, RUNFLAGS_SILENT_ALL) && res.length()==1)
|
if(!runFossil(QStringList() << "version", &res, RUNFLAGS_SILENT_ALL) && res.length()==1)
|
||||||
@ -361,7 +376,7 @@ bool Fossil::renameFile(const QString &beforePath, const QString &afterPath, boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::undoRepository(QStringList &result, bool explainOnly)
|
bool Fossil::undoWorkspace(QStringList &result, bool explainOnly)
|
||||||
{
|
{
|
||||||
QStringList params;
|
QStringList params;
|
||||||
params << "undo";
|
params << "undo";
|
||||||
@ -374,7 +389,7 @@ bool Fossil::undoRepository(QStringList &result, bool explainOnly)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::updateRepository(QStringList &result, const QString &revision, bool explainOnly)
|
bool Fossil::updateWorkspace(QStringList &result, const QString &revision, bool explainOnly)
|
||||||
{
|
{
|
||||||
QStringList params;
|
QStringList params;
|
||||||
params << "update";
|
params << "update";
|
||||||
@ -393,13 +408,13 @@ bool Fossil::updateRepository(QStringList &result, const QString &revision, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::getFossilSettings(QStringList &result)
|
bool Fossil::getSettings(QStringList &result)
|
||||||
{
|
{
|
||||||
return runFossil(QStringList() << "settings", &result, RUNFLAGS_SILENT_ALL);
|
return runFossil(QStringList() << "settings", &result, RUNFLAGS_SILENT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Fossil::setFossilSetting(const QString& name, const QString& value, bool global)
|
bool Fossil::setSetting(const QString& name, const QString& value, bool global)
|
||||||
{
|
{
|
||||||
QStringList params;
|
QStringList params;
|
||||||
|
|
||||||
@ -485,6 +500,9 @@ bool Fossil::stashList(stashmap_t& stashes)
|
|||||||
if(!runFossil(QStringList() << "stash" << "ls", &res, RUNFLAGS_SILENT_ALL))
|
if(!runFossil(QStringList() << "stash" << "ls", &res, RUNFLAGS_SILENT_ALL))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// 19: [5c46757d4b9765] on 2012-04-22 04:41:15
|
||||||
|
static const QRegExp REGEX_STASH("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
|
||||||
|
|
||||||
for(QStringList::iterator line_it=res.begin(); line_it!=res.end(); )
|
for(QStringList::iterator line_it=res.begin(); line_it!=res.end(); )
|
||||||
{
|
{
|
||||||
QString line = *line_it;
|
QString line = *line_it;
|
||||||
@ -714,6 +732,12 @@ bool Fossil::runFossil(const QStringList &args, QStringList *output, int runFlag
|
|||||||
return exit_code == EXIT_SUCCESS;
|
return exit_code == EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void Fossil::abortOperation()
|
||||||
|
{
|
||||||
|
operationAborted = true;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Run fossil. Returns true if execution was successful regardless if fossil
|
// Run fossil. Returns true if execution was successful regardless if fossil
|
||||||
// issued an error
|
// issued an error
|
||||||
@ -1096,9 +1120,6 @@ bool Fossil::startUI(const QString &httpPort)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: when we are sure this works delete this
|
|
||||||
//fossilUI.setParent(parentWidget);
|
|
||||||
|
|
||||||
fossilUI.setProcessChannelMode(QProcess::MergedChannels);
|
fossilUI.setProcessChannelMode(QProcess::MergedChannels);
|
||||||
fossilUI.setWorkingDirectory(getWorkspacePath());
|
fossilUI.setWorkingDirectory(getWorkspacePath());
|
||||||
|
|
||||||
@ -1132,6 +1153,9 @@ bool Fossil::startUI(const QString &httpPort)
|
|||||||
|
|
||||||
fossilUIPort.clear();
|
fossilUIPort.clear();
|
||||||
|
|
||||||
|
// Listening for HTTP requests on TCP port 8081
|
||||||
|
static const QRegExp REGEX_PORT(".*TCP port ([0-9]+)\\n", Qt::CaseSensitive);
|
||||||
|
|
||||||
// Wait for fossil to report the http port
|
// Wait for fossil to report the http port
|
||||||
QString buffer;
|
QString buffer;
|
||||||
while(true)
|
while(true)
|
||||||
|
131
src/Fossil.h
131
src/Fossil.h
@ -10,111 +10,72 @@ class QStringList;
|
|||||||
|
|
||||||
typedef QMap<QString, QString> stashmap_t;
|
typedef QMap<QString, QString> stashmap_t;
|
||||||
|
|
||||||
enum RunFlags
|
|
||||||
{
|
|
||||||
RUNFLAGS_NONE = 0<<0,
|
|
||||||
RUNFLAGS_SILENT_INPUT = 1<<0,
|
|
||||||
RUNFLAGS_SILENT_OUTPUT = 1<<1,
|
|
||||||
RUNFLAGS_SILENT_ALL = RUNFLAGS_SILENT_INPUT | RUNFLAGS_SILENT_OUTPUT,
|
|
||||||
RUNFLAGS_DETACHED = 1<<2,
|
|
||||||
RUNFLAGS_DEBUG = 1<<3,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum RepoStatus
|
|
||||||
{
|
|
||||||
REPO_OK,
|
|
||||||
REPO_NOT_FOUND,
|
|
||||||
REPO_OLD_SCHEMA
|
|
||||||
};
|
|
||||||
|
|
||||||
class Fossil
|
class Fossil
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Fossil()
|
enum WorkspaceState
|
||||||
: operationAborted(false)
|
|
||||||
, uiCallback(0)
|
|
||||||
{
|
{
|
||||||
}
|
WORKSPACE_STATE_OK,
|
||||||
|
WORKSPACE_STATE_NOTFOUND,
|
||||||
|
WORKSPACE_STATE_OLDSCHEMA
|
||||||
|
};
|
||||||
|
|
||||||
void Init(UICallback *callback)
|
Fossil();
|
||||||
{
|
void Init(UICallback *callback);
|
||||||
uiCallback = callback;
|
|
||||||
fossilPath.clear();
|
|
||||||
workspacePath.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool runFossil(const QStringList &args, QStringList *output=0, int runFlags=RUNFLAGS_NONE);
|
// Repositories
|
||||||
bool runFossilRaw(const QStringList &args, QStringList *output, int *exitCode, int runFlags);
|
bool createRepository(const QString &repositoryPath);
|
||||||
|
bool cloneRepository(const QString &repository, const QUrl &url, const QUrl &proxyUrl);
|
||||||
|
|
||||||
|
// Workspace
|
||||||
|
bool createWorkspace(const QString &repositoryPath, const QString& workspacePath);
|
||||||
|
bool closeWorkspace();
|
||||||
|
void setWorkspace(const QString &_workspacePath);
|
||||||
|
bool pushWorkspace(const QUrl& url);
|
||||||
|
bool pullWorkspace(const QUrl& url);
|
||||||
|
bool undoWorkspace(QStringList& result, bool explainOnly);
|
||||||
|
bool updateWorkspace(QStringList& result, const QString& revision, bool explainOnly);
|
||||||
|
bool statusWorkspace(QStringList& result);
|
||||||
|
WorkspaceState getWorkspaceState();
|
||||||
static bool isWorkspace(const QString &path);
|
static bool isWorkspace(const QString &path);
|
||||||
|
|
||||||
RepoStatus getRepoStatus();
|
// Workspace Information
|
||||||
|
const QString &getProjectName() const { return projectName; }
|
||||||
void setWorkspacePath(const QString &workspace)
|
const QString &getRepositoryFile() const { return repositoryFile; }
|
||||||
{
|
const QString &getWorkspacePath() const { return workspacePath; }
|
||||||
workspacePath = workspace;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString &getWorkspacePath() const
|
|
||||||
{
|
|
||||||
return workspacePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString &getProjectName() const
|
|
||||||
{
|
|
||||||
return projectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString &getRepositoryFile() const
|
|
||||||
{
|
|
||||||
return repositoryFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setRepositoryFile(const QString &filename)
|
|
||||||
{
|
|
||||||
repositoryFile = filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool openRepository(const QString &repositoryPath, const QString& workspacePath);
|
|
||||||
bool newRepository(const QString &repositoryPath);
|
|
||||||
bool closeRepository();
|
|
||||||
bool pushRepository(const QUrl& url);
|
|
||||||
bool pullRepository(const QUrl& url);
|
|
||||||
bool cloneRepository(const QString &repository, const QUrl &url, const QUrl &proxyUrl);
|
|
||||||
bool undoRepository(QStringList& result, bool explainOnly);
|
|
||||||
bool updateRepository(QStringList& result, const QString& revision, bool explainOnly);
|
|
||||||
bool getFossilVersion(QString &version);
|
|
||||||
|
|
||||||
bool uiRunning() const;
|
|
||||||
bool startUI(const QString &httpPort);
|
|
||||||
void stopUI();
|
|
||||||
|
|
||||||
|
// Files
|
||||||
bool listFiles(QStringList &files);
|
bool listFiles(QStringList &files);
|
||||||
bool status(QStringList& result);
|
|
||||||
|
|
||||||
bool diffFile(const QString &repoFile, bool graphical);
|
bool diffFile(const QString &repoFile, bool graphical);
|
||||||
bool commitFiles(const QStringList &fileList, const QString &comment, const QString& newBranchName, bool isPrivateBranch);
|
bool commitFiles(const QStringList &fileList, const QString &comment, const QString& newBranchName, bool isPrivateBranch);
|
||||||
bool addFiles(const QStringList& fileList);
|
bool addFiles(const QStringList& fileList);
|
||||||
bool removeFiles(const QStringList& fileList, bool deleteLocal);
|
bool removeFiles(const QStringList& fileList, bool deleteLocal);
|
||||||
bool revertFiles(const QStringList& fileList);
|
bool revertFiles(const QStringList& fileList);
|
||||||
bool renameFile(const QString& beforePath, const QString& afterPath, bool renameLocal);
|
bool renameFile(const QString& beforePath, const QString& afterPath, bool renameLocal);
|
||||||
bool getFossilSettings(QStringList& result);
|
|
||||||
bool setFossilSetting(const QString &name, const QString &value, bool global);
|
// Settings
|
||||||
|
bool getSettings(QStringList& result);
|
||||||
|
bool setSetting(const QString &name, const QString &value, bool global);
|
||||||
|
|
||||||
|
// Remotes
|
||||||
bool setRemoteUrl(const QUrl& url);
|
bool setRemoteUrl(const QUrl& url);
|
||||||
bool getRemoteUrl(QUrl &url);
|
bool getRemoteUrl(QUrl &url);
|
||||||
|
|
||||||
|
// Stashes
|
||||||
bool stashNew(const QStringList& fileList, const QString& name, bool revert);
|
bool stashNew(const QStringList& fileList, const QString& name, bool revert);
|
||||||
bool stashList(stashmap_t &stashes);
|
bool stashList(stashmap_t &stashes);
|
||||||
bool stashApply(const QString& name);
|
bool stashApply(const QString& name);
|
||||||
bool stashDrop(const QString& name);
|
bool stashDrop(const QString& name);
|
||||||
bool stashDiff(const QString& name);
|
bool stashDiff(const QString& name);
|
||||||
|
|
||||||
void abortOperation() { operationAborted = true; }
|
void abortOperation();
|
||||||
|
|
||||||
|
// Tags
|
||||||
bool tagList(QStringMap& tags);
|
bool tagList(QStringMap& tags);
|
||||||
bool tagNew(const QString& name, const QString& revision);
|
bool tagNew(const QString& name, const QString& revision);
|
||||||
bool tagDelete(const QString& name, const QString& revision);
|
bool tagDelete(const QString& name, const QString& revision);
|
||||||
|
|
||||||
|
// Branches
|
||||||
bool branchList(QStringList& branches, QStringList& activeBranches);
|
bool branchList(QStringList& branches, QStringList& activeBranches);
|
||||||
bool branchNew(const QString& name, const QString& revisionBasis, bool isPrivate=false);
|
bool branchNew(const QString& name, const QString& revisionBasis, bool isPrivate=false);
|
||||||
bool branchMerge(QStringList& res, const QString& revision, bool integrate, bool force, bool testOnly);
|
bool branchMerge(QStringList& res, const QString& revision, bool integrate, bool force, bool testOnly);
|
||||||
@ -122,12 +83,32 @@ public:
|
|||||||
const QString &getCurrentRevision() const { return currentRevision; }
|
const QString &getCurrentRevision() const { return currentRevision; }
|
||||||
const QStringList &getActiveTags() const { return activeTags; }
|
const QStringList &getActiveTags() const { return activeTags; }
|
||||||
|
|
||||||
|
// UI
|
||||||
|
bool uiRunning() const;
|
||||||
|
bool startUI(const QString &httpPort);
|
||||||
|
void stopUI();
|
||||||
const QString &getUIHttpPort() const { return fossilUIPort; }
|
const QString &getUIHttpPort() const { return fossilUIPort; }
|
||||||
QString getUIHttpAddress() const;
|
QString getUIHttpAddress() const;
|
||||||
|
|
||||||
void setExecutablePath(const QString &path) { fossilPath = path; }
|
// Fossil executable
|
||||||
|
void setExePath(const QString &path) { fossilPath = path; }
|
||||||
|
bool getExeVersion(QString &version);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum RunFlags
|
||||||
|
{
|
||||||
|
RUNFLAGS_NONE = 0<<0,
|
||||||
|
RUNFLAGS_SILENT_INPUT = 1<<0,
|
||||||
|
RUNFLAGS_SILENT_OUTPUT = 1<<1,
|
||||||
|
RUNFLAGS_SILENT_ALL = RUNFLAGS_SILENT_INPUT | RUNFLAGS_SILENT_OUTPUT,
|
||||||
|
RUNFLAGS_DETACHED = 1<<2,
|
||||||
|
RUNFLAGS_DEBUG = 1<<3,
|
||||||
|
};
|
||||||
|
|
||||||
|
void setRepositoryFile(const QString &filename) { repositoryFile = filename; }
|
||||||
|
bool runFossil(const QStringList &args, QStringList *output=0, int runFlags=RUNFLAGS_NONE);
|
||||||
|
bool runFossilRaw(const QStringList &args, QStringList *output, int *exitCode, int runFlags);
|
||||||
|
|
||||||
void log(const QString &text, bool isHTML=false)
|
void log(const QString &text, bool isHTML=false)
|
||||||
{
|
{
|
||||||
if(uiCallback)
|
if(uiCallback)
|
||||||
|
@ -318,7 +318,7 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
|||||||
uiCallback.init(this);
|
uiCallback.init(this);
|
||||||
// Need to be before applySettings which sets the last workspace
|
// Need to be before applySettings which sets the last workspace
|
||||||
getWorkspace().fossil().Init(&uiCallback);
|
getWorkspace().fossil().Init(&uiCallback);
|
||||||
getWorkspace().fossil().setExecutablePath(settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString());
|
getWorkspace().fossil().setExePath(settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString());
|
||||||
|
|
||||||
applySettings();
|
applySettings();
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ bool MainWindow::openWorkspace(const QString &path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ok open the repository file
|
// Ok open the repository file
|
||||||
if(!getWorkspace().fossil().openRepository(fi.absoluteFilePath(), wkspace))
|
if(!getWorkspace().fossil().createWorkspace(fi.absoluteFilePath(), wkspace))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||||
return false;
|
return false;
|
||||||
@ -507,13 +507,13 @@ void MainWindow::on_actionNewRepository_triggered()
|
|||||||
// Create repository
|
// Create repository
|
||||||
QString repo_abs_path = repo_path_info.absoluteFilePath();
|
QString repo_abs_path = repo_path_info.absoluteFilePath();
|
||||||
|
|
||||||
if(!getWorkspace().fossil().newRepository(repo_abs_path))
|
if(!getWorkspace().fossil().createRepository(repo_abs_path))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not create repository."), QMessageBox::Ok );
|
QMessageBox::critical(this, tr("Error"), tr("Could not create repository."), QMessageBox::Ok );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getWorkspace().fossil().openRepository(repo_abs_path, wkdir))
|
if(!getWorkspace().fossil().createWorkspace(repo_abs_path, wkdir))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||||
return;
|
return;
|
||||||
@ -529,14 +529,14 @@ void MainWindow::on_actionNewRepository_triggered()
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::on_actionCloseRepository_triggered()
|
void MainWindow::on_actionCloseRepository_triggered()
|
||||||
{
|
{
|
||||||
if(getWorkspace().fossil().getRepoStatus()!=REPO_OK)
|
if(getWorkspace().fossil().getWorkspaceState()!=Fossil::WORKSPACE_STATE_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(QMessageBox::Yes !=DialogQuery(this, tr("Close Workspace"), tr("Are you sure you want to close this workspace?")))
|
if(QMessageBox::Yes !=DialogQuery(this, tr("Close Workspace"), tr("Are you sure you want to close this workspace?")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Close Repo
|
// Close Repo
|
||||||
if(!getWorkspace().fossil().closeRepository())
|
if(!getWorkspace().fossil().closeWorkspace())
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Cannot close the workspace.\nAre there still uncommitted changes available?"), QMessageBox::Ok );
|
QMessageBox::critical(this, tr("Error"), tr("Cannot close the workspace.\nAre there still uncommitted changes available?"), QMessageBox::Ok );
|
||||||
return;
|
return;
|
||||||
@ -689,15 +689,15 @@ bool MainWindow::scanWorkspace()
|
|||||||
bool valid = true;
|
bool valid = true;
|
||||||
|
|
||||||
// Load repository info
|
// Load repository info
|
||||||
RepoStatus st = getWorkspace().fossil().getRepoStatus();
|
Fossil::WorkspaceState st = getWorkspace().fossil().getWorkspaceState();
|
||||||
QString status;
|
QString status;
|
||||||
|
|
||||||
if(st==REPO_NOT_FOUND)
|
if(st==Fossil::WORKSPACE_STATE_NOTFOUND)
|
||||||
{
|
{
|
||||||
status = tr("No workspace detected.");
|
status = tr("No workspace detected.");
|
||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
else if(st==REPO_OLD_SCHEMA)
|
else if(st==Fossil::WORKSPACE_STATE_OLDSCHEMA)
|
||||||
{
|
{
|
||||||
status = tr("Old repository schema detected. Consider running 'fossil rebuild'");
|
status = tr("Old repository schema detected. Consider running 'fossil rebuild'");
|
||||||
valid = false;
|
valid = false;
|
||||||
@ -1737,7 +1737,7 @@ void MainWindow::on_actionUndo_triggered()
|
|||||||
QStringList res;
|
QStringList res;
|
||||||
|
|
||||||
// Do test Undo
|
// Do test Undo
|
||||||
if(!getWorkspace().fossil().undoRepository(res, true))
|
if(!getWorkspace().fossil().undoWorkspace(res, true))
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok);
|
||||||
|
|
||||||
if(res.length()>0 && res[0]=="No undo or redo is available")
|
if(res.length()>0 && res[0]=="No undo or redo is available")
|
||||||
@ -1747,7 +1747,7 @@ void MainWindow::on_actionUndo_triggered()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Do Undo
|
// Do Undo
|
||||||
if(!getWorkspace().fossil().undoRepository(res, false))
|
if(!getWorkspace().fossil().undoWorkspace(res, false))
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok);
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
@ -1757,7 +1757,7 @@ void MainWindow::on_actionUndo_triggered()
|
|||||||
void MainWindow::on_actionAbout_triggered()
|
void MainWindow::on_actionAbout_triggered()
|
||||||
{
|
{
|
||||||
QString fossil_ver;
|
QString fossil_ver;
|
||||||
getWorkspace().fossil().getFossilVersion(fossil_ver);
|
getWorkspace().fossil().getExeVersion(fossil_ver);
|
||||||
|
|
||||||
AboutDialog dlg(this, fossil_ver);
|
AboutDialog dlg(this, fossil_ver);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
@ -1781,7 +1781,7 @@ void MainWindow::loadFossilSettings()
|
|||||||
// Also retrieve the fossil global settings
|
// Also retrieve the fossil global settings
|
||||||
QStringList out;
|
QStringList out;
|
||||||
|
|
||||||
if(!getWorkspace().fossil().getFossilSettings(out))
|
if(!getWorkspace().fossil().getSettings(out))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QStringMap kv;
|
QStringMap kv;
|
||||||
@ -1822,7 +1822,7 @@ void MainWindow::on_actionSettings_triggered()
|
|||||||
if(!SettingsDialog::run(this, settings))
|
if(!SettingsDialog::run(this, settings))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getWorkspace().fossil().setExecutablePath(settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString());
|
getWorkspace().fossil().setExePath(settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString());
|
||||||
updateCustomActions();
|
updateCustomActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1844,7 +1844,7 @@ void MainWindow::on_actionFossilSettings_triggered()
|
|||||||
Q_ASSERT(type == Settings::Setting::TYPE_FOSSIL_GLOBAL || type == Settings::Setting::TYPE_FOSSIL_LOCAL);
|
Q_ASSERT(type == Settings::Setting::TYPE_FOSSIL_GLOBAL || type == Settings::Setting::TYPE_FOSSIL_LOCAL);
|
||||||
|
|
||||||
QString value = it.value().Value.toString();
|
QString value = it.value().Value.toString();
|
||||||
getWorkspace().fossil().setFossilSetting(name, value, type == Settings::Setting::TYPE_FOSSIL_GLOBAL);
|
getWorkspace().fossil().setSetting(name, value, type == Settings::Setting::TYPE_FOSSIL_GLOBAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2544,7 +2544,7 @@ void MainWindow::updateRevision(const QString &revision)
|
|||||||
QStringList res;
|
QStringList res;
|
||||||
|
|
||||||
// Do test update
|
// Do test update
|
||||||
if(!getWorkspace().fossil().updateRepository(res, selected_revision, true))
|
if(!getWorkspace().fossil().updateWorkspace(res, selected_revision, true))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not update the repository."), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Error"), tr("Could not update the repository."), QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
@ -2563,7 +2563,7 @@ void MainWindow::updateRevision(const QString &revision)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Do update
|
// Do update
|
||||||
if(!getWorkspace().fossil().updateRepository(res, selected_revision, false))
|
if(!getWorkspace().fossil().updateWorkspace(res, selected_revision, false))
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not update the repository."), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Error"), tr("Could not update the repository."), QMessageBox::Ok);
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
@ -2751,7 +2751,7 @@ void MainWindow::on_actionPushRemote_triggered()
|
|||||||
if(!url.isLocalFile())
|
if(!url.isLocalFile())
|
||||||
KeychainGet(this, url, *settings.GetStore());
|
KeychainGet(this, url, *settings.GetStore());
|
||||||
|
|
||||||
if(!getWorkspace().fossil().pushRepository(url))
|
if(!getWorkspace().fossil().pushWorkspace(url))
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2769,7 +2769,7 @@ void MainWindow::on_actionPullRemote_triggered()
|
|||||||
if(!url.isLocalFile())
|
if(!url.isLocalFile())
|
||||||
KeychainGet(this, url, *settings.GetStore());
|
KeychainGet(this, url, *settings.GetStore());
|
||||||
|
|
||||||
if(!getWorkspace().fossil().pullRepository(url))
|
if(!getWorkspace().fossil().pullWorkspace(url))
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2788,7 +2788,7 @@ void MainWindow::on_actionPush_triggered()
|
|||||||
if(!url.isLocalFile())
|
if(!url.isLocalFile())
|
||||||
KeychainGet(this, url, *settings.GetStore());
|
KeychainGet(this, url, *settings.GetStore());
|
||||||
|
|
||||||
if(!getWorkspace().fossil().pushRepository(url))
|
if(!getWorkspace().fossil().pushWorkspace(url))
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2807,7 +2807,7 @@ void MainWindow::on_actionPull_triggered()
|
|||||||
if(!url.isLocalFile())
|
if(!url.isLocalFile())
|
||||||
KeychainGet(this, url, *settings.GetStore());
|
KeychainGet(this, url, *settings.GetStore());
|
||||||
|
|
||||||
if(!getWorkspace().fossil().pullRepository(url))
|
if(!getWorkspace().fossil().pullWorkspace(url))
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ bool Workspace::switchWorkspace(const QString& workspace, QSettings &store)
|
|||||||
clearState();
|
clearState();
|
||||||
remotes.clear();
|
remotes.clear();
|
||||||
|
|
||||||
fossil().setWorkspacePath("");
|
fossil().setWorkspace("");
|
||||||
if(workspace.isEmpty())
|
if(workspace.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ bool Workspace::switchWorkspace(const QString& workspace, QSettings &store)
|
|||||||
if(!QDir::setCurrent(new_workspace))
|
if(!QDir::setCurrent(new_workspace))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fossil().setWorkspacePath(new_workspace);
|
fossil().setWorkspace(new_workspace);
|
||||||
|
|
||||||
// Load Remotes
|
// Load Remotes
|
||||||
QString workspace_hash = HashString(QDir::toNativeSeparators(new_workspace));
|
QString workspace_hash = HashString(QDir::toNativeSeparators(new_workspace));
|
||||||
@ -339,7 +339,7 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
|||||||
|
|
||||||
// Check if the repository needs integration
|
// Check if the repository needs integration
|
||||||
res.clear();
|
res.clear();
|
||||||
fossil().status(res);
|
fossil().statusWorkspace(res);
|
||||||
isIntegrated = false;
|
isIntegrated = false;
|
||||||
foreach(const QString &l, res)
|
foreach(const QString &l, res)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user