monotone

monotone Mtn Source Tree

Root/patch_set.hh

1#ifndef __PATCH_SET_HH__
2#define __PATCH_SET_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 <set>
10#include <map>
11#include <vector>
12
13#include "vocab.hh"
14#include "manifest.hh"
15#include "app_state.hh"
16#include "packet.hh"
17
18// this file defines the algorithms responsible for analyzing and
19// classifying changes to manifests and files. it also constructs packet
20// sequences and textual summaries representing a given set of classified
21// changes.
22
23struct patch_delta
24{
25 patch_delta(file_id const & o,
26 file_id const & n,
27 file_path const & p);
28 file_id id_old;
29 file_id id_new;
30 // this is necessary for the case when someone (eg. "commit") wants to
31 // pull the post-image of a patch_delta from the filesystem which is not,
32 // alas, addressable by sha-1 <g>
33 file_path path;
34};
35
36struct patch_addition
37{
38 patch_addition(file_id const & i, file_path const & p);
39 file_id ident;
40 file_path path;
41};
42
43struct patch_move
44{
45 patch_move(file_path const & o, file_path const & n);
46 file_path path_old;
47 file_path path_new;
48};
49
50struct patch_set
51{
52 manifest_id m_old;
53 manifest_id m_new;
54 manifest_map map_old;
55 manifest_map map_new;
56 std::set<patch_addition> f_adds;
57 std::set<patch_delta> f_deltas;
58 std::set<patch_move> f_moves;
59 std::set<file_path> f_dels;
60};
61
62
63struct version_existence_check
64{
65 virtual bool check(file_id i) = 0;
66};
67
68// unfortunately the needs of this API have expanded over time (it was
69// among the first code ever in monotone) so we've had to flesh it out with
70// a bunch of overloads which call the more detailed versions using simple
71// defaults that preserve the "original" uses.
72
73void manifests_to_patch_set(manifest_map const & m_old,
74 manifest_map const & m_new,
75 app_state & app,
76 patch_set & ps);
77
78void manifests_to_patch_set(manifest_map const & m_old,
79 manifest_map const & m_new,
80 app_state & app,
81 version_existence_check & vc,
82 patch_set & ps);
83
84void manifests_to_patch_set(manifest_map const & m_old,
85 manifest_map const & m_new,
86 rename_edge const & renames,
87 app_state & app,
88 patch_set & ps);
89
90void manifests_to_patch_set(manifest_map const & m_old,
91 manifest_map const & m_new,
92 rename_edge const & renames,
93 version_existence_check & vc,
94 patch_set & ps);
95
96void patch_set_to_text_summary(patch_set const & ps,
97 std::ostream & str);
98
99void patch_set_to_packets(patch_set const & ps,
100 app_state & app,
101 packet_consumer & cons);
102
103bool operator<(const patch_addition & a,
104 const patch_addition & b);
105
106bool operator<(const patch_move & a,
107 const patch_move & b);
108
109bool operator<(const patch_delta & a,
110 const patch_delta & b);
111
112#endif // __PATCH_SET_HH__

Archive Download this file

Branches

Tags

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