1 // Copyright (C) 2009 Derek Scherger <derek@echologic.com>
2 //
3 // This program is made available under the GNU GPL version 2.0 or
4 // greater. See the accompanying file COPYING for details.
5 //
6 // This program is distributed WITHOUT ANY WARRANTY; without even the
7 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE.
9 
10 #ifndef __GIT_CHANGE_HH__
11 #define __GIT_CHANGE_HH__
12 
13 #include "paths.hh"
14 #include "vocab.hh"
15 
16 #include <vector>
17 
18 typedef file_path git_delete;
19 typedef std::pair<file_path, file_path> git_rename;
20 
21 struct git_add
22 {
23     file_path path;
24     file_id content;
25     std::string mode;
git_addgit_add26     git_add(file_path path, file_id content, std::string mode) :
27         path(path), content(content), mode(mode) {}
28 };
29 
30 typedef std::vector<git_delete>::const_iterator delete_iterator;
31 typedef std::vector<git_rename>::const_iterator rename_iterator;
32 typedef std::vector<git_add>::const_iterator add_iterator;
33 
34 struct git_change
35 {
36     std::vector<git_delete> deletions;
37     std::vector<git_rename> renames;
38     std::vector<git_add> additions;
39 };
40 
41 void get_change(roster_t const & left, roster_t const & right,
42                 git_change & change);
43 
44 void reorder_renames(std::vector<git_rename> const & renames,
45                      std::vector<git_rename> & reordered_renames);
46 
47 #endif // __GIT_CHANGE_HH__
48 
49 // Local Variables:
50 // mode: C++
51 // fill-column: 76
52 // c-file-style: "gnu"
53 // indent-tabs-mode: nil
54 // End:
55 // vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
56