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

Archive Download this file

Branches

Tags

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