# # # patch "cmd_list.cc" # from [3cfcbe4d2f8d5073d644e61902e8e5f159168ddf] # to [38cf047f5e7382b6423aa66b0ddbc1a98d3ca2d2] # # patch "cmd_ws_commit.cc" # from [39994676c87c70690e8e9a0254d647d317ad3381] # to [fab63b6677295cb5bcb3df265adc6ae75de29493] # ============================================================ --- cmd_list.cc 3cfcbe4d2f8d5073d644e61902e8e5f159168ddf +++ cmd_list.cc 38cf047f5e7382b6423aa66b0ddbc1a98d3ca2d2 @@ -347,17 +347,16 @@ static void } static void -print_paths(set const & paths) +print_formatted_paths(set const & paths) { - set formatted; + // use a vector here to preserve the order of the input set + vector formatted; for (set::const_iterator i = paths.begin(); i != paths.end(); ++i) { - formatted.insert(i->as_relative()); + formatted.push_back(i->as_relative()); } - //sort(formatted.begin(), formatted.end()); - copy(formatted.begin(), formatted.end(), ostream_iterator(cout, "\n")); @@ -395,8 +394,8 @@ CMD(known, "known", "", CMD_REF(list), " known.insert(p); } } - - print_paths(known); + + print_formatted_paths(known); } CMD(unknown, "unknown", "ignored", CMD_REF(list), "", @@ -419,11 +418,11 @@ CMD(unknown, "unknown", "ignored", CMD_R utf8 const & realname = execid[execid.size() - 1]; if (realname() == "ignored") - print_paths(ignored); + print_formatted_paths(ignored); else { I(realname() == "unknown"); - print_paths(unknown); + print_formatted_paths(unknown); } } @@ -443,7 +442,7 @@ CMD(missing, "missing", "", CMD_REF(list set missing; app.work.find_missing(current_roster_shape, mask, missing); - print_paths(missing); + print_formatted_paths(missing); } @@ -495,7 +494,7 @@ CMD(changed, "changed", "", CMD_REF(list } } - print_paths(changed); + print_formatted_paths(changed); } namespace @@ -557,7 +556,7 @@ CMD_AUTOMATE(keys, "", { N(args.size() == 0, F("no arguments needed")); - + vector dbkeys; vector kskeys; // public_hash, private_hash, public_location, private_location ============================================================ --- cmd_ws_commit.cc 39994676c87c70690e8e9a0254d647d317ad3381 +++ cmd_ws_commit.cc fab63b6677295cb5bcb3df265adc6ae75de29493 @@ -56,29 +56,30 @@ revision_summary(revision_t const & rev, for (set::const_iterator i = cs.nodes_deleted.begin(); i != cs.nodes_deleted.end(); ++i) - out += (F(" dropped %s") + out += (F(" dropped %s") % i->as_relative()).str() += '\n'; for (map::const_iterator i = cs.nodes_renamed.begin(); i != cs.nodes_renamed.end(); ++i) out += (F(" renamed %s\n" - " to %s") - % i->first.as_relative() + " to %s") + % i->first.as_relative() % i->second.as_relative()).str() += '\n'; for (set::const_iterator i = cs.dirs_added.begin(); i != cs.dirs_added.end(); ++i) - out += (F(" added %s") % i->as_relative()).str() += '\n'; + out += (F(" added %s") + % i->as_relative()).str() += '\n'; for (map::const_iterator i = cs.files_added.begin(); i != cs.files_added.end(); ++i) - out += (F(" added %s") + out += (F(" added %s") % i->first.as_relative()).str() += '\n'; for (map >::const_iterator i = cs.deltas_applied.begin(); i != cs.deltas_applied.end(); ++i) - out += (F(" patched %s") + out += (F(" patched %s") % (i->first.as_relative())).str() += '\n'; for (map, attr_value >::const_iterator @@ -86,14 +87,14 @@ revision_summary(revision_t const & rev, out += (F(" attr on %s\n" " attr %s\n" " value %s") - % (i->first.first.as_relative()) + % (i->first.first.as_relative()) % (i->first.second) % (i->second)).str() += "\n"; for (set >::const_iterator i = cs.attrs_cleared.begin(); i != cs.attrs_cleared.end(); ++i) out += (F(" unset on %s\n" " attr %s") - % (i->first.as_relative()) + % (i->first.as_relative()) % (i->second)).str() += "\n"; } summary = utf8(out); @@ -108,7 +109,7 @@ get_log_message_interactively(revision_t revision_summary(cs, app.opts.branchname, summary); external summary_external; utf8_to_system_best_effort(summary, summary_external); - + utf8 branch_comment = utf8((F("branch \"%s\"\n\n") % app.opts.branchname).str()); external branch_external; utf8_to_system_best_effort(branch_comment, branch_external); @@ -173,7 +174,7 @@ CMD(revert, "revert", "", CMD_REF(worksp temp_node_id_source nis; app.work.get_current_roster_shape(new_roster, nis); } - + node_restriction mask(args_to_paths(args), args_to_paths(app.opts.exclude_patterns), app.opts.depth, @@ -782,7 +783,7 @@ CMD(attr_set, "set", "", CMD_REF(attr), // format: ('attr', name, value), ('state', [unchanged|changed|added|dropped]) // occurs: zero or more times // -// Error conditions: If the path has no attributes, prints only the +// Error conditions: If the path has no attributes, prints only the // format version, if the file is unknown, escalates CMD_AUTOMATE(get_attributes, N_("PATH"), N_("Prints all attributes for the specified path"), @@ -813,20 +814,20 @@ CMD_AUTOMATE(get_attributes, N_("PATH"), // create the printer basic_io::printer pr; - + // print the format version basic_io::stanza st; st.push_str_pair(basic_io::syms::format_version, "1"); pr.print_stanza(st); - + // the current node holds all current attributes (unchanged and new ones) node_t n = current.get_node(path); - for (full_attr_map_t::const_iterator i = n->attrs.begin(); + for (full_attr_map_t::const_iterator i = n->attrs.begin(); i != n->attrs.end(); ++i) { std::string value(i->second.second()); std::string state; - + // if if the first value of the value pair is false this marks a // dropped attribute if (!i->second.first) @@ -836,16 +837,16 @@ CMD_AUTOMATE(get_attributes, N_("PATH"), // because if it is dropped there as well it was already deleted // in any previous revision I(base.has_node(path)); - + node_t prev_node = base.get_node(path); - + // find the attribute in there full_attr_map_t::const_iterator j = prev_node->attrs.find(i->first); I(j != prev_node->attrs.end()); - + // was this dropped before? then ignore it if (!j->second.first) { continue; } - + state = "dropped"; // output the previous (dropped) value later value = j->second.second(); @@ -856,16 +857,16 @@ CMD_AUTOMATE(get_attributes, N_("PATH"), if (base.has_node(path)) { node_t prev_node = base.get_node(path); - full_attr_map_t::const_iterator j = + full_attr_map_t::const_iterator j = prev_node->attrs.find(i->first); - + // the attribute is new if it either hasn't been found // in the previous roster or has been deleted there if (j == prev_node->attrs.end() || !j->second.first) { state = "added"; } - // check if the attribute's value has been changed + // check if the attribute's value has been changed else if (i->second.second() != j->second.second()) { state = "changed"; @@ -881,14 +882,14 @@ CMD_AUTOMATE(get_attributes, N_("PATH"), state = "added"; } } - + basic_io::stanza st; st.push_str_triple(basic_io::syms::attr, i->first(), value); st.push_str_pair(symbol("state"), state); pr.print_stanza(st); } - - // print the output + + // print the output output.write(pr.buf.data(), pr.buf.size()); } @@ -940,7 +941,7 @@ CMD_AUTOMATE(set_attribute, N_("PATH KEY // 1: file / directory name // 2: attribute key (optional) // Added in: 5.0 -// Purpose: Edits the workspace revision and drops an attribute or all +// Purpose: Edits the workspace revision and drops an attribute or all // attributes of the specified path // // Error conditions: If PATH is unknown in the new roster or the specified @@ -1106,7 +1107,7 @@ CMD(commit, "commit", "ci", CMD_REF(work set heads; app.get_project().get_branch_heads(app.opts.branchname, heads); unsigned int old_head_size = heads.size(); - + { transaction_guard guard(app.db); @@ -1115,7 +1116,7 @@ CMD(commit, "commit", "ci", CMD_REF(work else { L(FL("inserting new revision %s") % restricted_rev_id); - + for (edge_map::const_iterator edge = restricted_rev.edges.begin(); edge != restricted_rev.edges.end(); edge++)