monotone

monotone Mtn Source Tree

Root/manifest.hh

1#ifndef __MANIFEST_HH__
2#define __MANIFEST_HH__
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#include <map>
10#include <set>
11#include <string>
12
13#include "quick_alloc.hh"
14#include "vocab.hh"
15
16// this file defines the class of manifest_map objects, and various
17// comparison and i/o functions on them. a manifest_map is an unpacked
18// (analyzed) manifest_data blob. it specifies exactly which versions of
19// each file reside at which path location in a given tree. the textual
20// encoding of a manifest looks like this:
21//
22// ...
23// f2e5719b975e319c2371c98ed2c7231313fac9b5 fs/readdir.c
24// 81f0c9a0df254bc8d51bb785713a9f6d0b020b22 fs/read_write.c
25// 943851e7da46014cb07473b90d55dd5145f24de0 fs/pipe.c
26// ddc2686e000e97f670180c60a3066989e56a11a3 fs/open.c
27// 295d276e6c9ce64846d309a8e39507bcb0a14248 fs/namespace.c
28// 71e0274f16cd68bdf9a2bf5743b86fcc1e597cdc fs/namei.c
29// 1112c0f8054cebc9978aa77384e3e45c0f3b6472 fs/iobuf.c
30// 8ddcfcc568f33db6205316d072825d2e5c123275 fs/inode.c
31// ...
32//
33// which is essentially the result of running:
34//
35// 'find -type f | xargs sha1sum'
36//
37// with some minor tidying up of pathnames and sorting. manifests must
38// have only one entry for each pathname. the same sha1 can occur multiple
39// times in a manifest.
40
41typedef std::set<file_path> path_set;
42extern std::string const manifest_file_name;
43
44typedef std::pair<file_path const, file_id> manifest_entry;
45
46typedef std::map<file_path, file_id,
47 std::less<file_path>,
48 QA(manifest_entry) > manifest_map;
49
50inline file_path const &
51manifest_entry_path(manifest_entry const & e)
52{
53 return e.first;
54}
55
56inline file_path const &
57manifest_entry_path(manifest_map::const_iterator i)
58{
59 return i->first;
60}
61
62inline file_id const &
63manifest_entry_id(manifest_entry const & e)
64{
65 return e.second;
66}
67
68inline file_id const &
69manifest_entry_id(manifest_map::const_iterator i)
70{
71 return i->second;
72}
73
74std::ostream & operator<<(std::ostream & out, manifest_entry const & e);
75
76class app_state;
77
78/** these seem to be unused
79
80// from cwd
81void build_manifest_map(app_state & app,
82manifest_map & man);
83
84// from some safe sub-dir within cwd
85void build_manifest_map(file_path const & path,
86app_state & app,
87manifest_map & man);
88
89**/
90
91void build_manifest_map(path_set const & paths,
92manifest_map & man,
93app_state & app);
94
95void build_restricted_manifest_map(path_set const & paths,
96 manifest_map const & m_old,
97 manifest_map & m_new,
98 app_state & app);
99
100void read_manifest_map(data const & dat,
101 manifest_map & man);
102
103void read_manifest_map(manifest_data const & dat,
104 manifest_map & man);
105
106void write_manifest_map(manifest_map const & man,
107manifest_data & dat);
108
109void write_manifest_map(manifest_map const & man,
110data & dat);
111
112#endif // __MANIFEST_HH__

Archive Download this file

Branches

Tags

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