monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone: 238c48f5697cd34d450ae6171a


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: 238c48f5697cd34d450ae6171af120da293baf08
Date: Fri, 18 Feb 2011 20:54:35 +0100 (CET)

revision:            238c48f5697cd34d450ae6171af120da293baf08
date:                2011-02-15T05:15:57
author:              Richard Levitte <address@hidden>
branch:              net.venge.monotone
changelog:
merge of '8682990661a2e7bb60fb7082f1e48e6a86a5a111'
     and 'bd6181bab38491272d3de42575135ad4dd397bc7'

manifest:
format_version "1"

new_manifest [cf70a4af6df2f69152e1f6501eae170f52271b5d]

old_revision [8682990661a2e7bb60fb7082f1e48e6a86a5a111]

patch "src/lcs.cc"
 from [fb4049733d44bc08b2961d9b1dda76084db4adad]
   to [a7b9e3b57dea4f4648ca2dd3de5cd301ec36802e]

old_revision [bd6181bab38491272d3de42575135ad4dd397bc7]

rename "contrib/monotone-mail-notify.lua"
    to "extra/mtn-hooks/monotone-mail-notify.lua"

rename "contrib/monotone-mail-notify.sh"
    to "extra/mtn-hooks/monotone-mail-notify"

rename "test/func/common"
    to "test/common"

add_dir "extra/mtn-hooks"

add_dir "test/extra/mail-notify"

add_dir "test/extra/mail-notify/hooks.d"

add_dir "test/extra/mail-notify/scripts"

add_file "test/extra/mail-notify/__driver__.lua"
 content [dd5179702c826ae1b6a205f63a8ea39c7e3fb590]

add_file "test/extra/mail-notify/hooks.d/authorize_mail_notify_commands.lua"
 content [948a7bfa96c89da0265c8b5eda4a99263c74491f]

add_file "test/extra/mail-notify/mime-construct.expected"
 content [56c894acf95b527b9a05de2147e21b1aa1f2b3ce]

add_file "test/extra/mail-notify/scripts/mime-construct"
 content [e8b34e4c59812c2e706f913bf8f7a694588af12c]

add_file "test/extra/mail-notify/scripts/mime-construct-extract"
 content [96cfd2769fa0ea941d9db5d3273d68122c44b12e]

add_file "test/extra/mail-notify/scripts/run-mail-notify"
 content [b90ab9abd71ff563f2492839cff878b947092bd6]

patch "extra/mtn-hooks/monotone-mail-notify"
 from [1e447c16f2f9962374d0ab26fd0d4c2d0f69d7f6]
   to [805853cf58465efb4b65e17c1d0cd8b6593ea955]

patch "extra/mtn-hooks/monotone-mail-notify.lua"
 from [71329cf83f1a56aafea35a6b9f9190a25df258de]
   to [f498fdf33ee9e4a453665f66fb72f0a17a0ee624]

patch "test/common/netsync.lua"
 from [5b18be9929d1d852a5f931fd9756dd30c197c9c6]
   to [042fc7e7d0a551e7e79e7b412f50f854c550e9da]

patch "test/extra/mtn-cleanup/__driver__.lua"
 from [71bb16f84c2b0baf423ac5f04185b11c848642de]
   to [c0a63dd6bbb69d30db6f6b64f7d59f2b5f1d00c7]

patch "test/extra/mtn-cleanup/run-mtn-cleanup"
 from [7cbf07edf271a2491e51fefb8df88c5bdbf0ee2d]
   to [2852670652f5beef553ec756f1522f2a54476fdc]

patch "test/func/(imp)_persistent_netsync_server_-_keys_2/__driver__.lua"
 from [ced4ffc5130603ac1b82c144554a67f73308dbec]
   to [e45abd93530f853fd19fbb63843c2be738569655]

patch 
"test/func/(normal)_netsync_on_partially_unrelated_revisions/__driver__.lua"
 from [79d37ed87fa40ba7e6e4a00fd5662b45dbaf3531]
   to [3d19160403df890d786f257df19bb41f7db70f41]

patch "test/func/(normal)_netsync_revision_with_no_certs/__driver__.lua"
 from [877d8b8f08f37110bbaf6ec9f34163fc08e5cb48]
   to [b567bf3334e38fc85c3364ad44288d8bdb6fe788]

patch "test/func/automate_ancestors/__driver__.lua"
 from [3555788d1dfcdf475b57828e35a6dff1091ed3db]
   to [392ac8090189e02b487a9d54a4a41bb158de2ed1]

patch "test/func/automate_ancestry_difference/__driver__.lua"
 from [687f03320d55546d2cfb300fae7d51259c9805e7]
   to [31b4cd56ba9a24bb18f03d54f58f8c9ccf706b83]

patch "test/func/automate_cert/__driver__.lua"
 from [b9ef3b6aafc09dfb5e296e77d5ca328af543e23c]
   to [ae68b2ee7843b11f0aded45352e0cc39799ca8e0]

patch "test/func/automate_checkout/__driver__.lua"
 from [6411182532fa4a87ba078b04b28f527caac07dd9]
   to [f44404ce7fd6031a62a0b163d41af41f77ec88b4]

patch "test/func/automate_common_ancestors/__driver__.lua"
 from [160e7f614d29d06f1a49223a1448a5e427b9c6a1]
   to [325ad30c549342198f2dec4bb21b79d545f66323]

patch "test/func/automate_descendents/__driver__.lua"
 from [6e65ffe74774c3f662024b3b959e2c062b05612c]
   to [5103d1a72ddb74af5f18b8b5a64bb332f181fd49]

patch "test/func/automate_erase_ancestors/__driver__.lua"
 from [bc2885d75224dd0d39ef378b1fce02a771a019ea]
   to [4caed2c8b03ff1c69c42d43295fb09b21a2f67e6]

patch "test/func/automate_get_options/__driver__.lua"
 from [247e680108f7d2599fbf0e42367f4cc917e73088]
   to [d6a8fc7edabae64341bf2065ffe61717df747ad0]

patch "test/func/automate_graph/__driver__.lua"
 from [9311433fa65de02d9e996af9cfc5e3b0ad2a6ca9]
   to [43a3f4521abbfbfa2dc34951d8c68cc015819ee5]

patch "test/func/automate_heads/__driver__.lua"
 from [44b8a91cf2958045046831ee4ff88ba7244ea946]
   to [899ed274de66856a9f84deef2e0f72592798b2e6]

patch "test/func/automate_identify/__driver__.lua"
 from [8ba0b019d5546dd59e200c9e12746c2ad7ad7265]
   to [4965159462ee7db9422a44ab9380d6b2bc58f66b]

patch "test/func/automate_inventory/__driver__.lua"
 from [0b2f84a2b87b5eec92c2818cbf1b3535631a0922]
   to [7a34ae38083f1a973c40fa4672456cf7c9520cee]

patch "test/func/automate_inventory_ignore_dirs/__driver__.lua"
 from [03f5ad3fdea64dcddd718785513fc10b0feb4156]
   to [7afec31b9343b5e6d95f0d0bc30aa661254d7aeb]

patch "test/func/automate_inventory_options/__driver__.lua"
 from [8e89bdbaa5b76d80d881ccf0946ea16155a26351]
   to [85fd7d1a9845f5de05af7b6a494ad9ae1b0aaa02]

patch "test/func/automate_inventory_restricted/__driver__.lua"
 from [64a999ffcc6aff7410d4576a055e4f82eae2de1a]
   to [8850fc649d0de6a65315715b25144685f4c6244d]

patch "test/func/automate_key_manage/__driver__.lua"
 from [f79fdf0269f9cc2c52d4b59ead0287229ab4b2ef]
   to [cb6433a38a0beeff4fc1b41135d44c22ab799d50]

patch "test/func/automate_keys/__driver__.lua"
 from [a8231081a0e1f0ba0ca2aac057786917c99e6293]
   to [5614fe4f6a1d41ea407e284daaaf56488dbfd27e]

patch "test/func/automate_log/__driver__.lua"
 from [5464e9af1871c162e46633fdd8822dc3bb5b0bb3]
   to [b5a1679367ffd0d504be13ba9d5032b15535adb9]

patch "test/func/automate_netsync/__driver__.lua"
 from [66628a01797d398e1975b28cb602763342bf7472]
   to [c78f2a19ceeb04405f13a12cda8a9fcc6586b165]

patch "test/func/automate_netsync_dryrun/__driver__.lua"
 from [86330dd0aa017dc4ee1c9afb4b69bd3ea75b7e78]
   to [4eb4e91dec8799b4af1de25590c4dddb4a70cf80]

patch "test/func/automate_parents,_automate_children/__driver__.lua"
 from [b1f01aafd20f603f5aa8803ce7c2060f5b34baa4]
   to [df43abc366fd8aef7e40b9cd71c35b137fefccc4]

patch "test/func/automate_show_conflicts_defaults/__driver__.lua"
 from [be2e2034286d216850364195cfa0cf3b0ab084c7]
   to [1db31e9b04fa6410eee236d9270843dc062a8424]

patch "test/func/automate_stdio/__driver__.lua"
 from [f2079f12b35d50480b2e2b96c8e8acd7178a951a]
   to [bf0bcbaabda1fd5e715d066fba5507ecc0c2ee82]

patch "test/func/automate_stdio_band_output/__driver__.lua"
 from [55f82327f09de466c28671504baec545e148add0]
   to [9a5dbb7a13e37d8508bdc6393a684b76c4de6e32]

patch "test/func/automate_stdio_options/__driver__.lua"
 from [84e4676457d226499bab7cf0a491208949a17862]
   to [6587f5b9af6350f3746a278e8ce3fea0f2f2be3c]

patch "test/func/automate_toposort/__driver__.lua"
 from [2b8c1bd3613ce3c2e6fbaf1f053b39fa1d21aee4]
   to [6a9a6214ac8e09fb63c5bbab7d2d31f995787933]

patch "test/func/automate_update/__driver__.lua"
 from [3d8cadaf6c9fcd9ca4bdfb69e51647985d89164a]
   to [cc9ec25a254fd2bd91d4d79b5198cb351ac8352e]

patch "test/func/b_and_h_selectors/__driver__.lua"
 from [fd8e8fcdfd103194f65c97f8bc42847a17d860ee]
   to [5dbf7aeb3df9f24cbd80019dfb944ccab3dcd5c9]

patch "test/func/b_t_and_a_selector_globbing/__driver__.lua"
 from [39d20812db86092429f4c37edd7ff23734a1a2b1]
   to [25048167425a67101b108b5f59b8b2ccaf817302]

