# # # patch "netsync.cc" # from [99a29627477839f243d31cdb71a2b8af5705be40] # to [66539579de8731054e928e25e0d7f547df9420dd] # # patch "tests/netsync_negotiation/__driver__.lua" # from [c108ff0e2b49a70a465bdb2f8f829da6fe811c69] # to [2b47c6016c80c0dd8b11b91c5da87ba69ce96429] # ============================================================ --- netsync.cc 99a29627477839f243d31cdb71a2b8af5705be40 +++ netsync.cc 66539579de8731054e928e25e0d7f547df9420dd @@ -1137,7 +1137,14 @@ session::note_cert(id const & i) key_name keyname; rsa_pub_key junk; project.db.get_pubkey(c.key, keyname, junk); - c.marshal_for_netio(keyname, str); + if (version >= 7) + { + c.marshal_for_netio(keyname, str); + } + else + { + c.marshal_for_netio_v6(keyname, str); + } queue_data_cmd(cert_item, i, str); sent_certs.push_back(c); } ============================================================ --- tests/netsync_negotiation/__driver__.lua c108ff0e2b49a70a465bdb2f8f829da6fe811c69 +++ tests/netsync_negotiation/__driver__.lua 2b47c6016c80c0dd8b11b91c5da87ba69ce96429 @@ -29,6 +29,7 @@ function mk_old(ver) return {fn = fn, reset = function () check(remove("test"..ver..".mtn")) + check(remove("test"..ver..".mtn-journal")) check(fn("db", "init")) end } @@ -36,6 +37,7 @@ current = {fn = mtn, reset = function () current = {fn = mtn, reset = function () check(remove("test.db")) + check(remove("test.db-journal")) check(mtn("db", "init")) end } @@ -55,18 +57,37 @@ function check_pair(client, server) end function check_pair(client, server) + -- setup database contents client.reset() do_commits(client.fn, "client") + sleep(2) -- make sure that the date certs are different server.reset() do_commits(server.fn, "server") + -- exchange data local addr = "localhost:" .. math.random(1024, 65535) local srv = bg(server.fn("serve", "--rcfile=netsync.lua", "--bind="..addr), false, false, false) check(client.fn("sync", addr, "testbranch"), 0, false, false, false) sleep(1) srv:finish() + + -- check for correct/matching contents + check_same_stdout(client.fn("automate", "select", "i:"), + server.fn("automate", "select", "i:")) + check_same_stdout(client.fn("heads", "--branch=testbranch"), + server.fn("heads", "--branch=testbranch")) + -- there should be 13 certs - 4 per rev, plus an extra date cert + -- on the common base revision + check(client.fn("db", "info"), 0, true) + check(qgrep("^ *certs .*: *13 *$", "stdout")) + check(server.fn("db", "info"), 0, true) + check(qgrep("^ *certs *: *13 *$", "stdout")) end -check_pair(current, version6) -check_pair(version6, current) +function check_against(other) + check_pair(current, other) + check_pair(other, current) +end + +check_against(version6)