# # # patch "cert.cc" # from [e25182cb2678de3798544a8112f95f10609cb67f] # to [2fd05f14b5afc1de9f24b7eeca4c186b598ce0cd] # # patch "lua_hooks.cc" # from [9f844c1bf6692f8bb488e5a596caa2f622f8a454] # to [daebff8213625ca25d7f00572372a26b3d1fcedd] # # patch "lua_hooks.hh" # from [4d1020534c8163ec6f99b87ccffe13296f13feb0] # to [647093e940b9ce9013f8bd3d3e4660e9018351ba] # # patch "monotone.texi" # from [7ad576a73ebf549c1ba9961ddb6d2d6e826fb2dd] # to [39bffc8275d4c84b197d194ca3ef95efd7ff9d70] # ============================================================ --- cert.cc e25182cb2678de3798544a8112f95f10609cb67f +++ cert.cc 2fd05f14b5afc1de9f24b7eeca4c186b598ce0cd @@ -585,11 +585,12 @@ cert_revision_author_default(revision_id packet_consumer & pc) { string author; - if (!app.lua.hook_get_author(app.opts.branchname, author)) + rsa_keypair_id key; + get_user_key(key, app); + + if (!app.lua.hook_get_author(app.opts.branchname, key, author)) { - rsa_keypair_id key; - get_user_key(key, app), - author = key(); + author = key(); } cert_revision_author(m, author, app, pc); } ============================================================ --- lua_hooks.cc 9f844c1bf6692f8bb488e5a596caa2f622f8a454 +++ lua_hooks.cc daebff8213625ca25d7f00572372a26b3d1fcedd @@ -272,12 +272,14 @@ lua_hooks::hook_get_author(branch_name c bool lua_hooks::hook_get_author(branch_name const & branchname, + rsa_keypair_id const & k, string & author) { return Lua(st) .func("get_author") .push_str(branchname()) - .call(1,1) + .push_str(k()) + .call(2,1) .extract_str(author) .ok(); } ============================================================ --- lua_hooks.hh 4d1020534c8163ec6f99b87ccffe13296f13feb0 +++ lua_hooks.hh 647093e940b9ce9013f8bd3d3e4660e9018351ba @@ -46,7 +46,9 @@ public: bool hook_expand_date(std::string const & sel, std::string & exp); bool hook_get_branch_key(branch_name const & branchname, rsa_keypair_id & k); bool hook_get_passphrase(rsa_keypair_id const & k, std::string & phrase); - bool hook_get_author(branch_name const & branchname, std::string & author); + bool hook_get_author(branch_name const & branchname, + rsa_keypair_id const & k, + std::string & author); bool hook_edit_comment(external const & commentary, external const & user_log_message, external & result); ============================================================ --- monotone.texi 7ad576a73ebf549c1ba9961ddb6d2d6e826fb2dd +++ monotone.texi 39bffc8275d4c84b197d194ca3ef95efd7ff9d70 @@ -7511,7 +7511,7 @@ @section Automation @end table address@hidden mtn automate db_set @var{domain} @var{name} @var{value} address@hidden mtn automate db_put @var{domain} @var{name} @var{value} @table @strong @item Arguments: @@ -7960,18 +7960,21 @@ @subsection User Defaults this hook is not defined or returns false, monotone will prompt you for a passphrase each time it needs to use a private key. address@hidden get_author (@var{branchname}) address@hidden get_author (@var{branchname}, @var{keypair_id}) Returns a string which is used as a value for automatically generated @code{author} certificates when you commit changes to address@hidden Generally this hook remains undefined, and monotone -selects your signing key name for the author certificate. You can use -this hook to override that choice, if you like. address@hidden with the keypair identity @var{keypair_id}. Generally +this hook remains undefined, and monotone selects your signing key name +for the author certificate. You can use this hook to override that +choice, if you like. -This hook has no default definition, but a possible definition might be: +This hook has no default definition, but a couple of possible +definitions might be: @smallexample @group -function get_author(branchname) +function get_author(branchname, keypair_id) + -- Key pair identity ignored. local user = os.getenv("USER") local host = os.getenv("HOSTNAME") if ((user == nil) or (host == nil)) then return nil end @@ -7979,6 +7982,17 @@ @subsection User Defaults end @end group @end smallexample address@hidden address@hidden +function get_author(branchname, keypair_id) + -- Branch name ignored. + if (keypair_id == "joe@@example.com") then + return "Joe Random " + end + return keypair_id +end address@hidden group address@hidden smallexample @item edit_comment (@var{commentary}, @var{user_log_message})