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

Archive Download this file

Branches

Tags

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