#
#
# patch "ChangeLog"
# from [775c02b0142a44d0d669e28199830d19c3c20047]
# to [da68d11e86905069b0d0fa68eaae03b71f1b7287]
#
# patch "cmd_diff_log.cc"
# from [affe816395b210dbe0e632bc191f4dcd1d6a8177]
# to [2e889d5a5362f213f72e65089b371a4c53610955]
#
# patch "cmd_list.cc"
# from [852a8765a58e4cea31fe527ee1cc3f0b431184eb]
# to [d9d990cc36d224e4614b756ec10e4376bd55f1f8]
#
# patch "cmd_merging.cc"
# from [766bb06392eee71f2ed4ebecb17da9b9f0fce76c]
# to [ad2712f85748ce56f5b6a66b8daf10829f6e6077]
#
# patch "cmd_netsync.cc"
# from [624019425573cc5ac20ad0628032d32b9085d718]
# to [34667d8a6995c42b199aff17696b036f161c12ef]
#
# patch "cmd_ws_commit.cc"
# from [df6621e7ffc64c6b9d71834703108cf31f5f4dab]
# to [71698cbcbe710c826a68d81305555f3858a5be18]
#
# patch "tests/t_log_dir.at"
# from [53f4cd7b11fcb5c7e3b3fb19a5ad5a19fee0c82c]
# to [6301869868e3eefa8f879ec04a564f794d776327]
#
# patch "work.cc"
# from [3d333ffd3e702c32590eaa09b2f47fa18c92ffc6]
# to [6143fe5657ecc968d463609fea64f6d038deffaf]
#
# patch "work.hh"
# from [6d26cc5cb9abbd1bbba15a73e92c3e1f99df9dc2]
# to [65b7ddb32efff3a94ccba37c4087914faea5bdaf]
#
============================================================
--- ChangeLog 775c02b0142a44d0d669e28199830d19c3c20047
+++ ChangeLog da68d11e86905069b0d0fa68eaae03b71f1b7287
@@ -1,3 +1,11 @@
+2006-04-25 Derek Scherger
+
+ * cmd_*.cc: merge new restrictions changes in from commands.cc
+ split
+ * tests/t_log_dir.at: remove stale comment
+ * work.{cc,hh}(find_missing, find_unknown_and_ignored): move
+ these functions here from commands.cc split
+
2006-04-24 Derek Scherger
* contrib/monotone.el (monotone-commit-complete): call line
============================================================
--- cmd_diff_log.cc affe816395b210dbe0e632bc191f4dcd1d6a8177
+++ cmd_diff_log.cc 2e889d5a5362f213f72e65089b371a4c53610955
@@ -196,8 +196,7 @@
dump_diffs(cset const & cs,
app_state & app,
bool new_is_archived,
- diff_type type,
- set restrict_paths = set())
+ diff_type type)
{
// 60 is somewhat arbitrary, but less than 80
std::string patch_sep = std::string(60, '=');
@@ -206,10 +205,6 @@
i = cs.files_added.begin();
i != cs.files_added.end(); ++i)
{
- if (!restrict_paths.empty()
- && restrict_paths.find(i->first) == restrict_paths.end())
- continue;
-
cout << patch_sep << "\n";
data unpacked;
vector lines;
@@ -258,10 +253,6 @@
i = cs.deltas_applied.begin();
i != cs.deltas_applied.end(); ++i)
{
- if (!restrict_paths.empty()
- && restrict_paths.find(i->first) == restrict_paths.end())
- continue;
-
file_data f_old;
data data_old, data_new;
vector old_lines, new_lines;
@@ -319,8 +310,6 @@
OPT_UNIFIED_DIFF % OPT_CONTEXT_DIFF % OPT_EXTERNAL_DIFF %
OPT_EXTERNAL_DIFF_ARGS)
{
- revision_set r_old, r_new;
- roster_t new_roster, old_roster;
bool new_is_archived;
diff_type type = app.diff_format;
ostringstream header;
@@ -331,8 +320,7 @@
F("--diff-args requires --external\n"
"try adding --external or removing --diff-args?"));
- cset composite;
- cset excluded;
+ cset included, excluded;
// initialize before transaction so we have a database to work with
@@ -343,77 +331,90 @@
if (app.revision_selectors.size() == 0)
{
- get_working_revision_and_rosters(app, args, r_new,
- old_roster,
- new_roster,
- excluded,
- nis);
+ roster_t new_roster, old_roster;
+ revision_id old_rid;
- I(r_new.edges.size() == 1 || r_new.edges.size() == 0);
- if (r_new.edges.size() == 1)
- composite = edge_changes(r_new.edges.begin());
+ get_base_and_current_roster_shape(old_roster, new_roster, app);
+ get_revision_id(old_rid);
+
+ restriction mask(args, app.exclude_patterns, old_roster, new_roster, app);
+
+ update_current_roster_from_filesystem(new_roster, mask, app);
+ make_restricted_csets(old_roster, new_roster, included, excluded, mask);
+ check_restricted_cset(old_roster, included);
+
new_is_archived = false;
- revision_id old_rid;
- get_revision_id(old_rid);
header << "# old_revision [" << old_rid << "]" << "\n";
}
else if (app.revision_selectors.size() == 1)
{
+ roster_t new_roster, old_roster;
revision_id r_old_id;
+
complete(app, idx(app.revision_selectors, 0)(), r_old_id);
N(app.db.revision_exists(r_old_id),
F("no such revision '%s'") % r_old_id);
- get_working_revision_and_rosters(app, args, r_new,
- old_roster,
- new_roster,
- excluded,
- nis);
+
+ get_base_and_current_roster_shape(old_roster, new_roster, app);
// Clobber old_roster with the one specified
- app.db.get_revision(r_old_id, r_old);
app.db.get_roster(r_old_id, old_roster);
- I(r_new.edges.size() == 1 || r_new.edges.size() == 0);
- N(r_new.edges.size() == 1, F("current revision has no ancestor"));
+
+ // FIXME: handle no ancestor case
+ // N(r_new.edges.size() == 1, F("current revision has no ancestor"));
+
+ restriction mask(args, app.exclude_patterns, old_roster, new_roster, app);
+
+ update_current_roster_from_filesystem(new_roster, mask, app);
+ make_restricted_csets(old_roster, new_roster, included, excluded, mask);
+ check_restricted_cset(old_roster, included);
+
new_is_archived = false;
header << "# old_revision [" << r_old_id << "]" << "\n";
- {
- // Calculate a cset from old->new, then re-restrict it (using the
- // one from get_working_revision_and_rosters doesn't work here,
- // since it only restricts the edge base->new, and there might be
- // changes outside the restriction in old->base)
- cset tmp1, tmp2;
- make_cset (old_roster, new_roster, tmp1);
- calculate_restricted_cset (app, args, tmp1, composite, tmp2);
- }
}
else if (app.revision_selectors.size() == 2)
{
+ roster_t new_roster, old_roster;
revision_id r_old_id, r_new_id;
+
complete(app, idx(app.revision_selectors, 0)(), r_old_id);
complete(app, idx(app.revision_selectors, 1)(), r_new_id);
+
N(app.db.revision_exists(r_old_id),
F("no such revision '%s'") % r_old_id);
- app.db.get_revision(r_old_id, r_old);
N(app.db.revision_exists(r_new_id),
F("no such revision '%s'") % r_new_id);
- app.db.get_revision(r_new_id, r_new);
+
app.db.get_roster(r_old_id, old_roster);
app.db.get_roster(r_new_id, new_roster);
+
+ restriction mask(args, app.exclude_patterns, old_roster, new_roster, app);
+
+ // FIXME: this is *possibly* a UI bug, insofar as we
+ // look at the restriction name(s) you provided on the command
+ // line in the context of new and old, *not* the working copy.
+ // One way of "fixing" this is to map the filenames on the command
+ // line to node_ids, and then restrict based on those. This
+ // might be more intuitive; on the other hand it would make it
+ // impossible to restrict to paths which are dead in the working
+ // copy but live between old and new. So ... no rush to "fix" it;
+ // discuss implications first.
+ //
+ // let the discussion begin...
+ //
+ // - "map filenames on the command line to node_ids" needs to be done
+ // in the context of some roster, possibly the working copy base or
+ // the current working copy (or both)
+ // - diff with two --revision's may be done with no working copy
+ // - some form of "peg" revision syntax for paths that would allow
+ // for each path to specify which revision it is relevant to is
+ // probably the "right" way to go eventually. something like address@hidden
+ // (which fails for paths with @'s in them) or possibly //rev/file
+ // since versioned paths are required to be relative.
+
+ make_restricted_csets(old_roster, new_roster, included, excluded, mask);
+ check_restricted_cset(old_roster, included);
+
new_is_archived = true;
- {
- // Calculate a cset from old->new, then re-restrict it.
- // FIXME: this is *possibly* a UI bug, insofar as we
- // look at the restriction name(s) you provided on the command
- // line in the context of new and old, *not* the workspace.
- // One way of "fixing" this is to map the filenames on the command
- // line to node_ids, and then restrict based on those. This
- // might be more intuitive; on the other hand it would make it
- // impossible to restrict to paths which are dead in the working
- // copy but live between old and new. So ... no rush to "fix" it;
- // discuss implications first.
- cset tmp1, tmp2;
- make_cset (old_roster, new_roster, tmp1);
- calculate_restricted_cset (app, args, tmp1, composite, tmp2);
- }
}
else
{
@@ -422,7 +423,7 @@
data summary;
- write_cset(composite, summary);
+ write_cset(included, summary);
vector lines;
split_into_lines(summary(), lines);
@@ -440,9 +441,9 @@
cout << "# " << "\n";
if (type == external_diff) {
- do_external_diff(composite, app, new_is_archived);
+ do_external_diff(included, app, new_is_archived);
} else
- dump_diffs(composite, app, new_is_archived, type);
+ dump_diffs(included, app, new_is_archived, type);
}
static void
@@ -507,13 +508,9 @@
if (app.revision_selectors.size() == 0)
app.require_workspace("try passing a --revision to start at");
- temp_node_id_source nis;
-
- set nodes;
-
set frontier;
-
revision_id first_rid;
+
if (app.revision_selectors.size() == 0)
{
get_revision_id(first_rid);
@@ -532,42 +529,21 @@
}
}
+ restriction mask(app);
+
if (args.size() > 0)
{
// User wants to trace only specific files
roster_t old_roster, new_roster;
- revision_set rev;
if (app.revision_selectors.size() == 0)
- get_unrestricted_working_revision_and_rosters(app, rev, old_roster, new_roster, nis);
+ get_base_and_current_roster_shape(old_roster, new_roster, app);
else
app.db.get_roster(first_rid, new_roster);
- deque todo;
- for (size_t i = 0; i < args.size(); ++i)
- {
- file_path fp = file_path_external(idx(args, i));
- split_path sp;
- fp.split(sp);
- N(new_roster.has_node(sp),
- F("Unknown file '%s' for log command") % fp);
- todo.push_back(new_roster.get_node(sp));
- }
- while (!todo.empty())
- {
- node_t n = todo.front();
- todo.pop_front();
- nodes.insert(n->self);
- if (is_dir_t(n))
- {
- dir_t d = downcast_to_dir_t(n);
- for (dir_map::const_iterator i = d->children.begin();
- i != d->children.end(); ++i)
- {
- todo.push_front(i->second);
- }
- }
- }
+ // FIXME_RESTRICTIONS: should this add paths from the rosters of all selected revs?
+ // try log dir/ to see what happens
+ mask = restriction(args, app.exclude_patterns, old_roster, new_roster, app);
}
@@ -586,6 +562,8 @@
F("only one of --last/--next allowed"));
revision_set rev;
+ roster_t roster;
+
while(! frontier.empty() && (last == -1 || last > 0) && (next == -1 || next > 0))
{
set next_frontier;
@@ -595,7 +573,7 @@
{
revision_id rid = *i;
- bool print_this = nodes.empty();
+ bool print_this = mask.empty();
set< revision > parents;
vector< revision > tmp;
@@ -610,33 +588,30 @@
seen.insert(rid);
app.db.get_revision(rid, rev);
+ app.db.get_roster(rid, roster);
- set next_nodes;
-
- if (!nodes.empty())
+ if (!mask.empty())
{
- set nodes_changed;
- set nodes_born;
+ // TODO: stop if the restriction is pre-dated by the current roster
+ // i.e. the restriction's nodes are not born in the current roster
+
+ set nodes_modified;
bool any_node_hit = false;
- select_nodes_modified_by_rev(rid, rev,
- nodes_changed,
- nodes_born,
+ select_nodes_modified_by_rev(rid, rev, roster,
+ nodes_modified,
app);
- for (set::const_iterator n = nodes.begin(); n != nodes.end(); ++n)
+
+ for (set::const_iterator n = nodes_modified.begin();
+ n != nodes_modified.end(); ++n)
{
- if (nodes_changed.find(*n) != nodes_changed.end()
- || nodes_born.find(*n) != nodes_born.end())
+ // the current roster won't have deleted nodes
+ if (!roster.has_node(*n) || mask.includes(roster, *n))
{
any_node_hit = true;
break;
}
}
- next_nodes = nodes;
- for (set::const_iterator n = nodes_born.begin(); n != nodes_born.end();
- ++n)
- next_nodes.erase(*n);
-
if (any_node_hit)
print_this = true;
}
@@ -711,23 +686,7 @@
for (edge_map::const_iterator e = rev.edges.begin();
e != rev.edges.end(); ++e)
{
- // limit to selected nodes
- set node_names;
- if (!nodes.empty())
- {
- roster_t ros;
- app.db.get_roster(rid, ros);
-
- for (set::const_iterator n = nodes.begin();
- n != nodes.end(); n++)
- {
- split_path sp;
- ros.get_name(*n, sp);
- node_names.insert(sp);
- }
- }
- dump_diffs(edge_changes(e), app, true, unified_diff,
- node_names);
+ dump_diffs(edge_changes(e), app, true, unified_diff);
}
}
@@ -741,11 +700,6 @@
}
}
- // when we had a restriction and run out of nodes, stop.
- if (!nodes.empty() && next_nodes.empty())
- return;
-
- nodes = next_nodes;
}
frontier = next_frontier;
}
============================================================
--- cmd_list.cc 852a8765a58e4cea31fe527ee1cc3f0b431184eb
+++ cmd_list.cc d9d990cc36d224e4614b756ec10e4376bd55f1f8
@@ -308,33 +308,36 @@
}
static void
-ls_known (app_state & app, vector const & args)
+ls_known(app_state & app, vector const & args)
{
- revision_set rs;
roster_t old_roster, new_roster;
- data tmp;
- temp_node_id_source nis;
app.require_workspace();
+ get_base_and_current_roster_shape(old_roster, new_roster, app);
- path_set paths;
- get_working_revision_and_rosters(app, args, rs, old_roster, new_roster, nis);
- new_roster.extract_path_set(paths);
-
- for (path_set::const_iterator p = paths.begin(); p != paths.end(); ++p)
+ restriction mask(args, app.exclude_patterns, new_roster, app);
+
+ node_map const & nodes = new_roster.all_nodes();
+ for (node_map::const_iterator i = nodes.begin(); i != nodes.end(); ++i)
{
- if (app.restriction_includes(*p))
- cout << file_path(*p) << "\n";
+ node_id nid = i->first;
+
+ if (!new_roster.is_root(nid) && mask.includes(new_roster, nid))
+ {
+ split_path sp;
+ new_roster.get_name(nid, sp);
+ cout << file_path(sp) << "\n";
+ }
}
}
static void
-ls_unknown_or_ignored (app_state & app, bool want_ignored, vector const & args)
+ls_unknown_or_ignored(app_state & app, bool want_ignored, vector const & args)
{
app.require_workspace();
path_set unknown, ignored;
- find_unknown_and_ignored(app, want_ignored, args, unknown, ignored);
+ find_unknown_and_ignored(app, args, unknown, ignored);
if (want_ignored)
for (path_set::const_iterator i = ignored.begin(); i != ignored.end(); ++i)
@@ -345,7 +348,7 @@
}
static void
-ls_missing (app_state & app, vector const & args)
+ls_missing(app_state & app, vector const & args)
{
path_set missing;
find_missing(app, args, missing);
@@ -358,51 +361,61 @@
static void
-ls_changed (app_state & app, vector const & args)
+ls_changed(app_state & app, vector const & args)
{
- revision_set rs;
- revision_id rid;
roster_t old_roster, new_roster;
- data tmp;
+ cset included, excluded;
std::set files;
temp_node_id_source nis;
app.require_workspace();
- get_working_revision_and_rosters(app, args, rs, old_roster, new_roster, nis);
- I(rs.edges.size() == 1);
- cset const & cs = edge_changes(rs.edges.begin());
+ get_base_and_current_roster_shape(old_roster, new_roster, app);
- for (path_set::const_iterator i = cs.nodes_deleted.begin();
- i != cs.nodes_deleted.end(); ++i)
+ restriction mask(args, app.exclude_patterns, old_roster, new_roster, app);
+
+ update_current_roster_from_filesystem(new_roster, mask, app);
+ make_restricted_csets(old_roster, new_roster, included, excluded, mask);
+ check_restricted_cset(old_roster, included);
+
+ // FIXME: this would probably be better as a function of roster.cc
+ // set nodes;
+ // select_nodes_modified_by_cset(included, old_roster, new_roster, nodes);
+
+ for (path_set::const_iterator i = included.nodes_deleted.begin();
+ i != included.nodes_deleted.end(); ++i)
{
- if (app.restriction_includes(*i))
+ if (mask.includes(*i))
files.insert(file_path(*i));
}
- for (std::map::const_iterator i = cs.nodes_renamed.begin();
- i != cs.nodes_renamed.end(); ++i)
+ for (std::map::const_iterator
+ i = included.nodes_renamed.begin();
+ i != included.nodes_renamed.end(); ++i)
{
- if (app.restriction_includes(i->first))
+ // FIXME: is reporting the old name the "right" thing to do?
+ if (mask.includes(i->first))
files.insert(file_path(i->first));
}
- for (path_set::const_iterator i = cs.dirs_added.begin();
- i != cs.dirs_added.end(); ++i)
+ for (path_set::const_iterator i = included.dirs_added.begin();
+ i != included.dirs_added.end(); ++i)
{
- if (app.restriction_includes(*i))
+ if (mask.includes(*i))
files.insert(file_path(*i));
}
- for (std::map::const_iterator i = cs.files_added.begin();
- i != cs.files_added.end(); ++i)
+ for (std::map::const_iterator i = included.files_added.begin();
+ i != included.files_added.end(); ++i)
{
- if (app.restriction_includes(i->first))
+ if (mask.includes(i->first))
files.insert(file_path(i->first));
}
for (std::map >::const_iterator
- i = cs.deltas_applied.begin(); i != cs.deltas_applied.end(); ++i)
+ i = included.deltas_applied.begin(); i != included.deltas_applied.end();
+ ++i)
{
- if (app.restriction_includes(i->first))
+ if (mask.includes(i->first))
files.insert(file_path(i->first));
}
+ // FIXME: should attr changes count?
copy(files.begin(), files.end(),
std::ostream_iterator(cout, "\n"));
============================================================
--- cmd_merging.cc 766bb06392eee71f2ed4ebecb17da9b9f0fce76c
+++ cmd_merging.cc ad2712f85748ce56f5b6a66b8daf10829f6e6077
@@ -41,7 +41,7 @@
"If not, update the workspace to the head of the branch."),
OPT_BRANCH_NAME % OPT_REVISION)
{
- revision_set r_old, r_working, r_new;
+ revision_set r_working;
roster_t working_roster, chosen_roster, target_roster;
boost::shared_ptr old_roster = boost::shared_ptr(new roster_t());
marking_map working_mm, chosen_mm, merged_mm, target_mm;
@@ -61,9 +61,12 @@
// such. But it should work for now; revisit if performance is
// intolerable.
- get_unrestricted_working_revision_and_rosters(app, r_working,
- *old_roster,
- working_roster, nis);
+ get_base_and_current_roster_shape(*old_roster, working_roster, app);
+ update_current_roster_from_filesystem(working_roster, app);
+
+ get_revision_id(r_old_id);
+ make_revision_set(r_old_id, *old_roster, working_roster, r_working);
+
calculate_ident(r_working, r_working_id);
I(r_working.edges.size() == 1);
r_old_id = edge_old_revision(r_working.edges.begin());
@@ -192,7 +195,7 @@
}
// Note that under the definition of mark-merge, the workspace is an
- // "uncommon ancestor" if itself too, even though it was not present in
+ // "uncommon ancestor" of itself too, even though it was not present in
// the database (hence not returned by the query above).
working_uncommon_ancestors.insert(r_working_id);
@@ -232,8 +235,8 @@
// and write the cset from chosen to merged changeset in _MTN/work
cset update, remaining;
- make_cset (working_roster, merged_roster, update);
- make_cset (target_roster, merged_roster, remaining);
+ make_cset(working_roster, merged_roster, update);
+ make_cset(target_roster, merged_roster, remaining);
// {
// data t1, t2, t3;
============================================================
--- cmd_netsync.cc 624019425573cc5ac20ad0628032d32b9085d718
+++ cmd_netsync.cc 34667d8a6995c42b199aff17696b036f161c12ef
@@ -54,7 +54,7 @@
{
E(serve_mode || args.size() >= 2, F("no branch pattern given"));
int pattern_offset = (serve_mode ? 0 : 1);
- std::set patterns(args.begin() + pattern_offset, args.end());
+ std::vector patterns(args.begin() + pattern_offset, args.end());
combine_and_check_globish(patterns, include_pattern);
combine_and_check_globish(app.exclude_patterns, exclude_pattern);
if (use_defaults &&
============================================================
--- cmd_ws_commit.cc df6621e7ffc64c6b9d71834703108cf31f5f4dab
+++ cmd_ws_commit.cc 71698cbcbe710c826a68d81305555f3858a5be18
@@ -1,10 +1,11 @@
#include "cmd.hh"
-#include "revision.hh"
#include "diff_patch.hh"
#include "packet.hh"
+#include "restrictions.hh"
+#include "revision.hh"
#include "transforms.hh"
-#include "restrictions.hh"
+#include "work.hh"
#include