mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
@@ -29,6 +29,7 @@
|
||||
<tbody>
|
||||
<tr><td id="txtLootVersion"></td><td id="lootVersion"></td></tr>
|
||||
<tr><td id="txtMasterlistRevision"></td><td id="masterlistRevision"></td></tr>
|
||||
<tr><td id="txtMasterlistDate"></td><td id="masterlistDate"></td></tr>
|
||||
<tr><td id="txtMasterlistUpdating"></td><td id="masterlistUpdating"></td></tr>
|
||||
<tr><td id="txtTotalMessageNo"></td><td id="totalMessageNo"></td></tr>
|
||||
<tr><td id="txtTotalWarningNo"></td><td id="totalWarningNo"></td></tr>
|
||||
|
||||
@@ -224,6 +224,7 @@ function processURLParams() {
|
||||
/* Fill report with data. */
|
||||
document.getElementById('lootVersion').textContent = data.lootVersion;
|
||||
document.getElementById('masterlistRevision').textContent = data.masterlist.revision;
|
||||
document.getElementById('masterlistDate').textContent = data.masterlist.date;
|
||||
document.getElementById('masterlistUpdating').textContent = data.masterlist.updaterEnabled;
|
||||
var generalMessagesList = document.getElementById('generalMessagesList');
|
||||
for (var i = 0; i < data.globalMessages.length; ++i) {
|
||||
|
||||
@@ -220,6 +220,7 @@ namespace loot {
|
||||
std::list<Message>& messages,
|
||||
const std::list<Plugin>& plugins,
|
||||
const std::string& masterlistVersion,
|
||||
const std::string& masterlistDate,
|
||||
const bool masterlistUpdateEnabled) {
|
||||
|
||||
YAML::Node oldDetails;
|
||||
@@ -253,7 +254,7 @@ namespace loot {
|
||||
yout << YAML::Key << "revision"
|
||||
<< YAML::Value << masterlistVersion
|
||||
<< YAML::Key << "date"
|
||||
<< YAML::Value << ""
|
||||
<< YAML::Value << masterlistDate
|
||||
<< YAML::EndMap;
|
||||
|
||||
if (!plugins.empty()) {
|
||||
@@ -313,6 +314,9 @@ namespace loot {
|
||||
<< YAML::Key << "txtMasterlistRevision"
|
||||
<< YAML::Value << boost::locale::translate("Masterlist Version").str()
|
||||
|
||||
<< YAML::Key << "txtMasterlistDate"
|
||||
<< YAML::Value << boost::locale::translate("Masterlist Date").str()
|
||||
|
||||
<< YAML::Key << "txtMasterlistUpdating"
|
||||
<< YAML::Value << boost::locale::translate("Masterlist Updating").str()
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace loot {
|
||||
std::list<Message>& messages,
|
||||
const std::list<Plugin>& plugins,
|
||||
const std::string& masterlistVersion,
|
||||
const std::string& masterlistDate,
|
||||
const bool masterlistUpdateEnabled);
|
||||
|
||||
//Default settings file generation.
|
||||
|
||||
+16
-4
@@ -154,7 +154,7 @@ namespace loot {
|
||||
}
|
||||
}
|
||||
|
||||
std::string UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages) {
|
||||
std::pair<std::string, std::string> UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages) {
|
||||
pointers_struct ptrs;
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Checking for a Git repository.";
|
||||
@@ -243,7 +243,7 @@ namespace loot {
|
||||
|
||||
bool parsingFailed = false;
|
||||
unsigned int rollbacks = 0;
|
||||
char revision[10];
|
||||
string revision, date;
|
||||
do {
|
||||
string filespec = "refs/remotes/origin/" + game.RepoBranch() + "~" + IntToString(rollbacks);
|
||||
BOOST_LOG_TRIVIAL(trace) << "Getting the Git object for the tree at " << filespec;
|
||||
@@ -253,7 +253,17 @@ namespace loot {
|
||||
const git_oid * oid = git_object_id(ptrs.obj);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Generating hex string for Git object ID.";
|
||||
git_oid_tostr(revision, 10, oid);
|
||||
char sha1[10];
|
||||
git_oid_tostr(sha1, 10, oid);
|
||||
revision = sha1;
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Getting date for Git object ID.";
|
||||
handle_error(git_commit_lookup(&ptrs.commit, ptrs.repo, oid), ptrs);
|
||||
git_time_t time = git_commit_time(ptrs.commit);
|
||||
boost::locale::date_time dateTime(time);
|
||||
stringstream out;
|
||||
out << boost::locale::as::ftime("%Y-%m-%d") << dateTime;
|
||||
date = out.str();
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Recreating HEAD as a direct reference (overwriting it) to the desired revision.";
|
||||
handle_error(git_reference_create(&ptrs.ref, ptrs.repo, "HEAD", oid, 1), ptrs);
|
||||
@@ -265,8 +275,10 @@ namespace loot {
|
||||
BOOST_LOG_TRIVIAL(trace) << "Freeing pointers.";
|
||||
git_object_free(ptrs.obj);
|
||||
git_reference_free(ptrs.ref);
|
||||
git_commit_free(ptrs.commit);
|
||||
ptrs.obj = NULL;
|
||||
ptrs.ref = NULL;
|
||||
ptrs.commit = NULL;
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Testing masterlist parsing.";
|
||||
|
||||
@@ -307,6 +319,6 @@ namespace loot {
|
||||
//Finally, free memory.
|
||||
ptrs.free();
|
||||
|
||||
return string(revision);
|
||||
return pair<string, string>(revision, date);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
namespace loot {
|
||||
|
||||
std::string UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages);
|
||||
std::pair<std::string, std::string> UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages);
|
||||
|
||||
std::string GetMasterlistRevision(const Game& game);
|
||||
}
|
||||
|
||||
+8
-4
@@ -103,14 +103,16 @@ struct plugin_list_loader {
|
||||
};
|
||||
|
||||
struct masterlist_updater_parser {
|
||||
masterlist_updater_parser(bool doUpdate, loot::Game& game, list<loot::Message>& errors, list<loot::Plugin>& plugins, list<loot::Message>& messages, string& revision) : _doUpdate(doUpdate), _game(game), _errors(errors), _plugins(plugins), _messages(messages), _revision(revision) {}
|
||||
masterlist_updater_parser(bool doUpdate, loot::Game& game, list<loot::Message>& errors, list<loot::Plugin>& plugins, list<loot::Message>& messages, string& revision, string& date) : _doUpdate(doUpdate), _game(game), _errors(errors), _plugins(plugins), _messages(messages), _revision(revision), _date(date) {}
|
||||
|
||||
void operator () () {
|
||||
|
||||
if (_doUpdate) {
|
||||
BOOST_LOG_TRIVIAL(debug) << "Updating masterlist";
|
||||
try {
|
||||
_revision = UpdateMasterlist(_game, _errors, _plugins, _messages);
|
||||
pair<string, string> ret = UpdateMasterlist(_game, _errors, _plugins, _messages);
|
||||
_revision = ret.first;
|
||||
_date = ret.second;
|
||||
} catch (loot::error& e) {
|
||||
_plugins.clear();
|
||||
_messages.clear();
|
||||
@@ -171,6 +173,7 @@ struct masterlist_updater_parser {
|
||||
list<loot::Plugin>& _plugins;
|
||||
list<loot::Message>& _messages;
|
||||
string& _revision;
|
||||
string& _date;
|
||||
};
|
||||
|
||||
bool LOOT::OnInit() {
|
||||
@@ -616,7 +619,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
list<loot::Plugin> plugins;
|
||||
boost::thread_group group;
|
||||
loot::PluginGraph graph;
|
||||
string revision;
|
||||
string revision, date;
|
||||
|
||||
wxProgressDialog *progDia = new wxProgressDialog(translate("LOOT: Working..."),translate("LOOT working..."), 1000, this, wxPD_APP_MODAL|wxPD_AUTO_HIDE|wxPD_ELAPSED_TIME);
|
||||
|
||||
@@ -625,7 +628,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
bool doUpdate = _settings["Update Masterlist"] && _settings["Update Masterlist"].as<bool>();
|
||||
masterlist_updater_parser mup(doUpdate, *_game, messages, mlist_plugins, mlist_messages, revision);
|
||||
masterlist_updater_parser mup(doUpdate, *_game, messages, mlist_plugins, mlist_messages, revision, date);
|
||||
group.create_thread(mup);
|
||||
|
||||
//First calculate the mean plugin size. Store it temporarily in a map to reduce filesystem lookups and file size recalculation.
|
||||
@@ -910,6 +913,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
messages,
|
||||
plugins,
|
||||
revision,
|
||||
date,
|
||||
doUpdate);
|
||||
} catch (std::exception& e) {
|
||||
wxMessageBox(
|
||||
|
||||
Reference in New Issue
Block a user