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 add_std_hooks();
36 void working_copy_rcfilename(bookkeeping_path & file);
37 void default_rcfilename(system_path & file);
38 void load_rcfile(utf8 const & file);
39 void load_rcfile(any_path const & file, bool required);
40
41 // cert hooks
42 bool hook_expand_selector(std::string const & sel, std::string & exp);
43 bool hook_expand_date(std::string const & sel, std::string & exp);
44 bool hook_get_branch_key(cert_value const & branchname, rsa_keypair_id & k);
45 bool lua_hooks::hook_get_priv_key(rsa_keypair_id const & k,
46 base64< arc4<rsa_priv_key> > & priv_key );
47 bool hook_get_passphrase(rsa_keypair_id const & k, std::string & phrase);
48 bool hook_get_author(cert_value const & branchname, std::string & author);
49 bool hook_edit_comment(std::string const & commentary,
50 std::string const & user_log_message,
51 std::string & result);
52 bool hook_persist_phrase_ok();
53 bool hook_non_blocking_rng_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_read_permitted(std::string const & branch,
67 rsa_keypair_id const & identity);
68 // anonymous no-key version
69 bool hook_get_netsync_read_permitted(std::string const & branch);
70 bool hook_get_netsync_write_permitted(rsa_keypair_id const & identity);
71
72 // local repo hooks
73 bool hook_ignore_file(file_path const & p);
74 bool hook_ignore_branch(std::string const & branch);
75 bool hook_merge2(file_path const & left_path,
76 file_path const & right_path,
77 file_path const & merged_path,
78 data const & left,
79 data const & right,
80 data & result);
81 bool hook_merge3(file_path const & anc_path,
82 file_path const & left_path,
83 file_path const & right_path,
84 file_path const & merged_path,
85 data const & ancestor,
86 data const & left,
87 data const & right,
88 data & result);
89
90 bool hook_resolve_file_conflict(file_path const & anc,
91 file_path const & a,
92 file_path const & b,
93 file_path & res);
94
95 bool hook_resolve_dir_conflict(file_path const & anc,
96 file_path const & a,
97 file_path const & b,
98 file_path & res);
99
100 bool hook_external_diff(file_path const & path,
101 data const & data_old,
102 data const & data_new,
103 bool is_binary,
104 bool diff_args_provided,
105 std::string const & diff_args,
106 std::string const & oldrev,
107 std::string const & newrev);
108
109 // working copy hooks
110 bool hook_use_inodeprints();
111
112 // attribute hooks
113 bool hook_init_attributes(file_path const & filename,
114 std::map<std::string, std::string> & attrs);
115 bool hook_apply_attribute(std::string const & attr,
116 file_path const & filename,
117 std::string const & value);
118
119 // conversion hooks
120 bool hook_get_system_linesep(std::string & linesep);
121 bool hook_get_charset_conv(file_path const & p,
122 std::string & db, std::string & ext);
123 bool hook_get_linesep_conv(file_path const & p,
124 std::string & db, std::string & ext);
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_revision_received(revision_id const & new_id,
132 revision_data const & rdat,
133 std::set<std::pair<rsa_keypair_id,
134 std::pair<cert_name,
135 cert_value> > > const & certs);
136 bool hook_note_netsync_pubkey_received(rsa_keypair_id const & kid);
137 bool hook_note_netsync_cert_received(revision_id const & rid,
138 rsa_keypair_id const & kid,
139 cert_name const & name,
140 cert_value const & value);
141};
142
143#endif // __LUA_HH__

Archive Download this file

Branches

Tags

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