mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Update plist delta code
This commit is contained in:
@@ -143,21 +143,21 @@ namespace plist
|
||||
dictionary_t const& plist = *it;
|
||||
if(plist.find("isDelta") != plist.end())
|
||||
{
|
||||
if(plist.find("deleted") != plist.end())
|
||||
auto deletedIt = plist.find("deleted");
|
||||
if(array_t const* deleted = deletedIt != plist.end() ? boost::get<array_t>(&deletedIt->second) : nullptr)
|
||||
{
|
||||
array_t const& deleted = boost::get<array_t>(plist.find("deleted")->second);
|
||||
iterate(it, deleted)
|
||||
for(auto item : *deleted)
|
||||
{
|
||||
if(std::string const* str = boost::get<std::string>(&*it))
|
||||
if(std::string const* str = boost::get<std::string>(&item))
|
||||
erase_key_path(res, *str);
|
||||
}
|
||||
}
|
||||
|
||||
if(plist.find("changed") != plist.end())
|
||||
auto changedIt = plist.find("changed");
|
||||
if(dictionary_t const* changed = changedIt != plist.end() ? boost::get<dictionary_t>(&changedIt->second) : nullptr)
|
||||
{
|
||||
dictionary_t const& changed = boost::get<dictionary_t>(plist.find("changed")->second);
|
||||
iterate(it, changed)
|
||||
update_key_path(res, it->first, it->second);
|
||||
for(auto pair : *changed)
|
||||
update_key_path(res, pair.first, pair.second);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -71,9 +71,7 @@ void test_delta ()
|
||||
|
||||
OAK_ASSERT_EQ(to_s(plist::create_delta(oldPlist, newPlist)), to_s(deltaPlist));
|
||||
|
||||
std::vector<plist::dictionary_t> plists;
|
||||
plists.push_back(deltaPlist);
|
||||
plists.push_back(oldPlist);
|
||||
std::vector<plist::dictionary_t> plists{ deltaPlist, oldPlist };
|
||||
OAK_ASSERT_EQ(to_s(plist::merge_delta(plists)), to_s(newPlist));
|
||||
|
||||
// =======================
|
||||
@@ -117,8 +115,6 @@ void test_delta_settings ()
|
||||
plist::dictionary_t const newPlist = boost::get<plist::dictionary_t>(plist::parse_ascii(newPlistString));
|
||||
plist::dictionary_t const deltaPlist = boost::get<plist::dictionary_t>(plist::parse_ascii(deltaPlistString));
|
||||
|
||||
std::vector<plist::dictionary_t> plists;
|
||||
plists.push_back(deltaPlist);
|
||||
plists.push_back(oldPlist);
|
||||
std::vector<plist::dictionary_t> plists{ deltaPlist, oldPlist };
|
||||
OAK_ASSERT_EQ(to_s(plist::merge_delta(plists)), to_s(newPlist));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user