# # # rename "tests/automate_netsync/sync.expected" # to "tests/automate_netsync/send_branch.expected" # # add_file "tests/automate_netsync/jane_key.packet" # content [2a688683d2e9cb5f26edbe31cdc2a1c1eb8cf3d5] # # add_file "tests/automate_netsync/john_key.packet" # content [ea896cc1c8bc05cd5ece73ccb36b4c510e3df81a] # # add_file "tests/automate_netsync/sync_keys.expected" # content [e62b6fa3689dfeb51f2117de66be65979aadf2f4] # # patch "NEWS" # from [83b6263c4c4e66d9fb6936bcbc684f7053205a0b] # to [0ef5a7f2c0f7f40491a4cdf80dfa7e5ce018f07e] # # patch "cmd_netsync.cc" # from [3ff8fdc2fd4447fe433c2eaea03d3837f054d466] # to [9ff90bdafea9d32b59192a61962444af61297762] # # patch "monotone.texi" # from [766accbccb43835d476db4c637212d68abcd17fa] # to [cef86f0bb34fe38ee63025be30ae8264e069242a] # # patch "tests/automate_netsync/__driver__.lua" # from [d73f9dbf04372daddec8eb4c38b2a90ab86d5351] # to [c23b58fb5b08d7df7a798f146697585fde9af2b4] # # patch "tests/automate_netsync/send_branch.expected" # from [0863e27fd05569752d17e7f450818338d8d879e6] # to [f4aeadf6bb878ab8c2bc6628d7fc5ba080de0ebd] # ============================================================ --- NEWS 83b6263c4c4e66d9fb6936bcbc684f7053205a0b +++ NEWS 0ef5a7f2c0f7f40491a4cdf80dfa7e5ce018f07e @@ -4,6 +4,9 @@ Xxx Xxx 99 99:99:99 UTC 2010 Changes + - Automate sync, push, and pull now output information about + each transferred revision, cert and key, in basic_io format. + - Changelog editor format simplified; user entered text at top of file, instructions reduced. Edited text is saved if commit is canceled. ============================================================ --- monotone.texi 766accbccb43835d476db4c637212d68abcd17fa +++ monotone.texi cef86f0bb34fe38ee63025be30ae8264e069242a @@ -8514,20 +8514,96 @@ @section Automation options compared to the non-automate versions. Please check this manual in the appropriate section for a full explanation. address@hidden Added in: address@hidden Changes: -12.0 address@hidden address@hidden +FIXME -- add sent/received revision, cert, and key output address@hidden +12.0 -- added address@hidden itemize + @item Purpose: Pushes, pulls or syncs (push & pull) revisions, certificates and keys of the given database to, from or with the given netsync server. @item Sample output (stdio): +Output consists of sent and received revisions, certs, and keys in the +main stdio channel, progress messages, and ticker data for bytes, +revisions, certs and keys. -The following output shows an example of a pull which transferred two revisions -and eight certs. +The following is example main channel data: address@hidden +receive revision +revision [114f6aa58c7707bf83516d4080ca6268c36640ad] + + cert "branch" +value "foo" + key [46ec58576f9e4f34a9eede521422aa5fd299dc50] + + cert "changelog" +value "R1 +" + key [46ec58576f9e4f34a9eede521422aa5fd299dc50] + + cert "date" +value "2010-09-01T12:00:00" + key [46ec58576f9e4f34a9eede521422aa5fd299dc50] + + cert "author" +value "address@hidden" + key [46ec58576f9e4f34a9eede521422aa5fd299dc50] + +receive cert + + cert "test" + value "value" + key [111808abc306fd7423b564f2a8ef5c09745b87d2] +revision [2a46f4b909071fae756b4911a247ce3ff1c3c4ce] + +receive key + +key [111808abc306fd7423b564f2a8ef5c09745b87d2] + +send revision + +revision [2a46f4b909071fae756b4911a247ce3ff1c3c4ce] + + cert "branch" +value "foo2" + key [46ec58576f9e4f34a9eede521422aa5fd299dc50] + + cert "changelog" +value "R2 +" + key [46ec58576f9e4f34a9eede521422aa5fd299dc50] + + cert "date" +value "2010-09-01T12:00:00" + key [46ec58576f9e4f34a9eede521422aa5fd299dc50] + + cert "author" +value "address@hidden" + key [46ec58576f9e4f34a9eede521422aa5fd299dc50] + +send cert + + cert "test" + value "value" + key [46ec58576f9e4f34a9eede521422aa5fd299dc50] +revision [114f6aa58c7707bf83516d4080ca6268c36640ad] + +send key + +key [05c26b6cb109ca39bc48bbbdce83564c97796155] address@hidden verbatim + +The following shows the progress and ticker data for a pull +which transferred two revisions and eight certs. + @emph{Note:} The linebreaks are not part of the actual format, but have been added for better readability. @@ -8557,9 +8633,27 @@ @section Automation @item Output format: -If ran outside of @command{automate stdio}, the output of these commands is -equal to the normal netsync command output. +All stanzas are optional; they are only output if the data they +describe is transferred. +If revisions are received, a header stanza @code{receive +revision}. For each revision, a stanza containing the revision id. For +each cert associated with the revision, a stanza containing the cert +name, value, and key. + +If certs not associated with a transmitted revision are received, a +header stanza @code{receive cert}. For each cert, a stanza giving the cert +name, value, key, and revision. + +If keys are received, a stanza containing one line for each key, +giving the key id. + +Similarly for sent revisions, certs, and keys. + +If run outside of @command{automate stdio}, the progress and ticker +output of these commands is equal to the normal netsync command +progress and ticker output. + If these commands are run over stdio, the stdio ticker format is used (for a description of this format, check @command{automate stdio}). ============================================================ --- cmd_netsync.cc 3ff8fdc2fd4447fe433c2eaea03d3837f054d466 +++ cmd_netsync.cc 9ff90bdafea9d32b59192a61962444af61297762 @@ -577,7 +577,7 @@ print_info_auto(protocol_role role, { { basic_io::stanza st; - st.push_str_pair(syms::receive, syms::key); + st.push_str_pair(syms::send, syms::key); pr.print_stanza(st); } ============================================================ --- tests/automate_netsync/__driver__.lua d73f9dbf04372daddec8eb4c38b2a90ab86d5351 +++ tests/automate_netsync/__driver__.lua c23b58fb5b08d7df7a798f146697585fde9af2b4 @@ -1,4 +1,12 @@ --- Test automate sync/pull/push +-- Test automate sync/pull/push +-- +-- Automate output is done by shared code; there are six formats to test: +-- 1) send revision with certs +-- 2) send certs on existing revision +-- 3) send key +-- 4) receive revision with certs +-- 5) receive certs on existing revision +-- 6) receive key include("/common/netsync.lua") include("/common/automate_stdio.lua") @@ -27,14 +35,14 @@ check(qgrep("no revision 114f6aa58c7707b check(mtn2("automate", "get_revision", R1), 1, nil, true) check(qgrep("no revision 114f6aa58c7707bf83516d4080ca6268c36640ad found in database", "stderr")) --- Pull branch 'foo', confirm output +-- Pull branch 'foo', confirm output; tests 4 get("pull_r1.expected") check(mtn2("automate", "pull", "mtn://" .. srv.address .. "?foo"), 0, true, false) canonicalize("stdout") check(samefile("pull_r1.expected", "stdout")) -- stderr has ticker; we don't check that here --- Push a cert from test2.db to test.db +-- Push a cert from test2.db to test.db; test 2 get("push_cert.expected") check(mtn2("automate", "cert", R1, "test", "value"), 0, nil, nil) check(mtn2("automate", "push", "mtn://" .. srv.address .. "?foo"), 0, true, false) @@ -55,20 +63,21 @@ check(qgrep('name "test"', "stdout")) -- Test 'automate stdio sync' output and ticker --- New file on a new branch in test.db -addfile("testfile2", "blah foo") -commit("foo2", "R2", mtn_date) +-- New file on a new branch in test2.db; tests 1 +writefile("testfile2", "blah foo") +check(mtn2("add", "testfile2"), 0, nil, false) +check(mtn2("commit", "--branch=foo2", "--message=R2", "--date=2010-09-01T12:00:00"), 0, nil, false) R2 = base_revision() srv = netsync.start() local cmd = make_stdio_cmd({"sync", "mtn://" .. srv.address .. "?foo*"}) -get("sync.expected") check(mtn2("automate", "stdio"), 0, true, false, cmd) output = parse_stdio(readfile("stdout"), 0, 0, "m") tickers = parse_stdio(readfile("stdout"), 0, 0, "t") -check(readfile("sync.expected") == output) +get("send_branch.expected") +check(readfile("send_branch.expected") == output) function any_of(tbl, val) for _,v in pairs(tbl) do @@ -89,15 +98,33 @@ check(any_of(tickers, "C:certs out")) check(any_of(tickers, "c:certs in")) check(any_of(tickers, "C:certs out")) -check(not any_of(tickers, "R#1")) -check(any_of(tickers, "r#1")) -check(not any_of(tickers, "C#1")) -check(any_of(tickers, "c#4")) +check(any_of(tickers, "R#1")) +check(not any_of(tickers, "r#1")) +check(any_of(tickers, "C#4")) +check(not any_of(tickers, "c#1")) check(any_of(tickers, "<;>;C;R;c;r;")) srv:stop() --- FIXME: check output format for key transfer +-- push and pull a key; test 3 and 6. Note that keys are not sent +-- unless they are used to sign something; we sign another test cert; +-- tests 5. Can't use 'genkey'; that gives a random key signature +get("john_key.packet") +get("jane_key.packet") +check(mtn("read", "john_key.packet"), 0, nil, false) +check(mtn2("read", "jane_key.packet"), 0, nil, false) +check(mtn("address@hidden", "cert", R2, "test", "value"), 0, nil, nil) +check(mtn2("address@hidden", "cert", R2, "test", "value"), 0, nil, nil) + +srv = netsync.start() +local cmd = make_stdio_cmd({"sync", "mtn://" .. srv.address .. "?*"}) +check(mtn2("automate", "stdio"), 0, true, false, cmd) +get("sync_keys.expected") + +output = parse_stdio(readfile("stdout"), 0, 0, "m") + +check(readfile("sync_keys.expected") == output) + -- end of file ============================================================ --- tests/automate_netsync/sync.expected 0863e27fd05569752d17e7f450818338d8d879e6 +++ tests/automate_netsync/send_branch.expected f4aeadf6bb878ab8c2bc6628d7fc5ba080de0ebd @@ -1,4 +1,4 @@ -receive revision +send revision revision [2a46f4b909071fae756b4911a247ce3ff1c3c4ce] ============================================================ --- /dev/null +++ tests/automate_netsync/jane_key.packet 2a688683d2e9cb5f26edbe31cdc2a1c1eb8cf3d5 @@ -0,0 +1,4 @@ +[keypair address@hidden +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpTLGrG9xdDSUiMe0zFwksREDzpxfsB/Fv9egIQ9e2zP3QUwuWbeiRnFfo1tteUhtLysOFE24jUop2IGmqRXLuHwFqRxMIAcbCiG9LoGE6F86ja6A+OQceU0OcRUhjTIn8Ftq2O0bK2k6n+E09WtBwJkx5sflsBaOUF0vSsDQKKQIDAQAB# +MIICyTBDBgkqhkiG9w0BBQ0wNjAeBgkqhkiG9w0BBQwwEQQIBb9/2ltnlpsCAggAAgEYMBQGCCqGSIb3DQMHBAi3LLIVEVsmsASCAoDGjVUXUjDdf1DY8pk6j1gXFQrkOE/+1udZ8CC3asW38N/jz8urBFwnSGplXKtVG5WK3bsDRrHbs1txwHKhnGJWGrSgednAEqqtCPFOscCssPJ5BX7dfTQgV6tLfrVWkru3iyG/hLm0IgmXSjfgbe28DN3k6GSb/d2WHp+AP4iaXJZHXADDNf9OfRS/cfmFcUUb7RMORJQtaunqOtj+KtkYspv92rh+oE/Z0Hu9fDYaWygxnM8TO3YE9hoA/YMGx0w9lpFKbeATE/EW+R24wFOElPV6gxN4zGHiwMT+FRfMJxzKLk3TDCgZz6cQokrDr90vua0HjBQYReVdR5Gya9KEjquUDPwXpiRi/qj0NnoDvNkYFXIj7UGCk3tR2A2OnoPLvptERMRbBWxdlgV52b3tJU1ebrtJXh/ghzkRxuhiUSyZAp6sPbnxX/dUJYiq0CDWte3QBSWDTKCoTNBwrHdaCnKWNJtM9IeemyugQLW1EsxDZfzdm6sqAo5pqfIFZVR4RyY+BWnJy+aMxcoXExfMNlHgGB+crG923QOq9/d+uKDjBO+QrXlJDTbgY8ndxaXBQK8M4B+oS66gCrGnv71GK2I+n83aK/brdNn1k4R1aABJu2vC6aX6NpThGoIZyHmEtLH6OF55VPF28SNEPzXRuGVpeFQTJBi4MUCy74AK1DIQHL516G538u5hmiaIfQctKbPevEHTe1Ihzu8D9ZdUuxLE/MWb98CIebnvLKcpP/6so7BZXVW6Y5eZwenQXdXIu791UbNt+R40Gti8xUWXLrcZwEoc7z1B6gmN9kXT+8BhlRuZpuQbTdp6LWmXrob6lr3jipnmKIQjA+vc5UCa +[end] ============================================================ --- /dev/null +++ tests/automate_netsync/john_key.packet ea896cc1c8bc05cd5ece73ccb36b4c510e3df81a @@ -0,0 +1,4 @@ +[keypair address@hidden +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCcKdoMzkn/gGvW5zhdyeHJR7AY76l8t0N5TJb7Fpwgd2V1n7xorqTc0qtGqYhCbvbxQzeJ5/h6tRur7Qfms9IpcKkTL0vtUvRRO2gRfCb2aBdDvlyE40OfiA6uYLnqqU6tihwcxpPZc43Pj+OKDn2IwBgaZoxF4wOaYb69TuoBZwIDAQAB# +MIICyTBDBgkqhkiG9w0BBQ0wNjAeBgkqhkiG9w0BBQwwEQQIWkSATsVWEecCAggAAgEYMBQGCCqGSIb3DQMHBAg69HBcSNl5FQSCAoA9XF1JLYyXplyi0mMIZpBJr0TIAl8+VRKxRsgO9QDdO2Xzkh3U+EwL/H8RQ+gM3L7jL1MWJ6c1dqROUYYr+yuWioPDfTxhX6eSb6vtkGdU+3BNXEWivoMCpIkqGzQMe+ivpTzK8BMqXUWYqfZk++tsEXV//3o6bgQ8uTfLMDfAaAQ3wA4vK5JSGUIz4ioQDplPk5LPsfA3Ra1fP6j8wk2luFxuIy5OQoJCAlEcUd1BT//PQs8+clEomDa4IUUBZh2X7ZUzIGGG2OEsXr8hEKCvWehTO6BcAXW9aH+vq3avmJFDo5edYMHgerOzV5+ardRia8idfDbftGBqaisGlJu7RkjB8DyVI/0AeZDgghdGXtVH+HMK4QdymglqXvmuoGozz5o7K6k+Lwze+Ey3WsDz4n3J65qCjaToAzWZQyY/ibgSaCWcml+fu5v8AXk1bIE2jhbxQv9pcevL1+6HCX/sQ69ITeEqnXzFSpgGydcE7eUH7N3W+ECe+C0hc99r5Yo/i08ruNsRaRwQLWszXE2f5HdoNYfb9UhPN8RmI7oLfzekk7kCSjwLjEhV70OmVY+Uoopw9BAcIhFYEs9Uj+erTYY5wOV8ga2dNJocJtbpzTUHKKVBGlT7s81OaW//IBnZBJHFzTGWlzQkuzoZjUsZYswGFbOZaV5LmaEEQGfmpRs1q0wflk7MYG5Pqh44Kjzv1wfCbuzCd2ixR3JZ65wlzvnGawArkGYmVuCcyw3fC8h2JFSDvImWhcd7PBl5PGRKSaQ59PvE7j5uYACn/V3gdPh7uGdSRPCXmxhbdo3nvVYAytMLUeKKVaWSag/orEiM0qlG+GWmgYu+T664vvao +[end] ============================================================ --- /dev/null +++ tests/automate_netsync/sync_keys.expected e62b6fa3689dfeb51f2117de66be65979aadf2f4 @@ -0,0 +1,21 @@ +receive cert + + cert "test" + value "value" + key [111808abc306fd7423b564f2a8ef5c09745b87d2] +revision [2a46f4b909071fae756b4911a247ce3ff1c3c4ce] + +receive key + +key [111808abc306fd7423b564f2a8ef5c09745b87d2] + +send cert + + cert "test" + value "value" + key [05c26b6cb109ca39bc48bbbdce83564c97796155] +revision [2a46f4b909071fae756b4911a247ce3ff1c3c4ce] + +send key + +key [05c26b6cb109ca39bc48bbbdce83564c97796155]