Optionally use HTTP repository.

- disabled by default since needs much testing.
This commit is contained in:
James Turner
2016-02-21 21:49:20 +02:00
parent ae4d96872d
commit d179fccfcb
+16 -8
View File
@@ -22,10 +22,7 @@
// //
// $Id$ // $Id$
#ifdef HAVE_CONFIG_H #include <simgear_config.h>
# include <simgear_config.h>
#endif
#include <simgear/compiler.h> #include <simgear/compiler.h>
#ifdef HAVE_WINDOWS_H #ifdef HAVE_WINDOWS_H
@@ -50,7 +47,6 @@
#include <string> #include <string>
#include <map> #include <map>
#include <simgear/compiler.h>
#include <simgear/version.h> #include <simgear/version.h>
#include "terrasync.hxx" #include "terrasync.hxx"
@@ -64,6 +60,7 @@
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <simgear/io/HTTPClient.hxx> #include <simgear/io/HTTPClient.hxx>
#include <simgear/io/SVNRepository.hxx> #include <simgear/io/SVNRepository.hxx>
#include <simgear/io/HTTPRepository.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
static const bool svn_built_in_available = true; static const bool svn_built_in_available = true;
@@ -258,6 +255,10 @@ public:
void setSvnServer(string server) { _svn_server = stripPath(server);} void setSvnServer(string server) { _svn_server = stripPath(server);}
void setSvnDataServer(string server) { _svn_data_server = stripPath(server);} void setSvnDataServer(string server) { _svn_data_server = stripPath(server);}
void setHTTPServer(const std::string& server)
{
_httpServer = stripPath(server);
}
void setExtSvnUtility(string svn_util) { _svn_command = simgear::strutils::strip(svn_util);} void setExtSvnUtility(string svn_util) { _svn_command = simgear::strutils::strip(svn_util);}
void setRsyncServer(string server) { _rsync_server = simgear::strutils::strip(server);} void setRsyncServer(string server) { _rsync_server = simgear::strutils::strip(server);}
@@ -324,6 +325,7 @@ private:
string _rsync_server; string _rsync_server;
string _local_dir; string _local_dir;
SGPath _persistentCachePath; SGPath _persistentCachePath;
string _httpServer;
}; };
SGTerraSync::SvnThread::SvnThread() : SGTerraSync::SvnThread::SvnThread() :
@@ -651,11 +653,16 @@ void SGTerraSync::SvnThread::updateSyncSlot(SyncSlot &slot)
} // of creating directory step } // of creating directory step
string serverUrl(_svn_server); string serverUrl(_svn_server);
if (slot.currentItem._type == SyncItem::AIData) { if (!_httpServer.empty()) {
serverUrl = _svn_data_server; slot.repository.reset(new HTTPRepository(path, &_http));
serverUrl = _httpServer;
} else {
if (slot.currentItem._type == SyncItem::AIData) {
serverUrl = _svn_data_server;
}
slot.repository.reset(new SVNRepository(path, &_http));
} }
slot.repository.reset(new SVNRepository(path, &_http));
slot.repository->setBaseUrl(serverUrl + "/" + slot.currentItem._dir); slot.repository->setBaseUrl(serverUrl + "/" + slot.currentItem._dir);
slot.repository->update(); slot.repository->update();
@@ -906,6 +913,7 @@ void SGTerraSync::reinit()
if (_terraRoot->getBoolValue("enabled",false)) if (_terraRoot->getBoolValue("enabled",false))
{ {
_svnThread->setSvnServer(_terraRoot->getStringValue("svn-server","")); _svnThread->setSvnServer(_terraRoot->getStringValue("svn-server",""));
_svnThread->setHTTPServer(_terraRoot->getStringValue("http-server",""));
_svnThread->setSvnDataServer(_terraRoot->getStringValue("svn-data-server","")); _svnThread->setSvnDataServer(_terraRoot->getStringValue("svn-data-server",""));
_svnThread->setRsyncServer(_terraRoot->getStringValue("rsync-server","")); _svnThread->setRsyncServer(_terraRoot->getStringValue("rsync-server",""));
_svnThread->setLocalDir(_terraRoot->getStringValue("scenery-dir","")); _svnThread->setLocalDir(_terraRoot->getStringValue("scenery-dir",""));