Lots of work on debugging diff xmit

This commit is contained in:
2021-11-21 13:35:39 -05:00
parent 0881e33c6f
commit b19825aaca
23 changed files with 338 additions and 99 deletions

View File

@@ -172,7 +172,7 @@ void SourceDB::diff(const SourceDB &auth, StreamBuffer *sb) {
SLS.result();
}
bool SourceDB::patch(StreamBuffer *sb) {
bool SourceDB::patch(StreamBuffer *sb, DebugCollector *dbc) {
lua_State *L = lua_state_;
LuaVar db, info;
LuaStack LS(L, db, info);
@@ -182,6 +182,7 @@ bool SourceDB::patch(StreamBuffer *sb) {
std::string fn = sb->read_string();
int sequence = sb->read_int32();
std::string code = sb->read_string();
DebugLine(dbc) << "Source file " << fn << " updated";
if (sequence < 0) {
LS.rawset(db, fn, LuaNil);
} else {
@@ -494,7 +495,7 @@ LuaDefine(unittests_sourcedb, "c") {
LuaAssertStrEq(L, sdb.get("baz"), "<nonexistent>");
// Apply the diffs.
sdb.patch(&sb);
sdb.patch(&sb, nullptr);
// Everything should now be copied to sdb.
LuaAssertStrEq(L, sdb.get("foo"), "1:function foo() print('foo') end:<function>");
@@ -507,7 +508,7 @@ LuaDefine(unittests_sourcedb, "c") {
// Diff and patch
sdb.diff(mdb, &sb);
sdb.patch(&sb);
sdb.patch(&sb, nullptr);
// Verify that it's been updated.
LuaAssertStrEq(L, sdb.get("foo"), "1:function foo() print('foo') end:<function>");
@@ -531,7 +532,7 @@ LuaDefine(unittests_sourcedb, "c") {
LuaAssert(L, sb.fill() == 14);
// Patch.
sdb.patch(&sb);
sdb.patch(&sb, nullptr);
// Verify that it's been updated.
LuaAssertStrEq(L, sdb.get("foo"), "6:function foo() print('foo') end:<function>");