monotone

monotone Mtn Source Tree

Root/project.hh

1// 2007 Timothy Brownawell <tbrownaw@gmail.com>
2// GNU GPL V2 or later
3
4#ifndef __PROJECT_HH__
5#define __PROJECT_HH__
6
7#include <map>
8#include <set>
9
10#include "cert.hh"
11#include "outdated_indicator.hh"
12#include "vocab.hh"
13
14class database;
15class key_store;
16class options;
17class lua_hooks;
18
19class tag_t
20{
21public:
22 revision_id ident;
23 utf8 name;
24 rsa_keypair_id key;
25 tag_t(revision_id const & ident, utf8 const & name, rsa_keypair_id const & key);
26};
27bool operator < (tag_t const & a, tag_t const & b);
28
29typedef bool suspended_indicator;
30
31class project_t
32{
33 // In the hypothetical future situation where one monotone process is
34 // using more than one database at a time, it will be essential to use a
35 // project object only with the database it was created from. To make it
36 // easy to get this right, we expose the database handle inside the
37 // project object, and make it a style rule that you pass around a
38 // database _or_ you pass around a project; not both.
39public:
40 database & db;
41
42private:
43 std::map<std::pair<branch_name, suspended_indicator>,
44 std::pair<outdated_indicator, std::set<revision_id> >
45 > branch_heads;
46 std::set<branch_name> branches;
47 outdated_indicator indicator;
48
49public:
50 project_t(database & db);
51
52 void get_branch_list(std::set<branch_name> & names,
53 bool check_heads = false);
54 void get_branch_list(globish const & glob, std::set<branch_name> & names,
55 bool check_heads = false);
56 void get_branch_heads(branch_name const & name, std::set<revision_id> & heads,
57 bool ignore_suspend_certs,
58 std::multimap<revision_id, revision_id> *inverse_graph_cache_ptr = NULL);
59
60 outdated_indicator get_tags(std::set<tag_t> & tags);
61 void put_tag(key_store & keys, revision_id const & id, std::string const & name);
62
63 bool revision_is_in_branch(revision_id const & id, branch_name const & branch);
64 void put_revision_in_branch(key_store & keys,
65 revision_id const & id,
66 branch_name const & branch);
67
68 bool revision_is_suspended_in_branch(revision_id const & id, branch_name const & branch);
69 void suspend_revision_in_branch(key_store & keys,
70 revision_id const & id,
71 branch_name const & branch);
72
73 outdated_indicator get_revision_cert_hashes(revision_id const & rid,
74 std::vector<id> & hashes);
75 outdated_indicator get_revision_certs(revision_id const & id,
76 std::vector<revision<cert> > & certs);
77 outdated_indicator get_revision_certs_by_name(revision_id const & id,
78 cert_name const & name,
79 std::vector<revision<cert> > & certs);
80 outdated_indicator get_revision_branches(revision_id const & id,
81 std::set<branch_name> & branches);
82 outdated_indicator get_branch_certs(branch_name const & branch,
83 std::vector<revision<cert> > & certs);
84
85 void put_standard_certs(key_store & keys,
86 revision_id const & id,
87 branch_name const & branch,
88 utf8 const & changelog,
89 date_t const & time,
90 std::string const & author);
91 void put_standard_certs_from_options(options const & opts,
92 lua_hooks & lua,
93 key_store & keys,
94 revision_id const & id,
95 branch_name const & branch,
96 utf8 const & changelog);
97
98 void put_cert(key_store & keys,
99 revision_id const & id,
100 cert_name const & name,
101 cert_value const & value);
102};
103
104#endif
105
106
107// Local Variables:
108// mode: C++
109// fill-column: 76
110// c-file-style: "gnu"
111// indent-tabs-mode: nil
112// End:
113// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
114

Archive Download this file

Branches

Tags

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