# # patch "ChangeLog" # from [dd11c7f42241940d81d3330645931eee218f44fc] # to [2ae73db315f0d53795fab150a0253f2f6ab6c054] # # patch "app_state.cc" # from [cec53af9cdeeda70983bbde55e06d62848d0d945] # to [df20ed8050fffe10bcc15ed02d546f32b6869271] # # patch "commands.cc" # from [69b54198950751b1b3ec29fb9baa1edb94a48b7c] # to [70217e8242dc974f52e6d61ccc120d588826b96c] # # patch "database.cc" # from [5d925a861c0fd595434f76a7d916e609fcfd4859] # to [14d91115f61f8eec147d98df9d5bcb29e028ccbd] # # patch "file_io.hh" # from [61cbc2dee27398f246537d87ad5ce97b42f9cbf0] # to [9bab162dd5812f8bcd47cb881e6337b06f8ba191] # # patch "lua.cc" # from [d8ba62363d2f7aa516ec894abeeb933715c58fb6] # to [674472a130344358fe313b2313834a58de0a048e] # # patch "lua.hh" # from [38e760eb2add9e8c846abc3f3ea77a0aa8378d66] # to [db3bb1c0a41f36d245e8f1cdbbada5b7a42f7dae] # # patch "manifest.cc" # from [80adc9e34ed90a739138fd61c977c77bd9a70fe3] # to [3b2650b112fe4a1689397e1dc504d0f4904c0e08] # # patch "paths.hh" # from [d2705a51fbd78c222472bccc514ff3d1f6832c55] # to [29324fe2472618856bb0cc378164619fa304f4a5] # # patch "rcs_import.cc" # from [bb9113bda3ccacea6236e9b9e5045ee2ff96756a] # to [d06a24693ec6589feae476c622b542bc212faffb] # # patch "sanity.cc" # from [ffb40b74ba38772ebf90bf7bc0f7ac710933a338] # to [25de789c94abcda2a2e65b3126a4b53757ee9a5f] # # patch "transforms.cc" # from [4c0c80f47a736a45e4825212305604ed1414bc69] # to [5f391379f3632cc61aa99aaf61a9721c0e0a34ed] # # patch "work.cc" # from [3c3b481a34f7a4a64a35e6777256afe79d8f3ec5] # to [b4a6a46a5a36850118372a5d1469c04a78d0f323] # # patch "xdelta.cc" # from [3e050716dffea184cd8145b71686a902cbfd461a] # to [36320f95cd772de1c5f9d81751c4679522596911] # ======================================================================== --- ChangeLog dd11c7f42241940d81d3330645931eee218f44fc +++ ChangeLog 2ae73db315f0d53795fab150a0253f2f6ab6c054 @@ -1,5 +1,9 @@ 2005-08-24 Nathaniel Smith + * Lots and lots more compile fixes. + +2005-08-24 Nathaniel Smith + * paths.hh, monotone.cc, app_state.hh, app_state.cc: * unix/inodeprint.cc: More compile fixes. ======================================================================== --- app_state.cc cec53af9cdeeda70983bbde55e06d62848d0d945 +++ app_state.cc df20ed8050fffe10bcc15ed02d546f32b6869271 @@ -64,7 +64,7 @@ read_options(); system_path dbname = system_path(options[database_option]); - if (dbname != "") db.set_filename(mkpath(dbname)); + if (!dbname.empty()) db.set_filename(mkpath(dbname)); if (branch_name().empty()) branch_name = options[branch_option]; L(F("branch name is '%s'\n") % branch_name()); @@ -72,7 +72,7 @@ if (!current.empty()) { - relative_directory = file_path(current.native_directory_string()); + relative_directory = file_path_internal(current.string()); L(F("relative directory is '%s'\n") % relative_directory); } @@ -276,12 +276,12 @@ void app_state::set_root(system_path const & path) { - N(path_state(root), - F("search root '%s' does not exist\n") % root); - N(is_directory(root), - F("search root '%s' is not a directory\n") % root); - root = path; - L(F("set search root to %s\n") % root); + N(path_state(path), + F("search root '%s' does not exist\n") % path); + N(is_directory(path), + F("search root '%s' is not a directory\n") % path); + search_root = path; + L(F("set search root to %s\n") % search_root); } void @@ -436,7 +436,7 @@ void app_state::write_options() { - local_path o_path; + bookkeeping_path o_path; get_options_path(o_path); try { ======================================================================== --- commands.cc 69b54198950751b1b3ec29fb9baa1edb94a48b7c +++ commands.cc 70217e8242dc974f52e6d61ccc120d588826b96c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -281,8 +282,8 @@ { if (path.empty()) return; - N(!path_exists(path), F("pid file '%s' already exists") % path); - file.open(path); + N(!path_state(path), F("pid file '%s' already exists") % path); + file.open(path.as_external()); file << get_process_id(); file.flush(); } @@ -292,7 +293,7 @@ if (path.empty()) return; pid_t pid; - fs::ifstream(path.as_external()) >> pid; + std::ifstream(path.as_external()) >> pid; if (pid == get_process_id()) { file.close(); delete_file(path); @@ -300,7 +301,7 @@ } private: - fs::ofstream file; + std::ofstream file; system_path path; }; @@ -717,8 +718,8 @@ for (change_set::delta_map::const_iterator i = cs.deltas.begin(); i != cs.deltas.end(); i++) { - if (pr.added_files.find(i->first()) == pr.added_files.end()) - modified_files.insert(i->first()); + if (pr.added_files.find(i->first) == pr.added_files.end()) + modified_files.insert(i->first); } } @@ -732,7 +733,7 @@ for (std::set::const_iterator i = s.begin(); i != s.end(); i++) { - const std::string str = (*i)(); + const std::string str = boost::lexical_cast(*i); if (cols > 8 && cols + str.size() + 1 >= max_cols) { cols = 8; @@ -2558,8 +2559,8 @@ { split_into_lines(data_old(), old_lines); split_into_lines(data_new(), new_lines); - make_diff(delta_entry_path(i)(), - delta_entry_path(i)(), + make_diff(delta_entry_path(i).as_internal(), + delta_entry_path(i).as_internal(), delta_entry_src(i), delta_entry_dst(i), old_lines, new_lines, @@ -3540,7 +3541,7 @@ file = i->first; rid = i->second; - bool print_this = file().empty(); + bool print_this = file.empty(); set< revision > parents; vector< revision > tmp; @@ -3567,7 +3568,7 @@ ancestors.insert(edge_old_revision(e)); change_set const & cs = edge_changes(e); - if (! file().empty()) + if (! file.empty()) { if (cs.rearrangement.has_deleted_file(file) || cs.rearrangement.has_renamed_file_src(file)) ======================================================================== --- database.cc 5d925a861c0fd595434f76a7d916e609fcfd4859 +++ database.cc 14d91115f61f8eec147d98df9d5bcb29e028ccbd @@ -133,12 +133,12 @@ { switch (path_state(filename)) { - path::nonexistent: + case path::nonexistent: return; - path::directory: + case path::directory: N(false, F("database %s is a directory") % filename); break; - path::file: + case path::file: // sqlite 3 files begin with this constant string // (version 2 files begin with a different one) std::string version_string("SQLite format 3"); @@ -666,7 +666,7 @@ { if (__sql) { - throw oops("cannot change filename to " + file + " while db is open"); + throw oops((F("cannot change filename to %s while db is open") % file).str()); } filename = file; } ======================================================================== --- file_io.hh 61cbc2dee27398f246537d87ad5ce97b42f9cbf0 +++ file_io.hh 9bab162dd5812f8bcd47cb881e6337b06f8ba191 @@ -7,6 +7,7 @@ // see the file COPYING for details #include "vocab.hh" +#include "paths.hh" // this layer deals with talking to the filesystem, loading and saving // files, walking trees, etc. @@ -65,8 +66,9 @@ // returns true if the string content is binary according to monotone euristic bool guess_binary(std::string const & s); -void mkdir_p(file_path const & path); +void mkdir_p(any_path const & path); void make_dir_for(file_path const & p); +void make_dir_for(bookkeeping_path const & p); void delete_file(any_path const & path); void delete_dir_recursive(any_path const & path); ======================================================================== --- lua.cc d8ba62363d2f7aa516ec894abeeb933715c58fb6 +++ lua.cc 674472a130344358fe313b2313834a58de0a048e @@ -653,7 +653,7 @@ void lua_hooks::default_rcfilename(system_path & file) { - file = get_homedir() / ".monotone/monotonerc"); + file = get_homedir() / ".monotone/monotonerc"; } void @@ -685,7 +685,7 @@ std::sort(arr.begin(), arr.end()); for (std::vector::iterator i= arr.begin(); i != arr.end(); ++i) { - load_rcfile(system_path(*i.native_directory_string()), true); + load_rcfile(system_path(i->native_directory_string()), true); } return; // directory read, skip the rest ... } @@ -834,7 +834,7 @@ bool ignore_it = false; bool exec_ok = Lua(st) .func("ignore_file") - .push_str(p()) + .push_str(p.as_external()) .call(1,1) .extract_bool(ignore_it) .ok(); @@ -968,9 +968,9 @@ string res; bool ok = Lua(st) .func("merge2") - .push_str(left_path()) - .push_str(right_path()) - .push_str(merged_path()) + .push_str(left_path.as_external()) + .push_str(right_path.as_external()) + .push_str(merged_path.as_external()) .push_str(left()) .push_str(right()) .call(5,1) @@ -993,10 +993,10 @@ string res; bool ok = Lua(st) .func("merge3") - .push_str(anc_path()) - .push_str(left_path()) - .push_str(right_path()) - .push_str(merged_path()) + .push_str(anc_path.as_external()) + .push_str(left_path.as_external()) + .push_str(right_path.as_external()) + .push_str(merged_path.as_external()) .push_str(ancestor()) .push_str(left()) .push_str(right()) @@ -1016,13 +1016,13 @@ string tmp; bool ok = Lua(st) .func("resolve_file_conflict") - .push_str(anc()) - .push_str(a()) - .push_str(b()) + .push_str(anc.as_external()) + .push_str(a.as_external()) + .push_str(b.as_external()) .call(3,1) .extract_str(tmp) .ok(); - res = tmp; + res = file_path_internal(tmp); return ok; } @@ -1035,13 +1035,13 @@ string tmp; bool ok = Lua(st) .func("resolve_dir_conflict") - .push_str(anc()) - .push_str(a()) - .push_str(b()) + .push_str(anc.as_external()) + .push_str(a.as_external()) + .push_str(b.as_external()) .call(3,1) .extract_str(tmp) .ok(); - res = tmp; + res = file_path_internal(tmp); return ok; } @@ -1059,7 +1059,7 @@ ll .func("external_diff") - .push_str(path()); + .push_str(path.as_external()); if (oldrev.length() != 0) ll.push_str(data_old()); @@ -1158,7 +1158,7 @@ while (ll.next()) { L(F(" calling an attr_init_function for %s") % filename); - ll.push_str(filename()); + ll.push_str(filename.as_external()); ll.call(1, 1); if (lua_isstring(st, -1)) @@ -1192,7 +1192,7 @@ .get_tab() .push_str(attr) .get_fn(-2) - .push_str(filename()) + .push_str(filename.as_external()) .push_str(value) .call(2,0) .ok(); @@ -1217,7 +1217,7 @@ Lua ll(st); ll .func("get_charset_conv") - .push_str(p()) + .push_str(p.as_external()) .call(1,1) .begin(); @@ -1237,7 +1237,7 @@ Lua ll(st); ll .func("get_linesep_conv") - .push_str(p()) + .push_str(p.as_external()) .call(1,1) .begin(); ======================================================================== --- lua.hh 38e760eb2add9e8c846abc3f3ea77a0aa8378d66 +++ lua.hh db3bb1c0a41f36d245e8f1cdbbada5b7a42f7dae @@ -14,6 +14,7 @@ #include #include "file_io.hh" #include "vocab.hh" +#include "paths.hh" struct patch_set; ======================================================================== --- manifest.cc 80adc9e34ed90a739138fd61c977c77bd9a70fe3 +++ manifest.cc 3b2650b112fe4a1689397e1dc504d0f4904c0e08 @@ -185,7 +185,7 @@ } else { - W(F("missing %s") % (*i)()); + W(F("missing %s") % (*i)); missing_files++; } } ======================================================================== --- paths.hh d2705a51fbd78c222472bccc514ff3d1f6832c55 +++ paths.hh 29324fe2472618856bb0cc378164619fa304f4a5 @@ -54,7 +54,7 @@ // join a file_path out of pieces file_path(std::vector const & pieces); - file_path operator /(std::string const & to_append); + file_path operator /(std::string const & to_append) const; void split(std::vector & pieces) const; @@ -102,7 +102,7 @@ bookkeeping_path(std::string const & path); bookkeeping_path(utf8 const & path); std::string as_external() const; - bookkeeping_path operator /(std::string const & to_append); + bookkeeping_path operator /(std::string const & to_append) const; }; extern bookkeeping_path const bookkeeping_root; @@ -117,7 +117,7 @@ // monotone started in. it should be in utf8. system_path(std::string const & path); system_path(utf8 const & path); - system_path operator /(std::string const & to_append); + system_path operator /(std::string const & to_append) const; }; ======================================================================== --- rcs_import.cc bb9113bda3ccacea6236e9b9e5045ee2ff96756a +++ rcs_import.cc d06a24693ec6589feae476c622b542bc212faffb @@ -910,7 +910,7 @@ } virtual void visit_file(file_path const & path) { - string file = path(); + string file = path.as_external(); if (file.substr(file.size() - 2) == string(",v")) { try ======================================================================== --- sanity.cc ffb40b74ba38772ebf90bf7bc0f7ac710933a338 +++ sanity.cc 25de789c94abcda2a2e65b3126a4b53757ee9a5f @@ -43,20 +43,20 @@ void sanity::dump_buffer() { - if (filename != "") + if (!filename.empty()) { - ofstream out(filename.c_str()); + ofstream out(filename.as_external()); if (out) { copy(logbuf.begin(), logbuf.end(), ostream_iterator(out)); copy(gasp_dump.begin(), gasp_dump.end(), ostream_iterator(out)); - ui.inform(string("wrote debugging log to ") + filename + "\n"); + ui.inform((F("wrote debugging log to %s") % filename).str()); } else - ui.inform("failed to write debugging log to " + filename + "\n"); + ui.inform((F("failed to write debugging log to %s") % filename).str()); } else - ui.inform(string("discarding debug log (maybe you want --debug or --dump?)\n")); + ui.inform(_("discarding debug log (maybe you want --debug or --dump?)")); } void ======================================================================== --- transforms.cc 4c0c80f47a736a45e4825212305604ed1414bc69 +++ transforms.cc 5f391379f3632cc61aa99aaf61a9721c0e0a34ed @@ -260,7 +260,7 @@ i != m.end(); ++i) { sz += i->second.inner()().size(); - sz += i->first().size(); + sz += i->first.as_internal().size(); sz += 3; } @@ -280,8 +280,8 @@ c += i->second.inner()().size(); *c++ = ' '; *c++ = ' '; - memcpy(c, i->first().data(), i->first().size()); - c += i->first().size(); + memcpy(c, i->first.as_internal()().data(), i->first.as_internal()().size()); + c += i->first.as_internal()().size(); *c++ = '\n'; } @@ -554,7 +554,7 @@ static inline bool system_charset_is_utf8() { - static bool it_is = filesystem_is_utf8_impl(); + static bool it_is = system_charset_is_utf8_impl(); return it_is; } @@ -601,7 +601,7 @@ if (system_charset_is_utf8()) ext = utf(); else if (system_charset_is_ascii_extension() - && is_all_ascii(utf)) + && is_all_ascii(utf())) ext = utf(); else charset_convert("UTF-8", system_charset(), utf(), ext); ======================================================================== --- work.cc 3c3b481a34f7a4a64a35e6777256afe79d8f3ec5 +++ work.cc b4a6a46a5a36850118372a5d1469c04a78d0f323 @@ -95,7 +95,7 @@ for (vector::const_iterator i = paths.begin(); i != paths.end(); ++i) { - N((*i)() != "", F("invalid path ''")); + N(!i->empty(), F("invalid path ''")); N(directory_exists(*i) || file_exists(*i), F("path %s does not exist\n") % *i); @@ -154,7 +154,7 @@ path_set const & ps, bool & path_is_directory) { - std::string path_as_dir = p() + "/"; + std::string path_as_dir = p.as_internal()() + "/"; for (path_set::const_iterator i = ps.begin(); i != ps.end(); ++i) { if (*i == p) @@ -162,7 +162,7 @@ path_is_directory = false; return true; } - else if ((*i)().find(path_as_dir) == 0) + else if (i->as_internal()().find(path_as_dir) == 0) { path_is_directory = true; return true; @@ -201,7 +201,7 @@ { bool dir_p = false; - N((*i)() != "", F("invalid path ''")); + N(!i->empty(), F("invalid path ''")); if (! known_path(*i, ps, dir_p)) { @@ -248,8 +248,8 @@ manifest_map const & man, change_set::path_rearrangement & pr) { - N(src() != "", F("invalid source path ''")); - N(dst() != "", F("invalid destination path ''")); + N(!src.empty(), F("invalid source path ''")); + N(!dst.empty(), F("invalid destination path ''")); change_set::path_rearrangement pr_new, pr_concatenated; path_set ps; @@ -644,7 +644,7 @@ i != attr.end(); ++i) { basic_io::stanza st; - st.push_str_pair(syms::file, i->first()); + st.push_str_pair(syms::file, i->first.as_internal()()); for (std::map::const_iterator j = i->second.begin(); j != i->second.end(); ++j) ======================================================================== --- xdelta.cc 3e050716dffea184cd8145b71686a902cbfd461a +++ xdelta.cc 36320f95cd772de1c5f9d81751c4679522596911 @@ -263,7 +263,7 @@ size_t isz = 0; if (i != a.end()) - isz = i->first().size() + 2 + i->second.inner()().size() + 1; + isz = i->first.as_internal()().size() + 2 + i->second.inner()().size() + 1; if (i != a.end() && i->first == j->first) {