# # patch "commands.cc" # from [816e71e2f403fa13b05ce176b8a8bc0be6698fef] # to [fc1efe3705f41c992c3780d1f900fd12704fdb8e] # # patch "cset.cc" # from [453471e703f38c5bd93d72964f4023fe70d57204] # to [05e68cc244242504bf2e1784588735386fcd8bcd] # # patch "cset.hh" # from [1d39340bb52aef571e199835e698586da071aa66] # to [077036ac38849e3b74dcdce595fdb5ee2762f282] # # patch "manifest.cc" # from [4d4377fee50757ad0fd303a65b31699a803c4a94] # to [b2c010b21a0955a47ffd79620f12f508d5d2e6a0] # # patch "manifest.hh" # from [7256376905b4161910893bbbdc9e83bd6ab3f9d8] # to [4104c7fda6af925c943515a923cf487f2af2dd24] # # patch "paths.cc" # from [79515041f699f1cb000e3561fda2fcc32b25e4d3] # to [56f151f81c54bb76ebff08df73b4fc9fa70221e7] # # patch "restrictions.cc" # from [751a27b384929942a3bfc5286228c48788471bc0] # to [7143bb2882a478cf0c6be8075532bf0733f98f2c] # # patch "roster.cc" # from [60a83365b8f023a351a1dea19a94e9c8ae5cb411] # to [72c64e3a7e3dba902d675a14d9ce425b93397614] # ======================================================================== --- commands.cc 816e71e2f403fa13b05ce176b8a8bc0be6698fef +++ commands.cc fc1efe3705f41c992c3780d1f900fd12704fdb8e @@ -798,12 +798,12 @@ static void print_indented_set(std::ostream & os, - set const & s, + path_set const & s, size_t max_cols) { size_t cols = 8; os << " "; - for (std::set::const_iterator i = s.begin(); + for (path_set::const_iterator i = s.begin(); i != s.end(); i++) { const std::string str = boost::lexical_cast(file_path(*i)); @@ -839,7 +839,7 @@ if (! cs.files_added.empty()) { - std::set tmp; + path_set tmp; for (std::map::const_iterator i = cs.files_added.begin(); i != cs.files_added.end(); ++i) tmp.insert(i->first); @@ -855,7 +855,7 @@ if (! cs.deltas_applied.empty()) { - std::set tmp; + path_set tmp; for (std::map >::const_iterator i = cs.deltas_applied.begin(); i != cs.deltas_applied.end(); ++i) tmp.insert(i->first); @@ -865,7 +865,7 @@ if (! cs.attrs_set.empty() || ! cs.attrs_cleared.empty()) { - std::set tmp; + path_set tmp; for (std::set >::const_iterator i = cs.attrs_cleared.begin(); i != cs.attrs_cleared.end(); ++i) tmp.insert(i->first); @@ -1296,7 +1296,7 @@ I(rs.edges.size() == 1); cset const & cs = edge_changes(rs.edges.begin()); - for (std::set::const_iterator i = cs.nodes_deleted.begin(); + for (path_set::const_iterator i = cs.nodes_deleted.begin(); i != cs.nodes_deleted.end(); ++i) cout << "dropped " << *i << endl; @@ -1306,7 +1306,7 @@ cout << "renamed " << i->first << endl << " to " << i->second << endl; - for (std::set::const_iterator i = cs.dirs_added.begin(); + for (path_set::const_iterator i = cs.dirs_added.begin(); i != cs.dirs_added.end(); ++i) cout << "added " << *i << endl; ======================================================================== --- cset.cc 453471e703f38c5bd93d72964f4023fe70d57204 +++ cset.cc 05e68cc244242504bf2e1784588735386fcd8bcd @@ -148,6 +148,8 @@ set attaches; set drops; + MM(*this); + check_normalized(*this); // Decompose all additions into a set of pending attachments to be @@ -156,7 +158,7 @@ // anything else potentially destructive. This should all be // happening in a temp directory anyways. - for (set::const_iterator i = dirs_added.begin(); + for (path_set::const_iterator i = dirs_added.begin(); i != dirs_added.end(); ++i) attaches.insert(attach(t.create_dir_node(), *i)); @@ -169,7 +171,7 @@ // existing paths into the set of pending detaches, to be executed // bottom-up. - for (set::const_iterator i = nodes_deleted.begin(); + for (path_set::const_iterator i = nodes_deleted.begin(); i != nodes_deleted.end(); ++i) detaches.insert(detach(*i)); @@ -246,7 +248,7 @@ print_cset(basic_io::printer & printer, cset const & cs) { - for (set::const_iterator i = cs.nodes_deleted.begin(); + for (path_set::const_iterator i = cs.nodes_deleted.begin(); i != cs.nodes_deleted.end(); ++i) { basic_io::stanza st; @@ -263,7 +265,7 @@ printer.print_stanza(st); } - for (set::const_iterator i = cs.dirs_added.begin(); + for (path_set::const_iterator i = cs.dirs_added.begin(); i != cs.dirs_added.end(); ++i) { basic_io::stanza st; ======================================================================== --- cset.hh 1d39340bb52aef571e199835e698586da071aa66 +++ cset.hh 077036ac38849e3b74dcdce595fdb5ee2762f282 @@ -19,8 +19,6 @@ typedef std::map attr_map_t; -typedef std::vector split_path; - // Virtual interface to a tree-of-files which you can edit // destructively; this may be the filesystem or an in-memory // representation (a roster / mfest). @@ -57,10 +55,10 @@ struct cset { // Deletions. - std::set nodes_deleted; + path_set nodes_deleted; // Additions. - std::set dirs_added; + path_set dirs_added; std::map files_added; // Pure renames. ======================================================================== --- manifest.cc 4d4377fee50757ad0fd303a65b31699a803c4a94 +++ manifest.cc b2c010b21a0955a47ffd79620f12f508d5d2e6a0 @@ -74,136 +74,6 @@ return false; // unavailable } -void -classify_manifest_paths(app_state & app, - manifest_map const & man, - path_set & missing, - path_set & changed, - path_set & unchanged) -{ - inodeprint_map ipm; - - if (in_inodeprints_mode()) - { - data dat; - read_inodeprints(dat); - read_inodeprint_map(dat, ipm); - } - - // this code is speed critical, hence the use of inode fingerprints so be - // careful when making changes in here and preferably do some timing tests - - for (manifest_map::const_iterator i = man.begin(); i != man.end(); ++i) - { - split_path sp; - i->first.split(sp); - - if (app.restriction_includes(i->first)) - { - // compute the current sha1 id for included files - // we might be able to avoid it, if we have an inode fingerprint... - if (inodeprint_unchanged(ipm, i->first)) - { - // the inode fingerprint hasn't changed, so we assume the file - // hasn't either. - manifest_map::const_iterator k = man.find(i->first); - I(k != man.end()); - unchanged.insert(sp); - continue; - } - - // ...ah, well, no good fingerprint, just check directly. - file_id ident; - if (ident_existing_file(i->first, ident, app.lua)) - { - if (ident == i->second) - unchanged.insert(sp); - else - changed.insert(sp); - } - else - { - missing.insert(sp); - } - - } - else - { - // changes to excluded files are ignored - unchanged.insert(sp); - } - } -} - -void -build_restricted_manifest_map(path_set const & paths, - manifest_map const & m_old, - manifest_map & m_new, - app_state & app) -{ - m_new.clear(); - inodeprint_map ipm; - - if (in_inodeprints_mode()) - { - data dat; - read_inodeprints(dat); - read_inodeprint_map(dat, ipm); - } - - size_t missing_files = 0; - - // this code is speed critical, hence the use of inode fingerprints so be - // careful when making changes in here and preferably do some timing tests - - for (path_set::const_iterator i = paths.begin(); i != paths.end(); ++i) - { - if (app.restriction_includes(*i)) - { - // compute the current sha1 id for included files - // we might be able to avoid it, if we have an inode fingerprint... - if (inodeprint_unchanged(ipm, *i)) - { - // the inode fingerprint hasn't changed, so we assume the file - // hasn't either. - manifest_map::const_iterator k = m_old.find(*i); - I(k != m_old.end()); - m_new.insert(*k); - continue; - } - - // ...ah, well, no good fingerprint, just check directly. - file_id ident; - if (ident_existing_file(*i, ident, app.lua)) - { - m_new.insert(manifest_entry(*i, ident)); - } - else - { - file_path fp(*i); - W(F("missing %s") % fp); - missing_files++; - } - } - else - { - // copy the old manifest entry for excluded files - manifest_map::const_iterator old = m_old.find(*i); - if (old != m_old.end()) m_new.insert(*old); - } - } - - N(missing_files == 0, - F("%d missing files\n" - "to restore consistency, on each missing file run either\n" - "'monotone drop FILE' to remove it permanently, or\n" - "'monotone revert FILE' to restore it\n" - "or to handle all at once, simple 'monotone drop --missing'\n" - "or 'monotone revert --missing'") - % missing_files); - -} - // reading manifest_maps void ======================================================================== --- manifest.hh 7256376905b4161910893bbbdc9e83bd6ab3f9d8 +++ manifest.hh 4104c7fda6af925c943515a923cf487f2af2dd24 @@ -73,17 +73,6 @@ class app_state; -void classify_manifest_paths(app_state & app, - manifest_map const & man, - path_set & missing, - path_set & changed, - path_set & unchanged); - -void build_restricted_manifest_map(path_set const & paths, - manifest_map const & m_old, - manifest_map & m_new, - app_state & app); - void read_manifest_map(data const & dat, manifest_map & man); ======================================================================== --- paths.cc 79515041f699f1cb000e3561fda2fcc32b25e4d3 +++ paths.cc 56f151f81c54bb76ebff08df73b4fc9fa70221e7 @@ -613,13 +613,13 @@ file_path fp = file_path_internal(*c); BOOST_CHECK(fp.as_internal() == *c); BOOST_CHECK(file_path_internal(fp.as_internal()) == fp); - std::vector split_test; + split_path split_test; fp.split(split_test); BOOST_CHECK(!split_test.empty()); file_path fp2(split_test); BOOST_CHECK(fp == fp2); BOOST_CHECK(null_name(split_test[0])); - for (std::vector::const_iterator + for (split_path::const_iterator i = split_test.begin() + 1; i != split_test.end(); ++i) BOOST_CHECK(!null_name(*i)); } @@ -638,13 +638,13 @@ // we compare after to the external form too, since as far as we know // relative normalized posix paths are always good win32 paths too BOOST_CHECK(fp.as_external() == after); - std::vector split_test; + split_path split_test; fp.split(split_test); BOOST_CHECK(!split_test.empty()); file_path fp2(split_test); BOOST_CHECK(fp == fp2); BOOST_CHECK(null_name(split_test[0])); - for (std::vector::const_iterator + for (split_path::const_iterator i = split_test.begin() + 1; i != split_test.end(); ++i) BOOST_CHECK(!null_name(*i)); } @@ -778,8 +778,7 @@ { file_path fp1 = file_path_internal("foo/bar/baz"); file_path fp2 = file_path_internal("bar/baz/foo"); - typedef std::vector pcv; - pcv split1, split2; + split_path split1, split2; fp1.split(split1); fp2.split(split2); BOOST_CHECK(fp1 == file_path(split1)); ======================================================================== --- restrictions.cc 751a27b384929942a3bfc5286228c48788471bc0 +++ restrictions.cc 7143bb2882a478cf0c6be8075532bf0733f98f2c @@ -60,7 +60,7 @@ included.clear(); excluded.clear(); - for (std::set::const_iterator i = cs.nodes_deleted.begin(); + for (path_set::const_iterator i = cs.nodes_deleted.begin(); i != cs.nodes_deleted.end(); ++i) { if (app.restriction_includes(*i)) @@ -79,7 +79,7 @@ safe_insert(excluded.nodes_renamed, *i); } - for (std::set::const_iterator i = cs.dirs_added.begin(); + for (path_set::const_iterator i = cs.dirs_added.begin(); i != cs.dirs_added.end(); ++i) { if (app.restriction_includes(*i)) @@ -178,7 +178,7 @@ restrict_cset(work, included, excluded, app); remap_paths(old_paths, old_roster, work, new_paths); - for (std::set::const_iterator i = included.dirs_added.begin(); + for (path_set::const_iterator i = included.dirs_added.begin(); i != included.dirs_added.end(); ++i) new_paths.insert(*i); ======================================================================== --- roster.cc 60a83365b8f023a351a1dea19a94e9c8ae5cb411 +++ roster.cc 72c64e3a7e3dba902d675a14d9ce425b93397614 @@ -1676,8 +1676,8 @@ nodes_changed.clear(); nodes_born.clear(); - set modified_prestate_nodes; - set modified_poststate_nodes; + path_set modified_prestate_nodes; + path_set modified_poststate_nodes; // Pre-state damage @@ -1715,21 +1715,21 @@ // Finale - for (set::const_iterator i = modified_prestate_nodes.begin(); + for (path_set::const_iterator i = modified_prestate_nodes.begin(); i != modified_prestate_nodes.end(); ++i) { I(old_roster.has_node(*i)); nodes_changed.insert(old_roster.get_node(*i)->self); } - for (set::const_iterator i = modified_poststate_nodes.begin(); + for (path_set::const_iterator i = modified_poststate_nodes.begin(); i != modified_poststate_nodes.end(); ++i) { I(new_roster.has_node(*i)); nodes_changed.insert(new_roster.get_node(*i)->self); } - for (std::set::const_iterator i = cs.dirs_added.begin(); + for (path_set::const_iterator i = cs.dirs_added.begin(); i != cs.dirs_added.end(); ++i) { I(new_roster.has_node(*i)); @@ -2438,7 +2438,7 @@ path_component new_component() { - vector pieces; + split_path pieces; file_path_internal(new_word()).split(pieces); return pieces.back(); }