monotone

monotone Mtn Source Tree

Root/lua_hooks.hh

1#ifndef __LUA_HOOKS_HH__
2#define __LUA_HOOKS_HH__
3
4// Copyright (C) 2002 Graydon Hoare <graydon@pobox.com>
5//
6// This program is made available under the GNU GPL version 2.0 or
7// greater. See the accompanying file COPYING for details.
8//
9// This program is distributed WITHOUT ANY WARRANTY; without even the
10// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11// PURPOSE.
12
13// this file defines a typed C++ interface to the various hooks
14// we expose to the user as lua functions or variables
15
16#include <set>
17#include <map>
18#include "file_io.hh"
19#include "option.hh"
20#include "vocab.hh"
21#include "paths.hh"
22
23struct uri;
24class app_state;
25struct lua_State;
26struct globish;
27struct options;
28
29extern app_state* get_app_state(lua_State *L);
30
31class lua_hooks
32{
33 struct lua_State * st;
34
35 void add_std_hooks();
36 void load_rcfile(utf8 const & file);
37 void load_rcfile(any_path const & file, bool required);
38
39public:
40 lua_hooks(app_state * app);
41 ~lua_hooks();
42 bool check_lua_state(lua_State * st) const;
43 void load_rcfiles(options & opts);
44 bool hook_exists(std::string const & func_name);
45
46 // cert hooks
47 bool hook_expand_selector(std::string const & sel, std::string & exp);
48 bool hook_expand_date(std::string const & sel, std::string & exp);
49 bool hook_get_branch_key(branch_name const & branchname, rsa_keypair_id & k);
50 bool hook_get_passphrase(rsa_keypair_id const & k, std::string & phrase);
51 bool hook_get_author(branch_name const & branchname,
52 rsa_keypair_id const & k,
53 std::string & author);
54 bool hook_edit_comment(external const & commentary,
55 external const & user_log_message,
56 external & result);
57 bool hook_persist_phrase_ok();
58 bool hook_get_revision_cert_trust(std::set<rsa_keypair_id> const & signers,
59 hexenc<id> const & id,
60 cert_name const & name,
61 cert_value const & val);
62 bool hook_get_revision_cert_trust(std::set<rsa_keypair_id> const & signers,
63 revision_id const & id,
64 cert_name const & name,
65 cert_value const & val);
66 bool hook_get_manifest_cert_trust(std::set<rsa_keypair_id> const & signers,
67 hexenc<id> const & id,
68 cert_name const & name,
69 cert_value const & val);
70 bool hook_get_manifest_cert_trust(std::set<rsa_keypair_id> const & signers,
71 manifest_id const & id,
72 cert_name const & name,
73 cert_value const & val);
74 bool hook_accept_testresult_change(std::map<rsa_keypair_id, bool> const & old_results,
75 std::map<rsa_keypair_id, bool> const & new_results);
76
77 // network hooks
78 bool hook_get_netsync_key(utf8 const & server_address,
79 globish const & include,
80 globish const & exclude,
81 rsa_keypair_id & k);
82 bool hook_get_netsync_connect_command(uri const & u,
83 globish const & include_pattern,
84 globish const & exclude_pattern,
85 bool debug,
86 std::vector<std::string> & argv);
87 bool hook_use_transport_auth(uri const & u);
88
89 bool hook_get_netsync_read_permitted(std::string const & branch,
90 rsa_keypair_id const & identity);
91 // anonymous no-key version
92 bool hook_get_netsync_read_permitted(std::string const & branch);
93 bool hook_get_netsync_write_permitted(rsa_keypair_id const & identity);
94
95 // local repo hooks
96 bool hook_ignore_file(file_path const & p);
97 bool hook_ignore_branch(branch_name const & branch);
98 bool hook_merge3(file_path const & anc_path,
99 file_path const & left_path,
100 file_path const & right_path,
101 file_path const & merged_path,
102 data const & ancestor,
103 data const & left,
104 data const & right,
105 data & result);
106
107 bool hook_external_diff(file_path const & path,
108 data const & data_old,
109 data const & data_new,
110 bool is_binary,
111 bool diff_args_provided,
112 std::string const & diff_args,
113 std::string const & oldrev,
114 std::string const & newrev);
115
116 bool hook_get_encloser_pattern(file_path const & path,
117 std::string & pattern);
118
119 // workspace hooks
120 bool hook_use_inodeprints();
121
122 // attribute hooks
123 bool hook_init_attributes(file_path const & filename,
124 std::map<std::string, std::string> & attrs);
125 bool hook_apply_attribute(std::string const & attr,
126 file_path const & filename,
127 std::string const & value);
128
129 // validation hooks
130 bool hook_validate_commit_message(utf8 const & message,
131 revision_data const & new_rev,
132 branch_name const & branchname,
133 bool & validated,
134 std::string & reason);
135
136 // notification hooks
137 bool hook_note_commit(revision_id const & new_id,
138 revision_data const & rdat,
139 std::map<cert_name, cert_value> const & certs);
140
141 bool hook_note_netsync_start(size_t session_id,
142 std::string my_role,
143 int sync_type,
144 std::string remote_host,
145 rsa_keypair_id remote_keyname,
146 globish include_pattern,
147 globish exclude_pattern);
148 bool hook_note_netsync_revision_received(revision_id const & new_id,
149 revision_data const & rdat,
150 std::set<std::pair<rsa_keypair_id,
151 std::pair<cert_name,
152 cert_value> > > const & certs,
153 size_t session_id);
154 bool hook_note_netsync_pubkey_received(rsa_keypair_id const & kid,
155 size_t session_id);
156 bool hook_note_netsync_cert_received(revision_id const & rid,
157 rsa_keypair_id const & kid,
158 cert_name const & name,
159 cert_value const & value,
160 size_t session_id);
161 bool hook_note_netsync_end(size_t session_id, int status,
162 size_t bytes_in, size_t bytes_out,
163 size_t certs_in, size_t certs_out,
164 size_t revs_in, size_t revs_out,
165 size_t keys_in, size_t keys_out);
166 bool hook_note_mtn_startup(args_vector const & args);
167};
168
169// Local Variables:
170// mode: C++
171// fill-column: 76
172// c-file-style: "gnu"
173// indent-tabs-mode: nil
174// End:
175// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
176
177#endif // __LUA_HOOKS_HH__

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status