monotone

monotone Mtn Source Tree

Root/lua.hh

1#ifndef __LUA__
2#define __LUA__
3
4// copyright (C) 2002, 2003 graydon hoare <graydon@pobox.com>
5// all rights reserved.
6// licensed to the public under the terms of the GNU GPL (>= 2)
7// see the file COPYING for details
8
9// this file defines a typed C++ interface to the various hooks
10// we expose to the user as lua functions or variables
11
12#include <string>
13#include <set>
14#include <map>
15#include "file_io.hh"
16#include "vocab.hh"
17#include "paths.hh"
18
19struct patch_set;
20
21struct lua_State;
22
23class lua_hooks
24{
25 struct lua_State * st;
26 template <typename RES>
27 std::pair<bool,RES> call_hook(char const * name, int nargs, ...);
28
29public:
30 lua_hooks();
31 ~lua_hooks();
32#ifdef BUILD_UNIT_TESTS
33 void add_test_hooks();
34#endif
35 void set_app(app_state *_app);
36 void add_std_hooks();
37 void working_copy_rcfilename(bookkeeping_path & file);
38 void default_rcfilename(system_path & file);
39 void load_rcfile(utf8 const & file);
40 void load_rcfile(any_path const & file, bool required);
41
42 // cert hooks
43 bool hook_expand_selector(std::string const & sel, std::string & exp);
44 bool hook_expand_date(std::string const & sel, std::string & exp);
45 bool hook_get_branch_key(cert_value const & branchname, rsa_keypair_id & k);
46 bool hook_get_key_pair(rsa_keypair_id const & k,
47 keypair & kp);
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_non_blocking_rng_ok();
55 bool hook_get_revision_cert_trust(std::set<rsa_keypair_id> const & signers,
56 hexenc<id> const & id,
57 cert_name const & name,
58 cert_value const & val);
59 bool hook_get_manifest_cert_trust(std::set<rsa_keypair_id> const & signers,
60 hexenc<id> const & id,
61 cert_name const & name,
62 cert_value const & val);
63 bool hook_accept_testresult_change(std::map<rsa_keypair_id, bool> const & old_results,
64 std::map<rsa_keypair_id, bool> const & new_results);
65
66 // network hooks
67 bool hook_get_netsync_read_permitted(std::string const & branch,
68 rsa_keypair_id const & identity);
69 // anonymous no-key version
70 bool hook_get_netsync_read_permitted(std::string const & branch);
71 bool hook_get_netsync_write_permitted(rsa_keypair_id const & identity);
72
73 // local repo hooks
74 bool hook_ignore_file(file_path const & p);
75 bool hook_ignore_branch(std::string const & branch);
76 bool hook_merge2(file_path const & left_path,
77 file_path const & right_path,
78 file_path const & merged_path,
79 data const & left,
80 data const & right,
81 data & result);
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_resolve_file_conflict(file_path const & anc,
92 file_path const & a,
93 file_path const & b,
94 file_path & res);
95
96 bool hook_resolve_dir_conflict(file_path const & anc,
97 file_path const & a,
98 file_path const & b,
99 file_path & res);
100
101 bool hook_external_diff(file_path const & path,
102 data const & data_old,
103 data const & data_new,
104 bool is_binary,
105 bool diff_args_provided,
106 std::string const & diff_args,
107 std::string const & oldrev,
108 std::string const & newrev);
109
110 // working copy 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 // conversion hooks
121 bool hook_get_system_linesep(std::string & linesep);
122 bool hook_get_charset_conv(file_path const & p,
123 std::string & db, std::string & ext);
124 bool hook_get_linesep_conv(file_path const & p,
125 std::string & db, std::string & ext);
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_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 bool hook_note_netsync_pubkey_received(rsa_keypair_id const & kid);
138 bool hook_note_netsync_cert_received(revision_id const & rid,
139 rsa_keypair_id const & kid,
140 cert_name const & name,
141 cert_value const & value);
142};
143
144#endif // __LUA_HH__

Archive Download this file

Branches

Tags

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