# # # patch "ChangeLog" # from [3ab622226230e2cc66545b556e616531f8c12083] # to [24f6ad72f00c6e2f667564f150bb36b2870a43e4] # # patch "cert.cc" # from [3156dccd1b8da541c7d6a396b371fb72eace247d] # to [49898212ea84352348d3de005ec0f64aedacec6d] # # patch "database.cc" # from [f8ef09fad03f4bd76708b9d42e05ad5a34320003] # to [52ec48ff3274d5088e47b4a9ad74d846156cb678] # # patch "diff_patch.cc" # from [19ff8e2684824322dd72775736cb3b1accae4566] # to [aceefb1c730992f12e974031d387220e3231534e] # # patch "file_io.cc" # from [df2709c7a36633e5266ced0a9b7b7d6ee3f41903] # to [c697f41e7ea39c7ba830a3662f9750449402f5fd] # # patch "file_io.hh" # from [0757908d747cc57398930b69141588544a5af775] # to [5a36a8b92ea826d425d361ffa0b34cfc65ca01ae] # # patch "inodeprint.hh" # from [56326dab006b882f5e2593740da4742bd28bbc35] # to [3db3005b0230aa489265417b80cba28a74dc406e] # # patch "netsync.cc" # from [827ac0ee8dd6281d529d8172a4a6f99d1be636b0] # to [e56f12d1ea09ad60c675560199cb7819d258c025] # # patch "paths.cc" # from [b77cfcbc73e191883145492b2c7517f09365ce7f] # to [375da7ea4ea6a8a047824de80c1c5a5f3daef181] # # patch "rcs_import.cc" # from [38060f4ed9c1b336fb1467be0f2006e3d4aac487] # to [36d442b3ce162881956dffeb17d9ff88d70ea794] # # patch "revision.cc" # from [72be674a14785710e0607feff826ac17ba708391] # to [30726868211c9c820002c3e281a5728c4a640ac6] # # patch "revision.hh" # from [9d2e4109bc0cff4ca33011f2e75b6af5e3db1fd5] # to [f31cef31d418dc6585a24fc61267b9ff47b0cdf5] # # patch "roster.cc" # from [61e2bb7bd0c0616543f6973abc2be585a5872860] # to [a57e3ffdc43ec0089cbcf72ad5d8165945cbcdad] # # patch "roster.hh" # from [4d4f0472b25d2cdfef7db1c91b619ff2dd8c275d] # to [48f810e272158afce673d31d45766bfaf42bea6e] # # patch "transforms.cc" # from [218cca6b6c5945f169c9c1c3da526bbee4c58a81] # to [c3eece9fa6a21c7d68250de2c19325ce168b240a] # # patch "transforms.hh" # from [8dabc3f8fe642f4c1d3dddab53fae3a4628617a1] # to [0ab0d07b7a5b8d05c7c64a9770429435d667475e] # # patch "update.cc" # from [bc5d41f3a5879e36ee2fe60f98d59ba4e181ba24] # to [72640e049731be496bd0791f60eb04e3dd220fc2] # # patch "work.cc" # from [2c981ac1c673016518f143290d22cdeb533461d9] # to [cd195915a577697bc2e668aacdc760e581379f83] # # patch "work.hh" # from [bda3ab59f09f20572d550a872a9208e3434206c5] # to [d3bc9eb3b43407324be2b399457f841d7e20837b] # ============================================================ --- ChangeLog 3ab622226230e2cc66545b556e616531f8c12083 +++ ChangeLog 24f6ad72f00c6e2f667564f150bb36b2870a43e4 @@ -1,5 +1,12 @@ 2006-05-22 Timothy Brownawell + * transforms.{cc,hh} revision.{cc,hh} roster.{cc,hh} file_io.{cc,hh}: + Move calculate_ident for revision_set and roster to those files. Move + calulate_ident for files to file_io. + * 10 others: Fix includes. + +2006-05-22 Timothy Brownawell + Do not include cert.hh from vocab.hh . * vocab_macros.hh vocab.{cc,hh} cert.{cc,hh}: Move the type definition macros to vocab_macros.hh, and move revision and manifest ============================================================ --- cert.cc 3156dccd1b8da541c7d6a396b371fb72eace247d +++ cert.cc 49898212ea84352348d3de005ec0f64aedacec6d @@ -15,6 +15,7 @@ #include "transforms.hh" #include "ui.hh" #include "options.hh" +#include "revision.hh" #include #include ============================================================ --- database.cc f8ef09fad03f4bd76708b9d42e05ad5a34320003 +++ database.cc 52ec48ff3274d5088e47b4a9ad74d846156cb678 @@ -30,6 +30,7 @@ #include "database.hh" #include "hash_map.hh" #include "keys.hh" +#include "revision.hh" #include "safe_map.hh" #include "sanity.hh" #include "schema_migration.hh" ============================================================ --- diff_patch.cc 19ff8e2684824322dd72775736cb3b1accae4566 +++ diff_patch.cc aceefb1c730992f12e974031d387220e3231534e @@ -24,6 +24,7 @@ #include "sanity.hh" #include "transforms.hh" #include "vocab.hh" +#include "revision.hh" using namespace std; using boost::shared_ptr; ============================================================ --- file_io.cc df2709c7a36633e5266ced0a9b7b7d6ee3f41903 +++ file_io.cc c697f41e7ea39c7ba830a3662f9750449402f5fd @@ -488,6 +488,39 @@ get_process_id()).str()); } +void +calculate_ident(file_path const & file, + hexenc & ident, + lua_hooks & lua) +{ + string db_linesep, ext_linesep; + string db_charset, ext_charset; + + bool do_lineconv = (lua.hook_get_linesep_conv(file, db_linesep, ext_linesep) + && db_linesep != ext_linesep); + + bool do_charconv = (lua.hook_get_charset_conv(file, db_charset, ext_charset) + && db_charset != ext_charset); + + if (do_charconv || do_lineconv) + { + data dat; + read_localized_data(file, dat, lua); + calculate_ident(dat, ident); + } + else + { + // no conversions necessary, use streaming form + // Best to be safe and check it isn't a dir. + assert_path_is_file(file); + Botan::Pipe p(new Botan::Hash_Filter("SHA-160"), new Botan::Hex_Encoder()); + Botan::DataSource_Stream infile(file.as_external(), true); + p.process_msg(infile); + + ident = lowercase(p.read_all_as_string()); + } +} + tree_walker::~tree_walker() {} static void ============================================================ --- file_io.hh 0757908d747cc57398930b69141588544a5af775 +++ file_io.hh 5a36a8b92ea826d425d361ffa0b34cfc65ca01ae @@ -79,6 +79,10 @@ // This function knows that "-" means "stdin". void read_data_for_command_line(utf8 const & path, data & dat); +void calculate_ident(file_path const & file, + hexenc & ident, + lua_hooks & lua); + // These are not any_path's because we make our write somewhat atomic -- we // first write to a temp file in _MTN/ (and it must be in _MTN/, not like /tmp // or something, because we can't necessarily atomic rename from /tmp to the ============================================================ --- inodeprint.hh 56326dab006b882f5e2593740da4742bd28bbc35 +++ inodeprint.hh 3db3005b0230aa489265417b80cba28a74dc406e @@ -8,6 +8,7 @@ #include "vocab.hh" #include "quick_alloc.hh" +#include "paths.hh" typedef std::pair > inodeprint_entry; ============================================================ --- netsync.cc 827ac0ee8dd6281d529d8172a4a6f99d1be636b0 +++ netsync.cc e56f12d1ea09ad60c675560199cb7819d258c025 @@ -31,6 +31,7 @@ #include "numeric_vocab.hh" #include "packet.hh" #include "refiner.hh" +#include "revision.hh" #include "sanity.hh" #include "transforms.hh" #include "ui.hh" ============================================================ --- paths.cc b77cfcbc73e191883145492b2c7517f09365ce7f +++ paths.cc 375da7ea4ea6a8a047824de80c1c5a5f3daef181 @@ -5,6 +5,7 @@ #include #include +#include #include #include ============================================================ --- rcs_import.cc 38060f4ed9c1b336fb1467be0f2006e3d4aac487 +++ rcs_import.cc 36d442b3ce162881956dffeb17d9ff88d70ea794 @@ -36,6 +36,7 @@ #include "paths.hh" #include "platform.hh" #include "rcs_file.hh" +#include "revision.hh" #include "safe_map.hh" #include "sanity.hh" #include "transforms.hh" ============================================================ --- revision.cc 72be674a14785710e0607feff826ac17ba708391 +++ revision.cc 30726868211c9c820002c3e281a5728c4a640ac6 @@ -1625,6 +1625,16 @@ dat = revision_data(d); } +void calculate_ident(revision_set const & cs, + revision_id & ident) +{ + data tmp; + hexenc tid; + write_revision_set(cs, tmp); + calculate_ident(tmp, tid); + ident = tid; +} + #ifdef BUILD_UNIT_TESTS #include "unit_tests.hh" #include "sanity.hh" ============================================================ --- revision.hh 9d2e4109bc0cff4ca33011f2e75b6af5e3db1fd5 +++ revision.hh f31cef31d418dc6585a24fc61267b9ff47b0cdf5 @@ -105,6 +105,9 @@ write_revision_set(revision_set const & rev, revision_data & dat); +void calculate_ident(revision_set const & cs, + revision_id & ident); + // sanity checking void ============================================================ --- roster.cc 61e2bb7bd0c0616543f6973abc2be585a5872860 +++ roster.cc a57e3ffdc43ec0089cbcf72ad5d8165945cbcdad @@ -2597,7 +2597,20 @@ write_roster_and_marking(ros, mm, dat, false); } +void calculate_ident(roster_t const & ros, + manifest_id & ident) +{ + data tmp; + hexenc tid; + if (!ros.all_nodes().empty()) + { + write_manifest_of_roster(ros, tmp); + calculate_ident(tmp, tid); + } + ident = tid; +} + //////////////////////////////////////////////////////////////////// // testing //////////////////////////////////////////////////////////////////// ============================================================ --- roster.hh 4d4f0472b25d2cdfef7db1c91b619ff2dd8c275d +++ roster.hh 48f810e272158afce673d31d45766bfaf42bea6e @@ -400,6 +400,9 @@ write_manifest_of_roster(roster_t const & ros, data & dat); +void calculate_ident(roster_t const & ros, + manifest_id & ident); + #ifdef BUILD_UNIT_TESTS struct testing_node_id_source ============================================================ --- transforms.cc 218cca6b6c5945f169c9c1c3da526bbee4c58a81 +++ transforms.cc c3eece9fa6a21c7d68250de2c19325ce168b240a @@ -280,66 +280,6 @@ ident = tmp; } -void calculate_ident(revision_set const & cs, - revision_id & ident) -{ - data tmp; - hexenc tid; - write_revision_set(cs, tmp); - calculate_ident(tmp, tid); - ident = tid; -} - -// Variant which calculates the "manifest part" of a roster; this does -// not include the local sequence numbers or markings, but produces -// the manifest_id which is stored in the public revision_set object. -void calculate_ident(roster_t const & ros, - manifest_id & ident) -{ - data tmp; - hexenc tid; - if (!ros.all_nodes().empty()) - { - write_manifest_of_roster(ros, tmp); - calculate_ident(tmp, tid); - } - ident = tid; -} - -// this might reasonably go in file_io.cc too... -void -calculate_ident(file_path const & file, - hexenc & ident, - lua_hooks & lua) -{ - string db_linesep, ext_linesep; - string db_charset, ext_charset; - - bool do_lineconv = (lua.hook_get_linesep_conv(file, db_linesep, ext_linesep) - && db_linesep != ext_linesep); - - bool do_charconv = (lua.hook_get_charset_conv(file, db_charset, ext_charset) - && db_charset != ext_charset); - - if (do_charconv || do_lineconv) - { - data dat; - read_localized_data(file, dat, lua); - calculate_ident(dat, ident); - } - else - { - // no conversions necessary, use streaming form - // Best to be safe and check it isn't a dir. - assert_path_is_file(file); - Botan::Pipe p(new Botan::Hash_Filter("SHA-160"), new Botan::Hex_Encoder()); - Botan::DataSource_Stream infile(file.as_external(), true); - p.process_msg(infile); - - ident = lowercase(p.read_all_as_string()); - } -} - void split_into_lines(std::string const & in, std::string const & encoding, std::vector & out) ============================================================ --- transforms.hh 8dabc3f8fe642f4c1d3dddab53fae3a4628617a1 +++ transforms.hh 0ab0d07b7a5b8d05c7c64a9770429435d667475e @@ -6,10 +6,7 @@ // licensed to the public under the terms of the GNU GPL (>= 2) // see the file COPYING for details -#include "revision.hh" -#include "lua_hooks.hh" #include "vocab.hh" -#include "roster.hh" #include @@ -125,22 +122,8 @@ void calculate_ident(revision_data const & dat, revision_id & ident); -void calculate_ident(revision_set const & cs, - revision_id & ident); -// Variant which calculates the "manifest part" of a roster; this does -// not include the local sequence numbers or markings, but produces -// the manifest_id which is stored in the public revision_set object. -void calculate_ident(roster_t const & ros, - manifest_id & ident); - -// quick streamy variant which doesn't necessarily load the whole file - -void calculate_ident(file_path const & file, - hexenc & ident, - lua_hooks & lua); - void split_into_lines(std::string const & in, std::vector & out); ============================================================ --- update.cc bc5d41f3a5879e36ee2fe60f98d59ba4e181ba24 +++ update.cc 72640e049731be496bd0791f60eb04e3dd220fc2 @@ -17,6 +17,7 @@ #include "ui.hh" #include "update.hh" #include "vocab.hh" +#include "revision.hh" // these functions just encapsulate the (somewhat complex) logic behind // picking an update target. the actual updating takes place in ============================================================ --- work.cc 2c981ac1c673016518f143290d22cdeb533461d9 +++ work.cc cd195915a577697bc2e668aacdc760e581379f83 @@ -21,6 +21,7 @@ #include "transforms.hh" #include "vocab.hh" #include "work.hh" +#include "revision.hh" // workspace / book-keeping file code ============================================================ --- work.hh bda3ab59f09f20572d550a872a9208e3434206c5 +++ work.hh d3bc9eb3b43407324be2b399457f841d7e20837b @@ -15,6 +15,7 @@ #include "paths.hh" #include "roster.hh" #include "vocab.hh" +#include "file_io.hh" // // this file defines structures to deal with the "workspace" of a tree