patch "test/func/catch_lua_output/__driver__.lua"
 from [f89a1951954b516efa7cfd39e24a1a045140267a]
   to [e97b2923ac087050bd99d2dc74c16876d108a2b0]

patch "test/func/check_later_and_earlier_selectors/__driver__.lua"
 from [f3ab1f5511f5367c72993bbff9d19d7b002b3835]
   to [5dfeaaaa81ce2581352e0d2b978b594b591c243b]

patch 
"test/func/checking_that_certain_commands_ignores_the_contents_of__MTN_options/__driver__.lua"
 from [c3fd58c552a59d37fb32775239223e4cdcead142]
   to [1f0f96220aca1d6116d82b082ae05abc9f4b1938]

patch "test/func/delta_directions/__driver__.lua"
 from [4f32096c299d54b83a2f6d83079af05171501107]
   to [a1ad53a4caafaedfae45eaace241a7e01da3ac0d]

patch "test/func/escaped_selectors/__driver__.lua"
 from [09f94c4bd46c11ba2f68263c92369f4e729d0c42]
   to [ea0f960ad28795528d78ce12621cdf38cd62f776]

patch "test/func/exchanging_work_via_netsync/__driver__.lua"
 from [46b223397783f568ca2bffdae57dc82259489d2a]
   to [6e4d76c937055c2d864d932f26786bf496ffcac1]

patch "test/func/exchanging_work_via_netsync,_with_notes/__driver__.lua"
 from [0be268de9da52c1e06e9d5351c8abc6e079118d2]
   to [23c85d3af1759d61c0b2455bada950aae35699f0]

patch "test/func/exchanging_work_via_netsync_sent_notes/__driver__.lua"
 from [b3e4e1a2107d853ada4ea0e9b76054b50a9aade9]
   to [21c02640bae87917b5647983f6d084a914328223]

patch "test/func/get_netsync_read_permitted/__driver__.lua"
 from [d1e7461bdceab19034a9c20eb033249693d7a903]
   to [bc6b267b1492648e933a6d2782eaf2e926b80ede]

patch "test/func/i_selector/__driver__.lua"
 from [89082b8caae184d6184476c5b28229343c1c4b06]
   to [e1b48e22936451ab7fb69081d89481f6821ef661]

patch "test/func/in_memory_database/__driver__.lua"
 from [24ffdfb8ba9f5a518a8a6bc2a6cf16abce120533]
   to [3ca9dbeffe98a6c19059d7084384ce8076a9ac10]

patch "test/func/m_selector/__driver__.lua"
 from [595d0882c8a144c189c960a4108a993a5c91cef2]
   to [2f345b18ed1d9141b4438ccceddcb22a8d1252dc]

patch "test/func/merge_conflict_with_no_lca/__driver__.lua"
 from [024b58c36ab28c05edd9e308451863c3ae3852be]
   to [ad56bc8fcda1267ec0c2c9d7966e307da373eaed]

patch "test/func/netsync,--exclude,defaults/__driver__.lua"
 from [5e3641b14d78b3762b5311d8c96a6d5b573410de]
   to [c57ad04137a2bcc0acb85d7f44d8d7cf42bf3361]

patch "test/func/netsync,--set-default/__driver__.lua"
 from [a57657e4a57c507335db1d41123a3f30641ffd97]
   to [10b6cc8a23f7edc351a23e43cf84d7961ffb9ea2]

patch "test/func/netsync_client_absorbs_and_checks_epochs/__driver__.lua"
 from [c9ca91058a28985d1e07fba47cc85181580f2a41]
   to [848d65f0f7dbaa3e2cea0e57157c04bf8f41ee8e]

patch "test/func/netsync_client_absorbs_server_key/__driver__.lua"
 from [604f76a83044fc89a53a219c8162c014456b586a]
   to [7c6223e1a0e41e8decfddff1bd95a453068bbcce]

patch "test/func/netsync_default_server_pattern/__driver__.lua"
 from [bb1a0015b7f492d894d80f9041855898ba972781]
   to [d92ada4ccfd219f62cfd6847f409fbaa55ad4204]

patch "test/func/netsync_default_server_pattern_setting/__driver__.lua"
 from [150f75bdedfb03ba5c1516d980f5ff7d6e413bd7]
   to [63d9d9af58e38a3694b89bacd94b139f0957f4a2]

patch "test/func/netsync_dry_run/__driver__.lua"
 from [3c02bbea8649f19f5767b77b9d81cbe1554097ac]
   to [c298f0f823a8418cb4aaaa2715b0378987ac0c35]

patch "test/func/netsync_duplicate_keys/__driver__.lua"
 from [6328976f6951520e6a440f5622355f69429e83df]
   to [999ec499efeb0152488a73bd781da3c8dc8479ee]

patch "test/func/netsync_epoch_refinement/__driver__.lua"
 from [4ed9c46f6864a2c19cb69af2e4126bfe787d1c2c]
   to [e32aaf21b9ae9758e6b1fb6944fe8765e1dd9315]

patch "test/func/netsync_epochs_are_not_sent_upstream_by_pull/__driver__.lua"
 from [4ec9d25eab337911fbab21281d28c945482a0ce6]
   to [55b2d746230ef1b2d14bb1b14fdc90aaacda9db0]

patch "test/func/netsync_hook_errcodes/__driver__.lua"
 from [78865e3aacd8877e82dd219581c9b0154ec05ac2]
   to [ec71c8c29e3fa49ae6bb99053318c2cadf770aed]

patch "test/func/netsync_is_not_interrupted_by_SIGPIPE/__driver__.lua"
 from [10c1772a19c48a2c039276840ecaf8fe2c9af0fa]
   to [67b8ef7389398b5fd657b0520432ee98445f587a]

patch "test/func/netsync_key_hook/__driver__.lua"
 from [f2a9ed3d90567968db34e9c16c90e8a5d4991aef]
   to [87963f895052ee9dd35d513e23004811169bca38]

patch "test/func/netsync_largish_file/__driver__.lua"
 from [135d2f4626dbb41d145e1f271bd165f91bd7839f]
   to [69a20594d3a57fa884a81413b9b62200ce4d777f]

patch "test/func/netsync_mtn_uri_scheme/__driver__.lua"
 from [6c2d5b2b6f84cba96308f502a38a895a9e99a7c7]
   to [63a309016507f1056d581e4e9829840fa38ec494]

patch "test/func/netsync_negotiation/__driver__.lua"
 from [09a831c685d4f9580f66f523a18451ca9f719ce3]
   to [38cd5d9df0e16cf05d59f0d9525ae546a9654f5f]

patch "test/func/netsync_per_server_defaults/__driver__.lua"
 from [a4d8b34fc29bcc93a4293367b63aa3521d7c7639]
   to [2146137c3d8ec845e5decdf959b99f4e900e7b1e]

patch "test/func/netsync_permissions/__driver__.lua"
 from [8a675ebd2b67064a295f5143b2159580d1028ac9]
   to [8c1359d6116c3f34fa45e1680b874e934b8dcf76]

patch "test/func/netsync_permissions_wildcards/__driver__.lua"
 from [e2f74afc72d62bbdf7b07f005844a8401d34b6c0]
   to [4643ff46c5bf825812b0a53084e1194df457d8dd]

patch "test/func/netsync_server_absorbs_and_checks_epochs/__driver__.lua"
 from [cc83b2b114c4065c65f166c731e7b9090892bf83]
   to [16c387d25b45e44637eca1e84ac8ec0f5c6e2103]

patch "test/func/netsync_stop_server/__driver__.lua"
 from [a586b3c09eaac9938b748ee897c161ff8996a375]
   to [f89913a9343985743b456f8a221c259e80b8524d]

patch "test/func/netsync_transfers_public_keys/__driver__.lua"
 from [7c33043f7bea601ceb114aa57853ca0ecdbbdcca]
   to [95b7dc7ea8412bd6af7e265dfed6b6450fd2008d]

patch "test/func/netsync_verifies_server_keys/__driver__.lua"
 from [5300991e6b9c6203f42e47def183fa19b75bb834]
   to [b26b2f863c40c0ebbd39182ef008c07de0877b60]

patch "test/func/netsync_with_globs/__driver__.lua"
 from [9e790fb1196c3ee5cb391cbdcbae847e721e4044]
   to [2242f415e61d4977f344c88b0cddd6b2dbe199c0]

patch "test/func/netsync_with_suspended_branch/__driver__.lua"
 from [3fde78d6b9affcfe2c777f518c04b3e36292d14a]
   to [9acb504be8308fa216a6f07bd6f3cd1e523d554e]

patch "test/func/one-way_netsync_where_the_sink_has_more_epochs/__driver__.lua"
 from [bb8e382b933199a1949323f0d4005db68b6d17bf]
   to [11dc3ee56708a2dafa7afaf530b0bcee7c1e448f]

patch "test/func/p_selector/__driver__.lua"
 from [1cb5dbfc78175a0664e0f854d26558a393055745]
   to [0b69331749ddacb49be07fa5a8e01b77b96ca54e]

patch "test/func/persistent_netsync_server_-_keys/__driver__.lua"
 from [d9a6a5c55dc85ad55f06cb316dc4231ada807e93]
   to [b4bb17dfebf8bc413d894f1d31b2f39f5a19e4ef]

patch "test/func/persistent_netsync_server_-_revs_&_certs/__driver__.lua"
 from [ae88e5fbf13f1c3b47befa86b9e0397e9b835f20]
   to [5762eef2e6f3e762fe927a0686bf7e328cb75508]

patch "test/func/pid_file_cleanup/__driver__.lua"
 from [1454e1b40ac70ac3e3cd8f5b69aa5ffacacece2c]
   to [9cc22aed49c55892ea7e94dba4f5e99f6ba3dae3]

patch 
"test/func/pull_a_netsync_branch_which_has_a_parent_from_another_branch/__driver__.lua"
 from [0c4a245ff7c35951005047da6ec751c4e97f6e3c]
   to [8a9477a2833c59c031adca728830258596f283b8]

patch "test/func/quiet_turns_off_tickers_but_not_warnings/__driver__.lua"
 from [3058caa495242e00ca406633e868782ad6e8cc42]
   to [ef3c98298ac0807c2aa91cf70f114ee5da181529]

patch "test/func/reallyquiet_turns_off_tickers_and_warnings/__driver__.lua"
 from [bf97ebda957c64616410061841545648e8ef192e]
   to [7f2effaecc63f752e3664a6e9700932c314c406f]

patch "test/func/renaming_a_directory/__driver__.lua"
 from [b908875126d5318bae9bdb732f4d027462933f1d]
   to [7efaca5e29484acf7cab748e15d0cba8e1c751ca]

