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
18struct patch_set;
19
20struct lua_State;
21
22class lua_hooks
23{
24 struct lua_State * st;
25 template <typename RES>
26 std::pair<bool,RES> call_hook(char const * name, int nargs, ...);
27
28public:
29 lua_hooks();
30 ~lua_hooks();
31#ifdef BUILD_UNIT_TESTS
32 void add_test_hooks();
33#endif
34 void add_std_hooks();
35 void working_copy_rcfilename(fs::path & file);
36 void default_rcfilename(fs::path & file);
37 void load_rcfile(fs::path const & file, bool required);
38
39 // cert hooks
40 bool hook_expand_selector(std::string const & sel, std::string & exp);
41 bool hook_get_branch_key(cert_value const & branchname, rsa_keypair_id & k);
42 bool lua_hooks::hook_get_priv_key(rsa_keypair_id const & k,
43 base64< arc4<rsa_priv_key> > & priv_key );
44 bool hook_get_passphrase(rsa_keypair_id const & k, std::string & phrase);
45 bool hook_get_author(cert_value const & branchname, std::string & author);
46 bool hook_edit_comment(std::string const & commentary,
47 std::string const & user_log_message,
48 std::string & result);
49 bool hook_persist_phrase_ok();
50 bool hook_non_blocking_rng_ok();
51 bool hook_get_revision_cert_trust(std::set<rsa_keypair_id> const & signers,
52 hexenc<id> const & id,
53 cert_name const & name,
54 cert_value const & val);
55 bool hook_get_manifest_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_accept_testresult_change(std::map<rsa_keypair_id, bool> const & old_results,
60 std::map<rsa_keypair_id, bool> const & new_results);
61
62 // network hooks
63 bool hook_get_netsync_read_permitted(std::string const & collection,
64 rsa_keypair_id const & identity);
65 bool hook_get_netsync_anonymous_read_permitted(std::string const & collection);
66 bool hook_get_netsync_write_permitted(std::string const & collection,
67 rsa_keypair_id const & identity);
68
69 // local repo hooks
70 bool hook_ignore_file(file_path const & p);
71 bool hook_ignore_branch(std::string const & branch);
72 bool hook_merge2(file_path const & left_path,
73 file_path const & right_path,
74 file_path const & merged_path,
75 data const & left,
76 data const & right,
77 data & result);
78 bool hook_merge3(file_path const & anc_path,
79 file_path const & left_path,
80 file_path const & right_path,
81 file_path const & merged_path,
82 data const & ancestor,
83 data const & left,
84 data const & right,
85 data & result);
86
87 bool hook_resolve_file_conflict(file_path const & anc,
88 file_path const & a,
89 file_path const & b,
90 file_path & res);
91
92 bool hook_resolve_dir_conflict(file_path const & anc,
93 file_path const & a,
94 file_path const & b,
95 file_path & res);
96
97 // attribute hooks
98 bool hook_apply_attribute(std::string const & attr,
99 file_path const & filename,
100 std::string const & value);
101
102 // conversion hooks
103 bool hook_get_system_linesep(std::string & linesep);
104 bool hook_get_charset_conv(file_path const & p,
105 std::string & db, std::string & ext);
106 bool hook_get_linesep_conv(file_path const & p,
107 std::string & db, std::string & ext);
108
109 // notification hooks
110 bool hook_note_commit(revision_id const & new_id,
111 std::map<cert_name, cert_value> const & certs);
112};
113
114#endif // __LUA_HH__

Archive Download this file

Branches

Tags

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