monotone

monotone Mtn Source Tree

Root/diff_patch.hh

1#ifndef __DIFF_PATCH_HH__
2#define __DIFF_PATCH_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 "app_state.hh"
10#include "cert.hh"
11#include "vocab.hh"
12
13#include <string>
14#include <vector>
15#include <iostream>
16
17struct conflict {};
18
19// this file is to contain some stripped down, in-process implementations
20// of GNU-diffutils-like things (diff, diff3, maybe patch..)
21
22void make_diff(std::string const & filename1,
23 std::string const & filename2,
24 file_id const & id1,
25 file_id const & id2,
26 std::vector<std::string> const & lines1,
27 std::vector<std::string> const & lines2,
28 std::ostream & ost,
29 diff_type type);
30
31bool merge3(std::vector<std::string> const & ancestor,
32 std::vector<std::string> const & left,
33 std::vector<std::string> const & right,
34 std::vector<std::string> & merged);
35
36struct merge_provider
37{
38 app_state & app;
39 manifest_map const & anc_man;
40 manifest_map const & left_man;
41 manifest_map const & right_man;
42 merge_provider(app_state & app,
43 manifest_map const & anc_man,
44 manifest_map const & left_man,
45 manifest_map const & right_man);
46
47 // merge3 on a file (line by line)
48 virtual bool try_to_merge_files(file_path const & anc_path,
49 file_path const & left_path,
50 file_path const & right_path,
51 file_path const & merged_path,
52 file_id const & ancestor_id,
53 file_id const & left_id,
54 file_id const & right,
55 file_id & merged_id);
56
57 // merge2 on a file (line by line)
58 virtual bool try_to_merge_files(file_path const & left_path,
59 file_path const & right_path,
60 file_path const & merged_path,
61 file_id const & left_id,
62 file_id const & right_id,
63 file_id & merged);
64
65 virtual void record_merge(file_id const & left_ident,
66 file_id const & right_ident,
67 file_id const & merged_ident,
68 file_data const & left_data,
69 file_data const & merged_data);
70
71 virtual void get_version(file_path const & path,
72 file_id const & ident,
73 file_data & dat);
74
75 virtual std::string get_file_encoding(file_path const & path,
76 manifest_map const & man);
77
78 virtual bool attribute_manual_merge(file_path const & path,
79 manifest_map const & man);
80
81 virtual ~merge_provider() {}
82};
83
84struct update_merge_provider : public merge_provider
85{
86 std::map<file_id, file_data> temporary_store;
87 update_merge_provider(app_state & app,
88 manifest_map const & anc_man,
89 manifest_map const & left_man,
90 manifest_map const & right_man);
91
92 virtual void record_merge(file_id const & left_ident,
93 file_id const & right_ident,
94 file_id const & merged_ident,
95 file_data const & left_data,
96 file_data const & merged_data);
97
98 virtual void get_version(file_path const & path,
99 file_id const & ident,
100 file_data & dat);
101
102 virtual std::string get_file_encoding(file_path const & path,
103 manifest_map const & man);
104
105 virtual bool attribute_manual_merge(file_path const & path,
106 manifest_map const & man);
107
108 virtual ~update_merge_provider() {}
109};
110
111
112#endif // __DIFF_PATCH_HH__

Archive Download this file

Branches

Tags

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