patch "test/func/repeatedly_exchanging_work_via_netsync/__driver__.lua"
 from [30afb928fece485bc82e5afe9beec62e950d9575]
   to [8c5b92d0ae81a14df53b6682cb7fa40d0a355923]

patch "test/func/serve-automate/__driver__.lua"
 from [57e8ccc98c7ae0cc8d380d1fbc2232af5082db87]
   to [d41f819fd49060c45bb154dde614699b0cb938e7]

patch "test/func/serve-automate-single-run/__driver__.lua"
 from [da26b84d7889323d4cc960803a3e3037110533ec]
   to [01013ad10150f9056bee7609338cb09b47d8c677]

patch "test/func/serve_pull_with_--exclude/__driver__.lua"
 from [9c87166a5f1834bccd2ff5c15c80b3fbb7a5872b]
   to [2254d34bfe243e65780a4fa287baf7c7bba556b9]

patch "test/func/server_initiated_sync/__driver__.lua"
 from [e5a103b1c136b150c5fc95271728236d03891694]
   to [8c2877cd29c7f99680f14fb4ef1aa14f601e51bc]

patch "test/func/single_manifest_netsync/__driver__.lua"
 from [ba4868d426f68fadbb35775b82ed2f1ed04c7e8e]
   to [b75cfe7eea627ee6278bcf373d35fe4f74357c1f]

patch "test/func/suspend/__driver__.lua"
 from [61ffae4a8190abd0aab47c070550c458fc7a450f]
   to [85aef4f7bd20330290964d0e5ce7f71679e273f9]

patch "test/func/sync_use_ws_opts/__driver__.lua"
 from [900a68a87633809becb988b49dc9bcbcb7b6437a]
   to [2ef29503c4430c11175964c1157daabb82ed3dc8]

patch "test/func/u_selector/__driver__.lua"
 from [8fe1f6a14eb1c3ce47dc753495c3b5fe1d807e97]
   to [18b46d7976d0947d6fe1b645a4830dd7335b1e6d]

patch "test/func/verbosity/__driver__.lua"
 from [76e572294f85e29b9e390cd3170510dc3ba3b2e5]
   to [8c5464abec138d22008ba4271f34de0a17d74eb0]

patch "test/func/w_selector/__driver__.lua"
 from [75b6c0ec3c3b50dc651acbc938e08778cc166c32]
   to [5f1faf0f0d810217e3048147145c212677bf7bed]

patch "test/src/testlib.lua"
 from [ab15612fd70395e7f7cb9b74a985c7df874c8c07]
   to [6d2a308918594226fa6549ed0268ccaea3921038]

  set "extra/mtn-hooks/monotone-mail-notify"
 attr "mtn:execute"
value "true"

  set "test/extra/mail-notify/scripts/mime-construct"
 attr "mtn:execute"
value "true"

  set "test/extra/mail-notify/scripts/mime-construct-extract"
 attr "mtn:execute"
value "true"

  set "test/extra/mail-notify/scripts/run-mail-notify"
 attr "mtn:execute"
value "true"
============================================================
--- src/lcs.cc	fb4049733d44bc08b2961d9b1dda76084db4adad
+++ src/lcs.cc	a7b9e3b57dea4f4648ca2dd3de5cd301ec36802e
@@ -43,6 +43,14 @@
 
 */
 
+/*
+  This is now understood better. The comments below are all new,
+  most of the variable names that aren't one letter and don't
+  look like x86 registers are new, and there are some complexity
+  fixes so the recursing doesn't make it accidentally O(n^2) in
+  the input length.
+ */
+
 #include "base.hh"
 #include <algorithm>
 #include "vector.hh"
@@ -59,6 +67,62 @@ using std::vector;
 using std::sort;
 using std::vector;
 
+/*
+  http://read.pudn.com/downloads131/sourcecode/delphi_control/558602/O(NP).pdf
+  An O(NP) Sequence Comparison Algorithm
+  Sun Wu, Udi Manber, Gene Myers; University of Arizona
+  Webb Miller; Pennsylvania State University
+  August 1989
+
+  The above paper shows how to find the edit distance between strings in time
+  at worst O(num-deletions * longer-length), and on average
+  O(longer-length + (edit-distance * num-deletions)).
+
+
+  Name the two input strings "a" and "b", "a" being the shorter one. Consider
+  and edit graph with a going down (x coordinate) and b going across (y coord).
+
+   stringBislonger
+  s\       \.
+  t \       .
+  r  \      .
+  i   \   \ .
+  n    \    . \    .
+  g     X   .
+  A      .
+
+  You start in the top left corner, and want to end up in the lower right
+  corner. There are 3 ways you can move: follow a diagonal for zero cost,
+  or move directly down or directly right for a cost of one. The total cost
+  of the cheapest path is the edit distance. A movement directly down
+  corresponds to a deletion, and a movement directly right corresponds to
+  an insertion.
+
+  If you had a diagonal from the top all the way to the bottom, the cost
+  would be the difference in the lengths of the input strings ("delta").
+  For every movement directly down you need to add exactly one movement
+  directly right, so the total cost D = delta + (2 * num-deletions).
+
+  Give each diagonal in the edit graph a number. The diagonal through the
+  origin is 0; diagonals above / right of it are numbered 1, 2, ...; diagonals
+  below / left of it are numbered -1, -2, ... . The diagonal through the lower
+  right corner will be number delta (difference of input lengths).
+
+  An edit path with a particular number of deletions cannot go below
+  diagonal -(num-deletions) or above diagonal delta + (num-deletions).
+  So we have bounding diagonals for any edit path up to a given number of
+  deletions and therefore up to a given length.
+
+
+  compare() with a large p_lim and full_scan = false implements this algorithm.
+
+  compare() with a given p_lim (maximum number of deletions) calculates
+  the lowest cost of a path through each relevant point along the bottom of
+  the edit graph.
+ */
+
+
+
 struct work_vec
 {
   long lo;
@@ -126,8 +190,8 @@ struct jaffer_edit_calculator
   };
 
   static long run(work_vec & fp, long k,
-                  subarray<A> const & a, long m,
-                  subarray<B> const & b, long n,
+                  subarray<A> const & a, long a_len,
+                  subarray<B> const & b, long b_len,
                   cost_vec & CC, long p)
   {
     long cost = k + 2*p;
@@ -142,12 +206,12 @@ struct jaffer_edit_calculator
     while (true)
       {
         // record costs along the way
-        long xcst = m - x;
+        long xcst = a_len - x;
         if (y < static_cast<long>(CC.size()) && xcst >= 0)
           {
             CC[y] = min(xcst + cost, CC[y]);
           }
-        if (x < m && y < n && a[x] == b[y])
+        if (x < a_len && y < b_len && a[x] == b[y])
           {
             ++x; ++y;
           }
@@ -199,6 +263,18 @@ struct jaffer_edit_calculator
     return delta + 2*p;
   }
 
+  // This splits the edit graph into a top half and a bottom half, calculates
+  // the (cost of the) cheapest possible path through each point along the
+  // middle, and then splits the graph into left/right portions based on that
+  // point. It then recurses on the top left and bottom right quadrants (the
+  // shortest edit path cannot possibly go through the other two quadrants).
+  //
+  // When getting costs through the top and bottom halves, it can discard the
+  // rightmost part of the top and the leftmost part of the bottom, beyond where
+  // the edit band (diagonls -(num-deletes) and delta + num-deletes) crosses
+  // the split. Even with doing this the edit band is overstated in the
+  // calls to compare(), because while max-possible-deletes (p_lim) is correct
+  // the delta value is still larger by max-possible-deletes.
   static long divide_and_conquer(subarray<A> const & a, long start_a, long end_a,
                                  subarray<B> const & b, long start_b, long end_b,
                                  edit_vec & edits,
@@ -206,10 +282,13 @@ struct jaffer_edit_calculator
                                  long polarity,
                                  long p_lim)
   {
-    long mid_a = (start_a + end_a) / 2;
     long len_b = end_b - start_b;
     long len_a = end_a - start_a;
+    long const delta = len_b - len_a;
+    // total edit distance
     long tcst = (2 * p_lim) + (len_b - len_a);
+    // top/bottom split point
+    long mid_a = (start_a + end_a) / 2;
 
     I(start_a >= 0);
     I(start_a <= a.size());
@@ -223,19 +302,35 @@ struct jaffer_edit_calculator
     cost_vec cc(len_b + 1, len_a + len_b);
     cost_vec rr(len_b + 1, len_a + len_b);
 
+    // get costs from the top left through each point on the top/bottom split
+    long const top_len_a = mid_a - start_a;
+    // trim off the rightmost part of b, past where the edit band crosses the split
+    long const top_end_b = min(end_b, start_b + (top_len_a + delta + p_lim + 1));
     compare (cc,
-             a.subset(start_a, mid_a), (mid_a - start_a),
-             b.subset(start_b, end_b), len_b, min(p_lim, len_a));
+             a.subset(start_a, mid_a), top_len_a,
+             b.subset(start_b, top_end_b), top_end_b - start_b,
+             min(p_lim, len_a));
 
+    // get costs from the lower right through each point on the top/bottom split
+    long const bottom_len_a = end_a - mid_a;
+    // here we trim the leftmost part of b (before reversing it)
+    long const bottom_start_b = max(start_b, end_b - (bottom_len_a + delta + p_lim + 1));
     compare (rr,
-             a.subset(end_a, mid_a), (end_a - mid_a),
-             b.subset(end_b, start_b), len_b, min(p_lim, len_a));
+             a.subset(end_a, mid_a), bottom_len_a,
+             b.subset(end_b, bottom_start_b), end_b - bottom_start_b,
+             min(p_lim, len_a));
 
+    // find the first (closest-to-center) point on the split line, which
+    // has the correct total (top + bottom) cost and is therefore on the
+    // shortest edit path
     long b_split = mid_split(len_a, len_b, rr, cc, tcst);
 
+    // known costs of each half of the path
     long est_c = cc[b_split];
     long est_r = rr[len_b - b_split];
 
