# # # patch "ChangeLog" # from [24f6ad72f00c6e2f667564f150bb36b2870a43e4] # to [b7eab83ddef0e1e1aa9ce27433aefe5ef7c1767a] # # patch "annotate.cc" # from [70b0c534d5e0e001530c307130255af3f2aff402] # to [714dd862061320e7a6b98231a9fece85fb777f6d] # # patch "constants.cc" # from [f2baab50e8fa565411d429fe4a5099f0266c3384] # to [45406dd40ffed1993ee987120843b62ef9d3b8ec] # # patch "constants.hh" # from [b8396f4cd024f5c1fd0d1cbd1975d2359e3b7771] # to [9a6787150707c089561264e19cc93673860c6999] # # patch "crypto_tests.cc" # from [fe11fba313681ddc34596fdf66e61dadba5b541b] # to [6e7f56e97edd513e405a24beb2df684d0bfab1b4] # # patch "diff_patch.cc" # from [aceefb1c730992f12e974031d387220e3231534e] # to [d33f922b61cd32299ba5adad92c746680b392cc8] # # patch "transforms.cc" # from [c3eece9fa6a21c7d68250de2c19325ce168b240a] # to [d3970881bad05091164e06c3186db95beebf6533] # # patch "work.cc" # from [cd195915a577697bc2e668aacdc760e581379f83] # to [7968939058440542a070522a04e9f36e6711f318] # # patch "work.hh" # from [d3bc9eb3b43407324be2b399457f841d7e20837b] # to [021506c51a9be289cdffa8872a694b0e9b266c74] # ============================================================ --- ChangeLog 24f6ad72f00c6e2f667564f150bb36b2870a43e4 +++ ChangeLog b7eab83ddef0e1e1aa9ce27433aefe5ef7c1767a @@ -1,5 +1,11 @@ 2006-05-22 Timothy Brownawell + * work.{cc,hh} constants.{cc,hh}: Move attribute strings to constants. + * transforms.cc: Include constants.hh instead of work.hh . + * annotate.cc diff_patch.cc crypto_tests.cc: Fix includes. + +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. ============================================================ --- annotate.cc 70b0c534d5e0e001530c307130255af3f2aff402 +++ annotate.cc 714dd862061320e7a6b98231a9fece85fb777f6d @@ -13,6 +13,7 @@ #include "annotate.hh" #include "app_state.hh" +#include "constants.hh" #include "cset.hh" #include "interner.hh" #include "lcs.hh" @@ -180,7 +181,7 @@ // initialize file_lines file_data fpacked; app.db.get_file_version(fid, fpacked); - std::string encoding = default_encoding; // FIXME + std::string encoding = constants::default_encoding; // FIXME split_into_lines(fpacked.inner()(), encoding, file_lines); L(FL("annotate_context::annotate_context initialized with %d file lines\n") % file_lines.size()); @@ -406,7 +407,7 @@ { // split into lines std::vector lines; - std::string encoding = default_encoding; // FIXME + std::string encoding = constants::default_encoding; // FIXME split_into_lines (data.inner()().data(), encoding, lines); init_with_lines(lines); ============================================================ --- constants.cc f2baab50e8fa565411d429fe4a5099f0266c3384 +++ constants.cc 45406dd40ffed1993ee987120843b62ef9d3b8ec @@ -152,4 +152,9 @@ std::string const & netsync_key_initializer = std::string(netsync_session_key_length_in_bytes, 0); + // attributes + std::string const encoding_attribute("mtn:encoding"); + std::string const manual_merge_attribute("mtn:manual_merge"); + std::string const binary_encoding("binary"); + std::string const default_encoding("default"); } ============================================================ --- constants.hh b8396f4cd024f5c1fd0d1cbd1975d2359e3b7771 +++ constants.hh 9a6787150707c089561264e19cc93673860c6999 @@ -151,6 +151,12 @@ // netsync session key default initializer extern std::string const & netsync_key_initializer; + + // attributes + extern std::string const encoding_attribute; + extern std::string const binary_encoding; + extern std::string const default_encoding; + extern std::string const manual_merge_attribute; } #endif // __CONSTANTS_HH__ ============================================================ --- crypto_tests.cc fe11fba313681ddc34596fdf66e61dadba5b541b +++ crypto_tests.cc 6e7f56e97edd513e405a24beb2df684d0bfab1b4 @@ -9,6 +9,7 @@ #include #include "transforms.hh" +#include "sanity.hh" static std::string expected_SHA_MCT[] = { "e216836819477c7f78e0d843fe4ff1b6d6c14cd4", ============================================================ --- diff_patch.cc aceefb1c730992f12e974031d387220e3231534e +++ diff_patch.cc d33f922b61cd32299ba5adad92c746680b392cc8 @@ -25,6 +25,7 @@ #include "transforms.hh" #include "vocab.hh" #include "revision.hh" +#include "constants.hh" using namespace std; using boost::shared_ptr; @@ -621,9 +622,9 @@ roster_t const & ros) { attr_value v; - if (get_attribute_from_roster(ros, path, encoding_attribute, v)) + if (get_attribute_from_roster(ros, path, constants::encoding_attribute, v)) return v(); - return default_encoding; + return constants::default_encoding; } bool @@ -631,7 +632,7 @@ roster_t const & ros) { attr_value v; - if (get_attribute_from_roster(ros, path, manual_merge_attribute, v) + if (get_attribute_from_roster(ros, path, constants::manual_merge_attribute, v) && v() == "true") return true; return false; // default: enable auto merge ============================================================ --- transforms.cc c3eece9fa6a21c7d68250de2c19325ce168b240a +++ transforms.cc d3970881bad05091164e06c3186db95beebf6533 @@ -28,7 +28,6 @@ #include "sanity.hh" #include "transforms.hh" #include "vocab.hh" -#include "work.hh" #include "xdelta.hh" using namespace std; @@ -297,7 +296,7 @@ // as far as I know, this covers the EUC, ISO-8859-X, GB, Big5, KOI, // ASCII, and UTF-8 families of encodings. - if (lc_encoding == default_encoding + if (lc_encoding == constants::default_encoding || lc_encoding.find("ascii") != std::string::npos || lc_encoding.find("8859") != std::string::npos || lc_encoding.find("euc") != std::string::npos @@ -337,7 +336,7 @@ split_into_lines(string const & in, vector & out) { - split_into_lines(in, default_encoding, out); + split_into_lines(in, constants::default_encoding, out); } void ============================================================ --- work.cc cd195915a577697bc2e668aacdc760e581379f83 +++ work.cc 7968939058440542a070522a04e9f36e6711f318 @@ -27,10 +27,16 @@ using namespace std; -// attribute map file +static string const attr_file_name(".mt-attrs"); +static string const inodeprints_file_name("inodeprints"); +static string const local_dump_file_name("debug"); +static string const options_file_name("options"); +static string const work_file_name("work"); +static string const user_log_file_name("log"); -string const attr_file_name(".mt-attrs"); +// attribute map file + void file_itemizer::visit_dir(file_path const & path) { @@ -498,8 +504,6 @@ // work file containing rearrangement from uncommitted adds/drops/renames -std::string const work_file_name("work"); - static void get_work_path(bookkeeping_path & w_path) { w_path = bookkeeping_root / work_file_name; @@ -656,8 +660,6 @@ // user log file -string const user_log_file_name("log"); - void get_user_log_path(bookkeeping_path & ul_path) { @@ -705,8 +707,6 @@ // options map file -string const options_file_name("options"); - void get_options_path(bookkeeping_path & o_path) { @@ -751,8 +751,6 @@ // local dump file -static string const local_dump_file_name("debug"); - void get_local_dump_path(bookkeeping_path & d_path) { d_path = bookkeeping_root / local_dump_file_name; @@ -761,8 +759,6 @@ // inodeprint file -static string const inodeprints_file_name("inodeprints"); - void get_inodeprints_path(bookkeeping_path & ip_path) { @@ -804,12 +800,7 @@ write_data(ip_path, dat); } -string const encoding_attribute("mtn:encoding"); -string const binary_encoding("binary"); -string const default_encoding("default"); -string const manual_merge_attribute("mtn:manual_merge"); - bool get_attribute_from_roster(roster_t const & ros, file_path const & path, ============================================================ --- work.hh d3bc9eb3b43407324be2b399457f841d7e20837b +++ work.hh 021506c51a9be289cdffa8872a694b0e9b266c74 @@ -165,9 +165,6 @@ void enable_inodeprints(); -extern std::string const encoding_attribute; -extern std::string const manual_merge_attribute; - bool get_attribute_from_roster(roster_t const & ros, file_path const & path, attr_key const & key, @@ -175,9 +172,6 @@ void update_any_attrs(app_state & app); -extern std::string const binary_encoding; -extern std::string const default_encoding; - struct file_content_source { virtual void get_file_content(file_id const & fid,