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;
26
27class lua_hooks
28{
29 struct lua_State * st;
30
31public:
32 lua_hooks();
33 ~lua_hooks();
34#ifdef BUILD_UNIT_TESTS
35 void add_test_hooks();
36#endif
37 void set_app(app_state *_app);
38 void add_std_hooks();
39 void workspace_rcfilename(bookkeeping_path & file);
40 void default_rcfilename(system_path & file);
41 void load_rcfile(utf8 const & file);
42 void load_rcfile(any_path const & file, bool required);
43 bool hook_exists(std::string const & func_name);
44
45 // cert hooks
46 bool hook_expand_selector(std::string const & sel, std::string & exp);
47 bool hook_expand_date(std::string const & sel, std::string & exp);
48 bool hook_get_branch_key(branch_name const & branchname, rsa_keypair_id & k);
49 bool hook_get_passphrase(rsa_keypair_id const & k, std::string & phrase);
50 bool hook_get_author(branch_name const & branchname,
51 rsa_keypair_id const & k,
52 std::string & author);
53 bool hook_edit_comment(external const & commentary,
54 external const & user_log_message,
55 external & result);
56 bool hook_persist_phrase_ok();
57 bool hook_get_revision_cert_trust(std::set<rsa_keypair_id> const & signers,
58 hexenc<id> const & id,
59 cert_name const & name,
60 cert_value const & val);
61 bool hook_get_manifest_cert_trust(std::set<rsa_keypair_id> const & signers,
62 hexenc<id> const & id,
63 cert_name const & name,
64 cert_value const & val);
65 bool hook_accept_testresult_change(std::map<rsa_keypair_id, bool> const & old_results,
66 std::map<rsa_keypair_id, bool> const & new_results);
67
68 // network hooks
69 bool hook_get_netsync_key(utf8 const & server_address,
70 globish const & include,
71 globish const & exclude,
72 rsa_keypair_id & k);
73 bool hook_get_netsync_connect_command(uri const & u,
74 globish const & include_pattern,
75 globish const & exclude_pattern,
76 bool debug,
77 std::vector<std::string> & argv);
78 bool hook_use_transport_auth(uri const & u);
79
80 bool hook_get_netsync_read_permitted(std::string const & branch,
81 rsa_keypair_id const & identity);
82 // anonymous no-key version
83 bool hook_get_netsync_read_permitted(std::string const & branch);
84 bool hook_get_netsync_write_permitted(rsa_keypair_id const & identity);
85
86 // local repo hooks
87 bool hook_ignore_file(file_path const & p);
88 bool hook_ignore_branch(branch_name const & branch);
89 bool hook_merge3(file_path const & anc_path,
90 file_path const & left_path,
91 file_path const & right_path,
92 file_path const & merged_path,
93 data const & ancestor,
94 data const & left,
95 data const & right,
96 data & result);
97
98 bool hook_external_diff(file_path const & path,
99 data const & data_old,
100 data const & data_new,
101 bool is_binary,
102 bool diff_args_provided,
103 std::string const & diff_args,
104 std::string const & oldrev,
105 std::string const & newrev);
106
107 bool hook_get_encloser_pattern(file_path const & path,
108 std::string & pattern);
109
110 // workspace hooks
111 bool hook_use_inodeprints();
112
113 // attribute hooks
114 bool hook_init_attributes(file_path const & filename,
115 std::map<std::string, std::string> & attrs);
116 bool hook_apply_attribute(std::string const & attr,
117 file_path const & filename,
118 std::string const & value);
119
120 // validation hooks
121 bool hook_validate_commit_message(utf8 const & message,
122 revision_data const & new_rev,
123 branch_name const & branchname,
124 bool & validated,
125 std::string & reason);
126
127 // notification hooks
128 bool hook_note_commit(revision_id const & new_id,
129 revision_data const & rdat,
130 std::map<cert_name, cert_value> const & certs);
131
132 bool hook_note_netsync_start(size_t session_id,
133 std::string my_role,
134 int sync_type,
135 std::string remote_host,
136 rsa_keypair_id remote_keyname,
137 globish include_pattern,
138 globish exclude_pattern);
139 bool hook_note_netsync_revision_received(revision_id const & new_id,
140 revision_data const & rdat,
141 std::set<std::pair<rsa_keypair_id,
142 std::pair<cert_name,
143 cert_value> > > const & certs,
144 size_t session_id);
145 bool hook_note_netsync_pubkey_received(rsa_keypair_id const & kid,
146 size_t session_id);
147 bool hook_note_netsync_cert_received(revision_id const & rid,
148 rsa_keypair_id const & kid,
149 cert_name const & name,
150 cert_value const & value,
151 size_t session_id);
152 bool hook_note_netsync_end(size_t session_id, int status,
153 size_t bytes_in, size_t bytes_out,
154 size_t certs_in, size_t certs_out,
155 size_t revs_in, size_t revs_out,
156 size_t keys_in, size_t keys_out);
157 bool hook_note_mtn_startup(args_vector const & args);
158};
159
160// Local Variables:
161// mode: C++
162// fill-column: 76
163// c-file-style: "gnu"
164// indent-tabs-mode: nil
165// End:
166// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
167
168#endif // __LUA_HOOKS_HH__

Archive Download this file

Branches

Tags

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