+    // recurse on the two halves
+
     long cost_c = diff_to_et (a, start_a, mid_a,
                               b, start_b, start_b + b_split,
                               edits, edx, polarity,
============================================================
--- test/src/testlib.lua	ab15612fd70395e7f7cb9b74a985c7df874c8c07
+++ test/src/testlib.lua	6d2a308918594226fa6549ed0268ccaea3921038
@@ -294,6 +294,13 @@ end
   return ret
 end
 
+function getcommon(name, as)
+  if as == nil then as = name end
+  local ret = copy(srcdir .. "/common/" .. name, as)
+  make_tree_accessible(as)
+  return ret
+end
+
 function get(name, as)
   if as == nil then as = name end
   return getstd(test.name .. "/" .. name, as)
@@ -309,6 +316,13 @@ end
   func()
 end
 
+function includecommon(name)
+  local func, e = loadfile(srcdir.."/common/"..name)
+  if func == nil then err(e, 2) end
+  setfenv(func, getfenv(2))
+  func()
+end
+
 function trim(str)
   return string.gsub(str, "^%s*(.-)%s*$", "%1")
 end
============================================================
--- test/func/renaming_a_directory/__driver__.lua	b908875126d5318bae9bdb732f4d027462933f1d
+++ test/func/renaming_a_directory/__driver__.lua	7efaca5e29484acf7cab748e15d0cba8e1c751ca
@@ -2,8 +2,8 @@ mtn_setup()
 
 mtn_setup()
 
-include("common/basic_io.lua")
-include("common/test_utils_inventory.lua")
+includecommon("basic_io.lua")
+includecommon("test_utils_inventory.lua")
 
 mkdir("foo")
 
============================================================
--- test/func/(normal)_netsync_on_partially_unrelated_revisions/__driver__.lua	79d37ed87fa40ba7e6e4a00fd5662b45dbaf3531
+++ test/func/(normal)_netsync_on_partially_unrelated_revisions/__driver__.lua	3d19160403df890d786f257df19bb41f7db70f41
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 
 -- This test relies on file-suturing
============================================================
--- test/func/exchanging_work_via_netsync/__driver__.lua	46b223397783f568ca2bffdae57dc82259489d2a
+++ test/func/exchanging_work_via_netsync/__driver__.lua	6e4d76c937055c2d864d932f26786bf496ffcac1
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync_transfers_public_keys/__driver__.lua	7c33043f7bea601ceb114aa57853ca0ecdbbdcca
+++ test/func/netsync_transfers_public_keys/__driver__.lua	95b7dc7ea8412bd6af7e265dfed6b6450fd2008d
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/repeatedly_exchanging_work_via_netsync/__driver__.lua	30afb928fece485bc82e5afe9beec62e950d9575
+++ test/func/repeatedly_exchanging_work_via_netsync/__driver__.lua	8c5b92d0ae81a14df53b6682cb7fa40d0a355923
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/single_manifest_netsync/__driver__.lua	ba4868d426f68fadbb35775b82ed2f1ed04c7e8e
+++ test/func/single_manifest_netsync/__driver__.lua	b75cfe7eea627ee6278bcf373d35fe4f74357c1f
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/persistent_netsync_server_-_keys/__driver__.lua	d9a6a5c55dc85ad55f06cb316dc4231ada807e93
+++ test/func/persistent_netsync_server_-_keys/__driver__.lua	b4bb17dfebf8bc413d894f1d31b2f39f5a19e4ef
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/persistent_netsync_server_-_revs_&_certs/__driver__.lua	ae88e5fbf13f1c3b47befa86b9e0397e9b835f20
+++ test/func/persistent_netsync_server_-_revs_&_certs/__driver__.lua	5762eef2e6f3e762fe927a0686bf7e328cb75508
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/(imp)_persistent_netsync_server_-_keys_2/__driver__.lua	ced4ffc5130603ac1b82c144554a67f73308dbec
+++ test/func/(imp)_persistent_netsync_server_-_keys_2/__driver__.lua	e45abd93530f853fd19fbb63843c2be738569655
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/(normal)_netsync_revision_with_no_certs/__driver__.lua	877d8b8f08f37110bbaf6ec9f34163fc08e5cb48
+++ test/func/(normal)_netsync_revision_with_no_certs/__driver__.lua	b567bf3334e38fc85c3364ad44288d8bdb6fe788
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/pull_a_netsync_branch_which_has_a_parent_from_another_branch/__driver__.lua	0c4a245ff7c35951005047da6ec751c4e97f6e3c
+++ test/func/pull_a_netsync_branch_which_has_a_parent_from_another_branch/__driver__.lua	8a9477a2833c59c031adca728830258596f283b8
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/automate_heads/__driver__.lua	44b8a91cf2958045046831ee4ff88ba7244ea946
+++ test/func/automate_heads/__driver__.lua	899ed274de66856a9f84deef2e0f72592798b2e6
@@ -1,5 +1,5 @@
 
-include("common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 revs = {}
============================================================
--- test/func/automate_ancestors/__driver__.lua	3555788d1dfcdf475b57828e35a6dff1091ed3db
+++ test/func/automate_ancestors/__driver__.lua	392ac8090189e02b487a9d54a4a41bb158de2ed1
@@ -10,7 +10,7 @@ check(mtn("automate", "ancestors", "c753
 --     D E
 --     \/
 --      F
-include("/common/automate_ancestry.lua")
+includecommon("automate_ancestry.lua")
 
 revs = make_graph()
 
============================================================
--- test/func/netsync_client_absorbs_and_checks_epochs/__driver__.lua	c9ca91058a28985d1e07fba47cc85181580f2a41
+++ test/func/netsync_client_absorbs_and_checks_epochs/__driver__.lua	848d65f0f7dbaa3e2cea0e57157c04bf8f41ee8e
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 revs = {}
============================================================
--- test/func/netsync_client_absorbs_server_key/__driver__.lua	604f76a83044fc89a53a219c8162c014456b586a
+++ test/func/netsync_client_absorbs_server_key/__driver__.lua	7c6223e1a0e41e8decfddff1bd95a453068bbcce
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync_default_server_pattern/__driver__.lua	bb1a0015b7f492d894d80f9041855898ba972781
+++ test/func/netsync_default_server_pattern/__driver__.lua	d92ada4ccfd219f62cfd6847f409fbaa55ad4204
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 revs = {}
============================================================
--- test/func/netsync_default_server_pattern_setting/__driver__.lua	150f75bdedfb03ba5c1516d980f5ff7d6e413bd7
+++ test/func/netsync_default_server_pattern_setting/__driver__.lua	63d9d9af58e38a3694b89bacd94b139f0957f4a2
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync_epochs_are_not_sent_upstream_by_pull/__driver__.lua	4ec9d25eab337911fbab21281d28c945482a0ce6
+++ test/func/netsync_epochs_are_not_sent_upstream_by_pull/__driver__.lua	55b2d746230ef1b2d14bb1b14fdc90aaacda9db0
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync_is_not_interrupted_by_SIGPIPE/__driver__.lua	10c1772a19c48a2c039276840ecaf8fe2c9af0fa
+++ test/func/netsync_is_not_interrupted_by_SIGPIPE/__driver__.lua	67b8ef7389398b5fd657b0520432ee98445f587a
@@ -1,6 +1,6 @@ skip_if(ostype == "Windows")
 
 skip_if(ostype == "Windows")
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync_server_absorbs_and_checks_epochs/__driver__.lua	cc83b2b114c4065c65f166c731e7b9090892bf83
+++ test/func/netsync_server_absorbs_and_checks_epochs/__driver__.lua	16c387d25b45e44637eca1e84ac8ec0f5c6e2103
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 revs = {}
============================================================
--- test/func/netsync_verifies_server_keys/__driver__.lua	5300991e6b9c6203f42e47def183fa19b75bb834
+++ test/func/netsync_verifies_server_keys/__driver__.lua	b26b2f863c40c0ebbd39182ef008c07de0877b60
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/automate_ancestry_difference/__driver__.lua	687f03320d55546d2cfb300fae7d51259c9805e7
+++ test/func/automate_ancestry_difference/__driver__.lua	31b4cd56ba9a24bb18f03d54f58f8c9ccf706b83
@@ -8,7 +8,7 @@ mtn_setup()
 --     D E
 --     \/
 --      F
-include("/common/automate_ancestry.lua")
+includecommon("automate_ancestry.lua")
 
 revs = make_graph()
 
============================================================
--- test/func/automate_descendents/__driver__.lua	6e65ffe74774c3f662024b3b959e2c062b05612c
+++ test/func/automate_descendents/__driver__.lua	5103d1a72ddb74af5f18b8b5a64bb332f181fd49
@@ -10,7 +10,7 @@ check(mtn("automate", "descendents", "c7
 --     D E
 --     \/
 --      F
-include("/common/automate_ancestry.lua")
+includecommon("automate_ancestry.lua")
 
 revs = make_graph()
 
============================================================
--- test/func/automate_erase_ancestors/__driver__.lua	bc2885d75224dd0d39ef378b1fce02a771a019ea
+++ test/func/automate_erase_ancestors/__driver__.lua	4caed2c8b03ff1c69c42d43295fb09b21a2f67e6
@@ -10,7 +10,7 @@ check(mtn("automate", "erase_ancestors",
 --     D E
 --     \/
 --      F
-include("/common/automate_ancestry.lua")
+includecommon("automate_ancestry.lua")
 
 revs = make_graph()
 
============================================================
--- test/func/automate_toposort/__driver__.lua	2b8c1bd3613ce3c2e6fbaf1f053b39fa1d21aee4
+++ test/func/automate_toposort/__driver__.lua	6a9a6214ac8e09fb63c5bbab7d2d31f995787933
@@ -8,7 +8,7 @@ mtn_setup()
 --     D E
 --     \/
 --      F
-include("/common/automate_ancestry.lua")
+includecommon("automate_ancestry.lua")
 
 revs = make_graph()
 
============================================================
--- test/func/netsync_largish_file/__driver__.lua	135d2f4626dbb41d145e1f271bd165f91bd7839f
+++ test/func/netsync_largish_file/__driver__.lua	69a20594d3a57fa884a81413b9b62200ce4d777f
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/automate_inventory/__driver__.lua	0b2f84a2b87b5eec92c2818cbf1b3535631a0922
+++ test/func/automate_inventory/__driver__.lua	7a34ae38083f1a973c40fa4672456cf7c9520cee
@@ -8,8 +8,8 @@ check(getstd("inventory_hooks.lua"))
 
 check(getstd("inventory_hooks.lua"))
 
-include("common/basic_io.lua")
-include("common/test_utils_inventory.lua")
+includecommon("basic_io.lua")
+includecommon("test_utils_inventory.lua")
 
 ----------
 -- create a basic file history; add some files, then operate on
============================================================
--- test/func/automate_graph/__driver__.lua	9311433fa65de02d9e996af9cfc5e3b0ad2a6ca9
+++ test/func/automate_graph/__driver__.lua	43a3f4521abbfbfa2dc34951d8c68cc015819ee5
@@ -10,7 +10,7 @@ check(mtn("automate", "graph"), 0, 0, fa
 --     D E
 --     \/
 --      F
-include("/common/automate_ancestry.lua")
+includecommon("automate_ancestry.lua")
 
 revs = make_graph()
 
============================================================
--- test/func/automate_parents,_automate_children/__driver__.lua	b1f01aafd20f603f5aa8803ce7c2060f5b34baa4
+++ test/func/automate_parents,_automate_children/__driver__.lua	df43abc366fd8aef7e40b9cd71c35b137fefccc4
@@ -11,7 +11,7 @@ check(mtn("automate", "children", "c7539
 --     D E
 --     \/
 --      F
-include("/common/automate_ancestry.lua")
+includecommon("automate_ancestry.lua")
 
 revs = make_graph()
 
============================================================
--- test/func/automate_stdio/__driver__.lua	f2079f12b35d50480b2e2b96c8e8acd7178a951a
+++ test/func/automate_stdio/__driver__.lua	bf0bcbaabda1fd5e715d066fba5507ecc0c2ee82
@@ -1,4 +1,4 @@
-include("/common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/check_later_and_earlier_selectors/__driver__.lua	f3ab1f5511f5367c72993bbff9d19d7b002b3835
+++ test/func/check_later_and_earlier_selectors/__driver__.lua	5dfeaaaa81ce2581352e0d2b978b594b591c243b
@@ -1,5 +1,5 @@
 
-include("common/selectors.lua")
+includecommon("selectors.lua")
 mtn_setup()
 revs = {}
 
============================================================
--- test/func/common/netsync.lua	5b18be9929d1d852a5f931fd9756dd30c197c9c6
+++ test/common/netsync.lua	042fc7e7d0a551e7e79e7b412f50f854c550e9da
@@ -19,13 +19,13 @@ function netsync.setup()
   check(copy("keys", "keys2"))
   check(copy("test.db", "test3.db"))
   check(copy("keys", "keys3"))
-  check(getstd("common/netsync-hooks.lua", "netsync.lua"))
+  check(getcommon("netsync-hooks.lua", "netsync.lua"))
   math.randomseed(get_pid())
 end
 
 function netsync.setup_with_notes()
   netsync.setup()
-  check(getstd("common/netsync-hooks_with_notes.lua", "netsync.lua"))
+  check(getcommon("netsync-hooks_with_notes.lua", "netsync.lua"))
 end
 
 function netsync.internal.client(srv, oper, pat, n, res, save_output)
============================================================
--- test/func/get_netsync_read_permitted/__driver__.lua	d1e7461bdceab19034a9c20eb033249693d7a903
+++ test/func/get_netsync_read_permitted/__driver__.lua	bc6b267b1492648e933a6d2782eaf2e926b80ede
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync,--exclude,defaults/__driver__.lua	5e3641b14d78b3762b5311d8c96a6d5b573410de
+++ test/func/netsync,--exclude,defaults/__driver__.lua	c57ad04137a2bcc0acb85d7f44d8d7cf42bf3361
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync,--set-default/__driver__.lua	a57657e4a57c507335db1d41123a3f30641ffd97
+++ test/func/netsync,--set-default/__driver__.lua	10b6cc8a23f7edc351a23e43cf84d7961ffb9ea2
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 rseed = get_pid()
============================================================
--- test/func/netsync_permissions/__driver__.lua	8a675ebd2b67064a295f5143b2159580d1028ac9
+++ test/func/netsync_permissions/__driver__.lua	8c1359d6116c3f34fa45e1680b874e934b8dcf76
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 keys = {}
 revs = {}
============================================================
--- test/func/netsync_with_globs/__driver__.lua	9e790fb1196c3ee5cb391cbdcbae847e721e4044
+++ test/func/netsync_with_globs/__driver__.lua	2242f415e61d4977f344c88b0cddd6b2dbe199c0
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 revs = {}
============================================================
--- test/func/serve_pull_with_--exclude/__driver__.lua	9c87166a5f1834bccd2ff5c15c80b3fbb7a5872b
+++ test/func/serve_pull_with_--exclude/__driver__.lua	2254d34bfe243e65780a4fa287baf7c7bba556b9
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/automate_keys/__driver__.lua	a8231081a0e1f0ba0ca2aac057786917c99e6293
+++ test/func/automate_keys/__driver__.lua	5614fe4f6a1d41ea407e284daaaf56488dbfd27e
@@ -1,4 +1,4 @@
-include("common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/b_and_h_selectors/__driver__.lua	fd8e8fcdfd103194f65c97f8bc42847a17d860ee
+++ test/func/b_and_h_selectors/__driver__.lua	5dbf7aeb3df9f24cbd80019dfb944ccab3dcd5c9
@@ -1,5 +1,5 @@
 
-include("common/selectors.lua")
+includecommon("selectors.lua")
 mtn_setup()
 
 addfile("testfile", "blah blah")
============================================================
--- test/func/b_t_and_a_selector_globbing/__driver__.lua	39d20812db86092429f4c37edd7ff23734a1a2b1
+++ test/func/b_t_and_a_selector_globbing/__driver__.lua	25048167425a67101b108b5f59b8b2ccaf817302
@@ -1,5 +1,5 @@
 
-include("common/selectors.lua")
+includecommon("selectors.lua")
 mtn_setup()
 
 addfile("testfile", "blah blah")
============================================================
--- test/func/automate_common_ancestors/__driver__.lua	160e7f614d29d06f1a49223a1448a5e427b9c6a1
+++ test/func/automate_common_ancestors/__driver__.lua	325ad30c549342198f2dec4bb21b79d545f66323
@@ -1,5 +1,5 @@
 
-include("common/automate_ancestry.lua")
+includecommon("automate_ancestry.lua")
 mtn_setup()
 
 --   A
============================================================
--- test/func/checking_that_certain_commands_ignores_the_contents_of__MTN_options/__driver__.lua	c3fd58c552a59d37fb32775239223e4cdcead142
+++ test/func/checking_that_certain_commands_ignores_the_contents_of__MTN_options/__driver__.lua	1f0f96220aca1d6116d82b082ae05abc9f4b1938
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/escaped_selectors/__driver__.lua	09f94c4bd46c11ba2f68263c92369f4e729d0c42
+++ test/func/escaped_selectors/__driver__.lua	ea0f960ad28795528d78ce12621cdf38cd62f776
@@ -1,5 +1,5 @@
 
-include("common/selectors.lua")
+includecommon("selectors.lua")
 mtn_setup()
 
 addfile("testfile", "blah blah")
============================================================
--- test/func/exchanging_work_via_netsync,_with_notes/__driver__.lua	0be268de9da52c1e06e9d5351c8abc6e079118d2
+++ test/func/exchanging_work_via_netsync,_with_notes/__driver__.lua	23c85d3af1759d61c0b2455bada950aae35699f0
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup_with_notes()
 revs = {}
============================================================
--- test/func/one-way_netsync_where_the_sink_has_more_epochs/__driver__.lua	bb8e382b933199a1949323f0d4005db68b6d17bf
+++ test/func/one-way_netsync_where_the_sink_has_more_epochs/__driver__.lua	11dc3ee56708a2dafa7afaf530b0bcee7c1e448f
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/pid_file_cleanup/__driver__.lua	1454e1b40ac70ac3e3cd8f5b69aa5ffacacece2c
+++ test/func/pid_file_cleanup/__driver__.lua	9cc22aed49c55892ea7e94dba4f5e99f6ba3dae3
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/quiet_turns_off_tickers_but_not_warnings/__driver__.lua	3058caa495242e00ca406633e868782ad6e8cc42
+++ test/func/quiet_turns_off_tickers_but_not_warnings/__driver__.lua	ef3c98298ac0807c2aa91cf70f114ee5da181529
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/reallyquiet_turns_off_tickers_and_warnings/__driver__.lua	bf97ebda957c64616410061841545648e8ef192e
+++ test/func/reallyquiet_turns_off_tickers_and_warnings/__driver__.lua	7f2effaecc63f752e3664a6e9700932c314c406f
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/merge_conflict_with_no_lca/__driver__.lua	024b58c36ab28c05edd9e308451863c3ae3852be
+++ test/func/merge_conflict_with_no_lca/__driver__.lua	ad56bc8fcda1267ec0c2c9d7966e307da373eaed
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync_epoch_refinement/__driver__.lua	4ed9c46f6864a2c19cb69af2e4126bfe787d1c2c
+++ test/func/netsync_epoch_refinement/__driver__.lua	e32aaf21b9ae9758e6b1fb6944fe8765e1dd9315
@@ -1,4 +1,4 @@
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync_hook_errcodes/__driver__.lua	78865e3aacd8877e82dd219581c9b0154ec05ac2
+++ test/func/netsync_hook_errcodes/__driver__.lua	ec71c8c29e3fa49ae6bb99053318c2cadf770aed
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup_with_notes()
 
============================================================
--- test/func/automate_stdio_options/__driver__.lua	84e4676457d226499bab7cf0a491208949a17862
+++ test/func/automate_stdio_options/__driver__.lua	6587f5b9af6350f3746a278e8ce3fea0f2f2be3c
@@ -1,4 +1,4 @@
-include("/common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/netsync_permissions_wildcards/__driver__.lua	e2f74afc72d62bbdf7b07f005844a8401d34b6c0
+++ test/func/netsync_permissions_wildcards/__driver__.lua	4643ff46c5bf825812b0a53084e1194df457d8dd
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 
 netsync.setup()
============================================================
--- test/func/automate_cert/__driver__.lua	b9ef3b6aafc09dfb5e296e77d5ca328af543e23c
+++ test/func/automate_cert/__driver__.lua	ae68b2ee7843b11f0aded45352e0cc39799ca8e0
@@ -1,4 +1,4 @@
-include("common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 revs = {}
============================================================
--- test/func/automate_inventory_restricted/__driver__.lua	64a999ffcc6aff7410d4576a055e4f82eae2de1a
+++ test/func/automate_inventory_restricted/__driver__.lua	8850fc649d0de6a65315715b25144685f4c6244d
@@ -11,8 +11,8 @@ check(getstd("inventory_hooks.lua"))
 
 check(getstd("inventory_hooks.lua"))
 
-include("common/basic_io.lua")
-include("common/test_utils_inventory.lua")
+includecommon("basic_io.lua")
+includecommon("test_utils_inventory.lua")
 
 ----------
 --  main process
============================================================
--- test/func/automate_identify/__driver__.lua	8ba0b019d5546dd59e200c9e12746c2ad7ad7265
+++ test/func/automate_identify/__driver__.lua	4965159462ee7db9422a44ab9380d6b2bc58f66b
@@ -1,4 +1,4 @@
-include("common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/server_initiated_sync/__driver__.lua	e5a103b1c136b150c5fc95271728236d03891694
+++ test/func/server_initiated_sync/__driver__.lua	8c2877cd29c7f99680f14fb4ef1aa14f601e51bc
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/netsync_key_hook/__driver__.lua	f2a9ed3d90567968db34e9c16c90e8a5d4991aef
+++ test/func/netsync_key_hook/__driver__.lua	87963f895052ee9dd35d513e23004811169bca38
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/suspend/__driver__.lua	61ffae4a8190abd0aab47c070550c458fc7a450f
+++ test/func/suspend/__driver__.lua	85aef4f7bd20330290964d0e5ce7f71679e273f9
@@ -1,4 +1,4 @@
-include("common/selectors.lua")
+includecommon("selectors.lua")
 mtn_setup()
 
 addfile("testfile", "testbranch1")
============================================================
--- test/func/netsync_with_suspended_branch/__driver__.lua	3fde78d6b9affcfe2c777f518c04b3e36292d14a
+++ test/func/netsync_with_suspended_branch/__driver__.lua	9acb504be8308fa216a6f07bd6f3cd1e523d554e
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- contrib/monotone-mail-notify.lua	71329cf83f1a56aafea35a6b9f9190a25df258de
+++ extra/mtn-hooks/monotone-mail-notify.lua	f498fdf33ee9e4a453665f66fb72f0a17a0ee624
@@ -34,7 +34,7 @@ do
 do
    _from = "address@hidden"
    _server = "localhost"
-   _base = "/var/spool/monotone/"
+   _base = "/var/spool/monotone"
    _keydir = get_confdir() .. "/keys"
    _key = ""
    _shellscript = ""
@@ -91,6 +91,7 @@ do
       data["keydir"] = _keydir
       data["key"] = _key
       data["shellscript"] = _shellscript
+      data["base"] = _base
 
       for i, item in pairs(notifydata)
       do
@@ -115,6 +116,10 @@ do
 	    for j, val in pairs(item.values) do
 	       data[item.name] = val
 	    end
+	 elseif item.name == "base" then
+	    for j, val in pairs(item.values) do
+	       data[item.name] = val
+	    end
 	    -- Skip past other accepted words
 	 elseif item.name == "pattern" then
 	 elseif item.name == "allow" then
@@ -142,6 +147,7 @@ do
 	 elseif item.name == "keydir" then
 	 elseif item.name == "key" then
 	 elseif item.name == "shellscript" then
+	 elseif item.name == "base" then
 	    -- legal names: pattern, allow, deny, continue, comment
 	 elseif item.name == "pattern" then
 	    if matches and not cont then
@@ -267,6 +273,7 @@ do
 	       local keydir = _configuration_data["keydir"]
 	       local key = _configuration_data["key"]
 	       local shellscript = _configuration_data["shellscript"]
+	       local base = _configuration_data["base"]
 
 	       --print("monotone-mail-notify: About to write data")
 	       for rev_id,rev_data in pairs(_emails_to_send[session_id]) do
@@ -282,12 +289,13 @@ do
 
 		     local now = os.time()
 
-		     --print("monotone-mail-notify: Writing data for revision ",
-		     --	rev_data["revision"])
+		     -- print("monotone-mail-notify: Writing data for revision",
+		     --       rev_data["revision"], "to files with base",
+		     --       base .. "/" .. now .. "." .. rev_data["revision"])
 
-		     local outputFileRev = io.open(_base .. now .. "." .. rev_data["revision"] .. ".rev.txt", "w+")
-		     local outputFileHdr = io.open(_base .. now .. "." .. rev_data["revision"] .. ".hdr.txt", "w+")
-		     local outputFileDat = io.open(_base .. now .. "." .. rev_data["revision"] .. ".dat.txt", "w+")
+		     local outputFileRev = io.open(base .. "/" .. now .. "." .. rev_data["revision"] .. ".rev.txt", "w+")
+		     local outputFileHdr = io.open(base .. "/" .. now .. "." .. rev_data["revision"] .. ".hdr.txt", "w+")
+		     local outputFileDat = io.open(base .. "/" .. now .. "." .. rev_data["revision"] .. ".dat.txt", "w+")
 
 		     local to = ""
 		     for j,addr in pairs(rev_data["recipients"]) do
@@ -314,12 +322,12 @@ do
 	       end
 
 	       if shellscript and shellscript ~= "" then
-		  print("monotone-mail-notify.lua: Running script ",
-			shellscript)
+		  print("monotone-mail-notify.lua: Running script:",
+			shellscript, base)
 		  spawn_redirected("/dev/null",
 				   _shellscript_log,
 				   _shellscript_errlog,
-				   "bash", shellscript)
+				   shellscript, base)
 	       end
 	       _emails_to_send[session_id] = nil
 	       return "continue",nil
============================================================
--- contrib/monotone-mail-notify.sh	1e447c16f2f9962374d0ab26fd0d4c2d0f69d7f6
+++ extra/mtn-hooks/monotone-mail-notify	805853cf58465efb4b65e17c1d0cd8b6593ea955
@@ -1,4 +1,4 @@
-#! /usr/local/bin/bash
+#! /usr/bin/env bash
 
 # Install the corresponding .lua file in monotone.  Its
 # comments holds instructions on how to configure this
@@ -12,11 +12,13 @@
 # Copyright (c) 2010, Richard Levitte <address@hidden)
 # License: GPLv2 or later
 
-MTN="/usr/local/bin/mtn"
-HIGHLIGHT="/usr/local/bin/source-highlight"
-MIMECONSTRUCT="/usr/local/bin/mime-construct"
+MTN="mtn"
+HIGHLIGHT="source-highlight"
+MIMECONSTRUCT="mime-construct"
 BASE="/var/spool/monotone"
 
+if [ -n "$1" ]; then BASE="$1"; fi
+
 function processFile() {
     local fileBase=$1
 
@@ -158,6 +160,7 @@ then
 
 if [ "x" = "x$(ls $BASE)" ]
 then
+    echo >&2 "monotone-mail-notify: no files in $BASE, exiting"
     exit 0
 fi
 
============================================================
--- test/func/netsync_duplicate_keys/__driver__.lua	6328976f6951520e6a440f5622355f69429e83df
+++ test/func/netsync_duplicate_keys/__driver__.lua	999ec499efeb0152488a73bd781da3c8dc8479ee
@@ -1,5 +1,5 @@
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/automate_inventory_ignore_dirs/__driver__.lua	03f5ad3fdea64dcddd718785513fc10b0feb4156
+++ test/func/automate_inventory_ignore_dirs/__driver__.lua	7afec31b9343b5e6d95f0d0bc30aa661254d7aeb
@@ -26,8 +26,8 @@ check(get("local_hooks.lua"))
 
 check(get("local_hooks.lua"))
 
-include("common/basic_io.lua")
-include("common/test_utils_inventory.lua")
+includecommon("basic_io.lua")
+includecommon("test_utils_inventory.lua")
 
 ----------
 -- The local local_hooks.lua defines ignore_file to ignore 'ignored'
============================================================
--- test/func/automate_inventory_options/__driver__.lua	8e89bdbaa5b76d80d881ccf0946ea16155a26351
+++ test/func/automate_inventory_options/__driver__.lua	85fd7d1a9845f5de05af7b6a494ad9ae1b0aaa02
@@ -3,7 +3,7 @@
 --
 -- We don't test with --bookkeep-only, because we haven't gotten to it yet.
 
-include("common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
@@ -21,8 +21,8 @@ check(get("expected-renames-target-no-un
 check(get("expected-renames-target-no-ignored.stdout"))
 check(get("expected-renames-target-no-unknown.stdout"))
 
-include("common/basic_io.lua")
-include("common/test_utils_inventory.lua")
+includecommon("basic_io.lua")
+includecommon("test_utils_inventory.lua")
 
 mkdir("source")
 addfile("source/source_1", "source_1")
============================================================
--- test/func/netsync_mtn_uri_scheme/__driver__.lua	6c2d5b2b6f84cba96308f502a38a895a9e99a7c7
+++ test/func/netsync_mtn_uri_scheme/__driver__.lua	63a309016507f1056d581e4e9829840fa38ec494
@@ -1,5 +1,5 @@
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/p_selector/__driver__.lua	1cb5dbfc78175a0664e0f854d26558a393055745
+++ test/func/p_selector/__driver__.lua	0b69331749ddacb49be07fa5a8e01b77b96ca54e
@@ -1,5 +1,5 @@
 
-include("common/selectors.lua")
+includecommon("selectors.lua")
 mtn_setup()
 
 addfile("testfile", "blah blah")
============================================================
--- test/func/sync_use_ws_opts/__driver__.lua	900a68a87633809becb988b49dc9bcbcb7b6437a
+++ test/func/sync_use_ws_opts/__driver__.lua	2ef29503c4430c11175964c1157daabb82ed3dc8
@@ -1,7 +1,7 @@
 -- Test that sync uses _MTN/options properly
 -- It ignored 'keydir' in 0.39, and did not set 'key' in development for 0.40
 
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 
 -- 'mtn_setup' sets 'key' in _MTN/options; we don't want that.
 check(getstd("test_keys"))
============================================================
--- test/func/automate_show_conflicts_defaults/__driver__.lua	be2e2034286d216850364195cfa0cf3b0ab084c7
+++ test/func/automate_show_conflicts_defaults/__driver__.lua	1db31e9b04fa6410eee236d9270843dc062a8424
@@ -2,8 +2,8 @@
 --
 -- See automate_show_conflicts for all conflict cases
 
-include("common/basic_io.lua")
-include("common/automate_stdio.lua")
+includecommon("basic_io.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/automate_get_options/__driver__.lua	247e680108f7d2599fbf0e42367f4cc917e73088
+++ test/func/automate_get_options/__driver__.lua	d6a8fc7edabae64341bf2065ffe61717df747ad0
@@ -1,5 +1,5 @@
 
-include("common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/i_selector/__driver__.lua	89082b8caae184d6184476c5b28229343c1c4b06
+++ test/func/i_selector/__driver__.lua	e1b48e22936451ab7fb69081d89481f6821ef661
@@ -1,5 +1,5 @@
 
-include("common/selectors.lua")
+includecommon("selectors.lua")
 mtn_setup()
 
 addfile("testfile", "blah blah")
============================================================
--- test/func/exchanging_work_via_netsync_sent_notes/__driver__.lua	b3e4e1a2107d853ada4ea0e9b76054b50a9aade9
+++ test/func/exchanging_work_via_netsync_sent_notes/__driver__.lua	21c02640bae87917b5647983f6d084a914328223
@@ -4,7 +4,7 @@
 -- ../exchanging_work_via_netsync,_with_notes/__driver__.lua, but here
 -- we do "push" instead of "pull".
 
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup_with_notes()
 revs = {}
============================================================
--- test/func/automate_key_manage/__driver__.lua	f79fdf0269f9cc2c52d4b59ead0287229ab4b2ef
+++ test/func/automate_key_manage/__driver__.lua	cb6433a38a0beeff4fc1b41135d44c22ab799d50
@@ -7,7 +7,7 @@ mtn_setup()
 
 mtn_setup()
 
-include("common/basic_io.lua")
+includecommon("basic_io.lua")
 
 check(mtn("automate", "generate_key", "address@hidden", "foopass"), 0, false, false)
 check(mtn("pubkey", "address@hidden"), 0, true)
============================================================
--- test/func/serve-automate/__driver__.lua	57e8ccc98c7ae0cc8d380d1fbc2232af5082db87
+++ test/func/serve-automate/__driver__.lua	d41f819fd49060c45bb154dde614699b0cb938e7
@@ -1,5 +1,5 @@
-include("common/netsync.lua")
-include("common/automate_stdio.lua")
+includecommon("netsync.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 netsync.setup()
============================================================
--- test/func/delta_directions/__driver__.lua	4f32096c299d54b83a2f6d83079af05171501107
+++ test/func/delta_directions/__driver__.lua	a1ad53a4caafaedfae45eaace241a7e01da3ac0d
@@ -1,4 +1,4 @@
-include("/common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/m_selector/__driver__.lua	595d0882c8a144c189c960a4108a993a5c91cef2
+++ test/func/m_selector/__driver__.lua	2f345b18ed1d9141b4438ccceddcb22a8d1252dc
@@ -1,4 +1,4 @@
-include("common/selectors.lua")
+includecommon("selectors.lua")
 mtn_setup()
 
 addfile("testfile", "blah blah")
============================================================
--- test/func/u_selector/__driver__.lua	8fe1f6a14eb1c3ce47dc753495c3b5fe1d807e97
+++ test/func/u_selector/__driver__.lua	18b46d7976d0947d6fe1b645a4830dd7335b1e6d
@@ -1,4 +1,4 @@
-include("common/selectors.lua")
+includecommon("selectors.lua")
 mtn_setup()
 
 addfile("testfile", "blah blah")
============================================================
--- test/func/w_selector/__driver__.lua	75b6c0ec3c3b50dc651acbc938e08778cc166c32
+++ test/func/w_selector/__driver__.lua	5f1faf0f0d810217e3048147145c212677bf7bed
@@ -1,5 +1,5 @@
 
-include("common/selectors.lua")
+includecommon("selectors.lua")
 
 mtn_setup()
 
============================================================
--- test/func/netsync_negotiation/__driver__.lua	09a831c685d4f9580f66f523a18451ca9f719ce3
+++ test/func/netsync_negotiation/__driver__.lua	38cd5d9df0e16cf05d59f0d9525ae546a9654f5f
@@ -1,4 +1,4 @@
-include("common/netsync.lua")
+includecommon("netsync.lua")
 
 mtn_setup()
 netsync.setup()
============================================================
--- test/func/in_memory_database/__driver__.lua	24ffdfb8ba9f5a518a8a6bc2a6cf16abce120533
+++ test/func/in_memory_database/__driver__.lua	3ca9dbeffe98a6c19059d7084384ce8076a9ac10
@@ -1,4 +1,4 @@
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/serve-automate-single-run/__driver__.lua	da26b84d7889323d4cc960803a3e3037110533ec
+++ test/func/serve-automate-single-run/__driver__.lua	01013ad10150f9056bee7609338cb09b47d8c677
@@ -1,4 +1,4 @@
-include("common/netsync.lua")
+includecommon("netsync.lua")
 
 mtn_setup()
 netsync.setup()
============================================================
--- test/func/automate_stdio_band_output/__driver__.lua	55f82327f09de466c28671504baec545e148add0
+++ test/func/automate_stdio_band_output/__driver__.lua	9a5dbb7a13e37d8508bdc6393a684b76c4de6e32
@@ -1,4 +1,4 @@
-include("/common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/automate_netsync/__driver__.lua	66628a01797d398e1975b28cb602763342bf7472
+++ test/func/automate_netsync/__driver__.lua	c78f2a19ceeb04405f13a12cda8a9fcc6586b165
@@ -8,8 +8,8 @@
 -- 5) receive certs on existing revision
 -- 6) receive key
 
-include("/common/netsync.lua")
-include("/common/automate_stdio.lua")
+includecommon("netsync.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 netsync.setup()
@@ -110,8 +110,8 @@ srv:stop()
 -- 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
-getstd("common/john_key.packet", "john_key.packet")
-getstd("common/jane_key.packet", "jane_key.packet")
+getcommon("john_key.packet", "john_key.packet")
+getcommon("jane_key.packet", "jane_key.packet")
 check(mtn("read", "john_key.packet"), 0, nil, false)
 check(mtn2("read", "jane_key.packet"), 0, nil, false)
 
============================================================
--- test/func/netsync_stop_server/__driver__.lua	a586b3c09eaac9938b748ee897c161ff8996a375
+++ test/func/netsync_stop_server/__driver__.lua	f89913a9343985743b456f8a221c259e80b8524d
@@ -1,4 +1,4 @@
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/automate_update/__driver__.lua	3d8cadaf6c9fcd9ca4bdfb69e51647985d89164a
+++ test/func/automate_update/__driver__.lua	cc9ec25a254fd2bd91d4d79b5198cb351ac8352e
@@ -1,5 +1,5 @@
 -- Test 'automate update'
-include("/common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/netsync_per_server_defaults/__driver__.lua	a4d8b34fc29bcc93a4293367b63aa3521d7c7639
+++ test/func/netsync_per_server_defaults/__driver__.lua	2146137c3d8ec845e5decdf959b99f4e900e7b1e
@@ -1,4 +1,4 @@
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/catch_lua_output/__driver__.lua	f89a1951954b516efa7cfd39e24a1a045140267a
+++ test/func/catch_lua_output/__driver__.lua	e97b2923ac087050bd99d2dc74c16876d108a2b0
@@ -25,7 +25,7 @@ check(qgrep("this is also not catched", 
 check(mtn("automate", "stdio", "--rcfile", "hooks_automate.lua"), 0, true, true, "l6:select1:*e")
 check(qgrep("this is also not catched", "stderr"))
 
-include("common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 progress = parse_stdio(readfile("stdout"), 0, nil, 'p')
 
 check(progress[1] == "lua: this is catched")
============================================================
--- test/func/automate_log/__driver__.lua	5464e9af1871c162e46633fdd8822dc3bb5b0bb3
+++ test/func/automate_log/__driver__.lua	b5a1679367ffd0d504be13ba9d5032b15535adb9
@@ -6,8 +6,8 @@ check(qgrep("misuse: workspace parent re
 check(mtn("automate", "log"), 1, false, true)
 check(qgrep("misuse: workspace parent revision '' not found", "stderr"))
 
-include("/common/automate_ancestry.lua")
-include("/common/automate_stdio.lua")
+includecommon("automate_ancestry.lua")
+includecommon("automate_stdio.lua")
 
 revs = make_graph()
 --   A
============================================================
--- test/func/verbosity/__driver__.lua	76e572294f85e29b9e390cd3170510dc3ba3b2e5
+++ test/func/verbosity/__driver__.lua	8c5464abec138d22008ba4271f34de0a17d74eb0
@@ -1,4 +1,4 @@
-include("common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/automate_checkout/__driver__.lua	6411182532fa4a87ba078b04b28f527caac07dd9
+++ test/func/automate_checkout/__driver__.lua	f44404ce7fd6031a62a0b163d41af41f77ec88b4
@@ -1,5 +1,5 @@
 -- Test 'automate checkout'
-include("/common/automate_stdio.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 
============================================================
--- test/func/netsync_dry_run/__driver__.lua	3c02bbea8649f19f5767b77b9d81cbe1554097ac
+++ test/func/netsync_dry_run/__driver__.lua	c298f0f823a8418cb4aaaa2715b0378987ac0c35
@@ -1,4 +1,4 @@
-include("common/netsync.lua")
+includecommon("netsync.lua")
 mtn_setup()
 netsync.setup()
 
============================================================
--- test/func/automate_netsync_dryrun/__driver__.lua	86330dd0aa017dc4ee1c9afb4b69bd3ea75b7e78
+++ test/func/automate_netsync_dryrun/__driver__.lua	4eb4e91dec8799b4af1de25590c4dddb4a70cf80
@@ -3,8 +3,8 @@
 -- Same structure as non-dry-run test, but all executions are --dry-run
 -- (ediff-directories "../automate_netsync" "../automate_netsync_dry-run")
 
-include("/common/netsync.lua")
-include("/common/automate_stdio.lua")
+includecommon("netsync.lua")
+includecommon("automate_stdio.lua")
 
 mtn_setup()
 netsync.setup()
@@ -101,8 +101,8 @@ srv:stop()
 -- 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
-getstd("common/john_key.packet", "john_key.packet")
-getstd("common/jane_key.packet", "jane_key.packet")
+getcommon("john_key.packet", "john_key.packet")
+getcommon("jane_key.packet", "jane_key.packet")
 check(mtn("read", "john_key.packet"), 0, nil, false)
 check(mtn2("read", "jane_key.packet"), 0, nil, false)
 
============================================================
--- test/extra/mtn-cleanup/__driver__.lua	71bb16f84c2b0baf423ac5f04185b11c848642de
+++ test/extra/mtn-cleanup/__driver__.lua	c0a63dd6bbb69d30db6f6b64f7d59f2b5f1d00c7
@@ -1,5 +1,8 @@ mtn_setup()
 mtn_setup()
 
+-- Get helper scripts
+check(get("run-mtn-cleanup"))
+
 -- We do everything inside an inner workspace.  mtn-cleanup IS a dangerous
 -- command, and will happily wipe away any database that's in the workspace
 check(mtn("setup", "--branch=testbranch", "workspace"), 0, false, false)
@@ -14,8 +17,7 @@ writefile("workspace/test3", "baz")
 check(indir("workspace", mtn("add", "test2")), 0, false, false)
 writefile("workspace/test3", "baz")
 
-check(indir("workspace",
-	    {srcdir.."/extra/mtn-cleanup/run-mtn-cleanup",srcdir,test.root}),
+check(indir("workspace", {"./run-mtn-cleanup",srcdir,test.root}),
       0, true, false)
 check(exists("workspace/test1"))
 xfail(exists("workspace/test2"))
============================================================
--- test/extra/mtn-cleanup/run-mtn-cleanup	7cbf07edf271a2491e51fefb8df88c5bdbf0ee2d
+++ test/extra/mtn-cleanup/run-mtn-cleanup	2852670652f5beef553ec756f1522f2a54476fdc
@@ -2,6 +2,7 @@
 
 # $1	{srcdir}/test
 # $2	{builddir}/test/work/extra/mtn-cleanup
+# Current work directory should be
+# {builddir}/test/work/extra/mtn-cleanup/workspace
 
-set -x
 yes | PATH=${2}/../../../..:${PATH} ${1}/../extra/bin/mtn-cleanup 
============================================================
--- /dev/null	
+++ test/extra/mail-notify/__driver__.lua	dd5179702c826ae1b6a205f63a8ea39c7e3fb590
@@ -0,0 +1,72 @@
+skip_if(not existsonpath("mime-construct"))
+skip_if(not existsonpath("source-highlight"))
+
+includecommon("netsync.lua")
+
+mtn_setup()
+netsync.setup()
+append("netsync.lua", "\n\
+\n\
+includedirpattern(get_confdir() .. \"/hooks.d\",\"*.conf\")\n\
+includedirpattern(get_confdir() .. \"/hooks.d\",\"*.lua\")\n\
+")
+
+-- To make sure we get things into a file and not sent to some unknown
+-- email address (or /dev/null, which doesn't help us much), we do a
+-- little bit of a hack to modify the behaviour of mime-construct.  It
+-- works as follows:
+-- monotone server, on receiving a revision, will call the functions in
+-- monotone-mail-notify.lua, as normal.  The functions there will not
+-- call the shell script monotone-mail-notify directly, though.  Instead,
+-- it will call run-mail-notify (present in this test directory), which
+-- will alter $PATH locally to call a local version of mime-construct
+-- (basically, a shell script that calls mime-construct with an extra
+-- parameter to make sure it outputs to file instead of sending an email).
+mkdir("hooks.d")
+mkdir("scripts")
+check(copy(srcdir.."/../extra/mtn-hooks/monotone-mail-notify.lua",
+	   "hooks.d/monotone-mail-notify.lua"))
+check(copy(srcdir.."/../extra/mtn-hooks/monotone-mail-notify",
+	   "scripts/monotone-mail-notify"))
+check(get("scripts/run-mail-notify"))
+check(get("scripts/mime-construct"))
+check(get("hooks.d/authorize_mail_notify_commands.lua"))
+
+-- A file with expected result and the script that generates it
+check(get("mime-construct.expected"))
+check(get("scripts/mime-construct-extract"))
+
+-- Serve test2.db
+srv = netsync.start(2)
+
+-- Write the notification configuration
+mkdir(test.root .. "/spool")
+check(writefile("notify", "server \"mtn://" .. srv.address .. "?testbranch\"\
+from \"address@hidden"\
+keydir \"" .. test.root .. "/keys\"\
+key \"\"\
+shellscript \"" .. test.root .. "/scripts/run-mail-notify\"\
+base \"" .. test.root .."/spool\"\
+\
+pattern \"*\"\
+allow \"address@hidden"\
+"))
+
+-- Add some revisions to push
+addfile("test1", "foo")
+addfile("test2", "bar")
+commit()
+writefile("test2", "foobar")
+commit()
+
+-- Do the transfer
+srv:push("testbranch",1)
+
+check(exists("mime-construct.out"))
+wait(spawn_redirected("mime-construct.out",
+		      "mime-construct.extract",
+		      "mime-extract.err",
+		      "scripts/mime-construct-extract"))
+check(samefile("mime-construct.extract",
+	       "mime-construct.expected"))
+srv:stop()
============================================================
--- /dev/null	
+++ test/extra/mail-notify/hooks.d/authorize_mail_notify_commands.lua	948a7bfa96c89da0265c8b5eda4a99263c74491f
@@ -0,0 +1,15 @@
+do
+   local _save_get_remote_automate_permitted = get_remote_automate_permitted
+   function get_remote_automate_permitted(key_identity, command, options)
+      local mail_notify_commands = {
+	 "parents", "get_revision", "get_file", "content_diff"
+      }
+      for _,v in ipairs(mail_notify_commands) do
+	 if (v == command[1]) then
+	    return true
+	 end
+      end
+
+      return false
+   end
+end
============================================================
--- /dev/null	
+++ test/extra/mail-notify/mime-construct.expected	56c894acf95b527b9a05de2147e21b1aa1f2b3ce
@@ -0,0 +1,53 @@
+To: address@hidden
+From: address@hidden
+Subject: testbranch: 425f7d00baffb1f43a12b60f106b2293d5dddd7c
+--1
+revision:            425f7d00baffb1f43a12b60f106b2293d5dddd7c
+author:              address@hidden
+branch:              testbranch
+new_manifest [7d7201b5790d5f03cb148fe419c146329d509c3f]
+old_revision [dea7b0e6d7db3450398fa32af3938861b4e6dc60]
+patch "test2"
+ from [62cdb7020ff920e5aa642c3d4066950dd1f01f4d]
+   to [8843d7f92416211de9ebb963ff4ce28125932878]
+--1
+--2
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- test2	62cdb7020ff920e5aa642c3d4066950dd1f01f4d
++++ test2	8843d7f92416211de9ebb963ff4ce28125932878
+@@ -1 +1 @@
+-bar
+\ No newline at end of file
++foobar
+\ No newline at end of file
+
+--2
+--2--
+--1--
+To: address@hidden
+From: address@hidden
+Subject: testbranch: dea7b0e6d7db3450398fa32af3938861b4e6dc60
+--3
+revision:            dea7b0e6d7db3450398fa32af3938861b4e6dc60
+author:              address@hidden
+branch:              testbranch
+new_manifest [b41ab7e3662a901fd8e2b6687804b8dcb2718264]
+old_revision []
+add_file "test1"
+ content [0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33]
+add_file "test2"
+ content [62cdb7020ff920e5aa642c3d4066950dd1f01f4d]
+--3
+--4
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+--- /dev/null=09
++++ test2	62cdb7020ff920e5aa642c3d4066950dd1f01f4d
++bar=
+
+--4
+--4--
+--3--
============================================================
--- /dev/null	
+++ test/extra/mail-notify/scripts/mime-construct	e8b34e4c59812c2e706f913bf8f7a694588af12c
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+set -x
+if [ "$1" = "--subpart" ]; then
+    # The calling script is already redirecting to a file,
+    # let's not disturb that
+    $_MIME_CONSTRUCT "$@"
+else
+    $_MIME_CONSTRUCT --output "$@" \
+	>> $_MIME_CONSTRUCT_OUTPUT \
+	2>> $_MIME_CONSTRUCT_ERROR
+fi
============================================================
--- /dev/null	
+++ test/extra/mail-notify/scripts/mime-construct-extract	96cfd2769fa0ea941d9db5d3273d68122c44b12e
@@ -0,0 +1,88 @@
+#! /usr/bin/env perl
+
+# Takes a mail file generated with mime-construct and extracts the headers
+# To:, From: and Subject:, reformats the boundary lines to use numbers
+# (counting from 1) and any line containing one of the following regexps:
+# /^revision:\s/
+# /^author:\s/
+# /^branch:\s/
+# /^new_manifest\s\[/
+# /^old_revision\s\[/
+# /^patch\s"/
+# /^\sfrom\s\[/
+# /^\s\s\sto\s\[/
+# Also, any attachment with the content type text/plain that starts with
+# a line of = signs (QUOTED-PRINTABLE =3D) is extracted as is.
+
+use strict;
+use warnings;
+
+my @boundary_stack = ();
+my %boundary_index = ();
+my $next_index = 0;
+
+while(1) {
+    # Start with headers, those are seen all the way until the first empty line
+
+    my $current_content_type;
+    while(<STDIN>) {
+	chomp;
+	last if /^$/;
+
+	if (m|^content-type:\s*([-a-z]+/[-a-z]+)\s*(?:;\s*([a-z]+)=(.+))?$|i) {
+	    $current_content_type = $1;
+	    my $parameter_name = $2;
+	    my $parameter_value = $3;
+	    if ($current_content_type =~ m|^multipart/.*$|) {
+		# $parameter_name should be "boundary"
+		push @boundary_stack, $parameter_value;
+		$boundary_index{$parameter_value} = ++$next_index;
+	    }
+	}
+
+	next unless /^(to|from|subject):\s/i;
+	print $_,"\n";
+    }
+
+    ### Now is the time for the main body, before the attachments
+
+    # The following is to detect a text/plain file that starts with a series
+    # of quoted-printable equal signs (=3D).
+    my $first_line = 1;
+    my $print_all = 0;
+
+    while(<STDIN>) {
+	chomp;
+
+	my $current_boundary = $boundary_stack[$#boundary_stack];
+	my $current_index = $boundary_index{$current_boundary};
+
+	if ($first_line && $current_content_type eq "text/plain" &&
+	    m|^(=3D)+=$|) {
+	    $print_all = 1;
+	}
+	$first_line = 0;
+	if ($_ eq "--$current_boundary") {
+	    print "--$current_index\n";
+	    last;
+	}
+	if ($_ eq "--$current_boundary--") {
+	    print "--$current_index--\n";
+	    pop @boundary_stack;
+	    last if $#boundary_stack < 0;
+	    next;
+	}
+
+	next unless $print_all ||
+	    /^(?:
+	       (?:revision|author|branch):\s
+	       |
+	       (?:new_manifest|old_revision|\s+from|\s+to|\s+content)\s\[
+	       |
+	       (?:patch|add_file)\s\"
+	       )/sx;
+	print $_,"\n";
+    }
+
+    last if eof(STDIN);
+}
============================================================
--- /dev/null	
+++ test/extra/mail-notify/scripts/run-mail-notify	b90ab9abd71ff563f2492839cff878b947092bd6
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+# Current work directory should be
+# {builddir}/test/work/extra/mail-notify
+
+_MIME_CONSTRUCT="`type -p mime-construct || which mime-construct`"
+_MIME_CONSTRUCT_OUTPUT="`pwd`/mime-construct.out"
+_MIME_CONSTRUCT_ERROR="`pwd`/mime-construct.err"
+_HERE="`dirname ${0}`"
+ls -a "$1"
+ls -aR "`dirname $1`"
+export _MIME_CONSTRUCT _MIME_CONSTRUCT_OUTPUT _MIME_CONSTRUCT_ERROR
+PATH=${_HERE}:$PATH ${_HERE}/monotone-mail-notify "$@"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]