#
#
# rename "tests/t_log_depth.at"
# to "tests/t_log_last_next.at"
#
# patch "ChangeLog"
# from [518ee172d4c0c6af3292370c557874c534731681]
# to [5952d77aa43c095499c43a20546a9bcdc3d225e7]
#
# patch "app_state.cc"
# from [c01ca1020ed025d4a7153030d25fda87d03645f9]
# to [9457a5a86bf5be3837482583ed08164b53e20541]
#
# patch "app_state.hh"
# from [6f33817c2a63c63e5b893cebbc49f863195b2d82]
# to [2f43fc74c88fdbbfdeeef1c966a2a811ee2e0c20]
#
# patch "commands.cc"
# from [72f5fa6d4e6a72199a3a1612baa7977f3ab72ea3]
# to [7a8a08ebb4f9834aef113c20c529870cb10c5e6b]
#
# patch "monotone.cc"
# from [230bf4a63ae962252dd05590b0b6263b9035ff0d]
# to [6848daed4195f9d60a08843ac91bdd9e95df2f4f]
#
# patch "options.hh"
# from [1d2cb0bc377c4b051b2fbd288a5225891bcb8b35]
# to [6dc48543e2cb20ea82ded241dc5bb6088c3cb09c]
#
# patch "tests/t_log_last_next.at"
# from [850fc51a2454f9e2a9a352bed17e9f2e485f13b6]
# to [b90e1c651ecda4499cd37ce76444701b55c43c09]
#
# patch "testsuite.at"
# from [35bd354169243028a40ef8d2ca3a6697237a9bb2]
# to [c4a1c8a8aa70c27d11caeb9c70ba713680109fee]
#
============================================================
--- ChangeLog 518ee172d4c0c6af3292370c557874c534731681
+++ ChangeLog 5952d77aa43c095499c43a20546a9bcdc3d225e7
@@ -1,3 +1,14 @@
+2006-01-26 Derek Scherger
+
+ * app_state.{cc,hh}:
+ * commands.cc (log):
+ * monotone.cc:
+ * options.hh: allow --next to view upcoming changes
+ * tests/t_log_depth.at: rename to ...
+ * tests/t_log_last_next.at: ... this since log now uses
+ --last/--next and not --depth
+ * testsuite.at: rename t_log_depth.at to t_log_last_next.at
+
2005-01-24 Timothy Brownawell
Make a netsync client crash not hang the testsuite.
============================================================
--- app_state.cc c01ca1020ed025d4a7153030d25fda87d03645f9
+++ app_state.cc 9457a5a86bf5be3837482583ed08164b53e20541
@@ -33,7 +33,7 @@
rcfiles(true), diffs(false),
merges(false), set_default(false), verbose(false), date_set(false),
search_root("/"),
- depth(-1), last(-1), diff_format(unified_diff), diff_args_provided(false),
+ depth(-1), last(-1), next(-1), diff_format(unified_diff), diff_args_provided(false),
use_lca(false), execute(false), bind_address(""), bind_port(""),
missing(false), unknown(false),
confdir(get_default_confdir()), have_set_key_dir(false)
@@ -422,6 +422,14 @@
}
void
+app_state::set_next(long l)
+{
+ N(l > 0,
+ F("negative or zero next not allowed\n"));
+ next = l;
+}
+
+void
app_state::set_pidfile(system_path const & p)
{
pidfile = p;
============================================================
--- app_state.hh 6f33817c2a63c63e5b893cebbc49f863195b2d82
+++ app_state.hh 2f43fc74c88fdbbfdeeef1c966a2a811ee2e0c20
@@ -58,6 +58,7 @@
bool found_working_copy;
long depth;
long last;
+ long next;
system_path pidfile;
diff_type diff_format;
bool diff_args_provided;
@@ -115,6 +116,7 @@
void set_author(utf8 const & author);
void set_depth(long depth);
void set_last(long last);
+ void set_next(long next);
void set_pidfile(system_path const & pidfile);
void add_revision(utf8 const & selector);
void add_exclude(utf8 const & exclude_pattern);
============================================================
--- commands.cc 72f5fa6d4e6a72199a3a1612baa7977f3ab72ea3
+++ commands.cc 7a8a08ebb4f9834aef113c20c529870cb10c5e6b
@@ -3462,7 +3462,7 @@
CMD(log, N_("informative"), N_("[FILE] ..."),
N_("print history in reverse order (filtering by 'FILE'). If one or more\n"
"revisions are given, use them as a starting point."),
- OPT_LAST % OPT_REVISION % OPT_BRIEF % OPT_DIFFS % OPT_MERGES)
+ OPT_LAST % OPT_NEXT % OPT_REVISION % OPT_BRIEF % OPT_DIFFS % OPT_MERGES)
{
if (app.revision_selectors.size() == 0)
app.require_working_copy("try passing a --revision to start at");
@@ -3522,9 +3522,13 @@
set seen;
long last = app.last;
+ long next = app.next;
+ N(last == -1 || next == -1,
+ F("only one of --last/--next allowed"));
+
revision_set rev;
- while(! frontier.empty() && (last == -1 || last > 0))
+ while(! frontier.empty() && (last == -1 || last > 0) && (next == -1 || next > 0))
{
set next_frontier;
@@ -3587,10 +3591,24 @@
e != rev.edges.end(); ++e)
{
ancestors.insert(edge_old_revision(e));
- next_frontier.insert(edge_old_revision(e));
csum.add_change_set(edge_changes(e));
}
+ if (next > 0)
+ {
+ set children;
+ app.db.get_revision_children(rid, children);
+ copy(children.begin(), children.end(),
+ inserter(next_frontier, next_frontier.end()));
+ }
+ else // work backwards by default
+ {
+ set parents;
+ app.db.get_revision_parents(rid, parents);
+ copy(parents.begin(), parents.end(),
+ inserter(next_frontier, next_frontier.end()));
+ }
+
if (!app.merges && rev.is_merge_node())
print_this = false;
@@ -3655,10 +3673,15 @@
}
}
- if (last > 0)
+ if (next > 0)
{
+ next--;
+ }
+ else if (last > 0)
+ {
last--;
}
+
}
// when we had a restriction and run out of nodes, stop.
if (!nodes.empty() && next_nodes.empty())
============================================================
--- monotone.cc 230bf4a63ae962252dd05590b0b6263b9035ff0d
+++ monotone.cc 6848daed4195f9d60a08843ac91bdd9e95df2f4f
@@ -55,7 +55,8 @@
{"date", 0, POPT_ARG_STRING, &argstr, OPT_DATE, gettext_noop("override date/time for commit"), NULL},
{"author", 0, POPT_ARG_STRING, &argstr, OPT_AUTHOR, gettext_noop("override author for commit"), NULL},
{"depth", 0, POPT_ARG_LONG, &arglong, OPT_DEPTH, gettext_noop("limit the number of levels of directories to descend"), NULL},
- {"last", 0, POPT_ARG_LONG, &arglong, OPT_LAST, gettext_noop("limit the log output to the given number of entries"), NULL},
+ {"last", 0, POPT_ARG_LONG, &arglong, OPT_LAST, gettext_noop("limit log output to the last number of entries"), NULL},
+ {"next", 0, POPT_ARG_LONG, &arglong, OPT_NEXT, gettext_noop("limit log output to the next number of entries"), NULL},
{"pid-file", 0, POPT_ARG_STRING, &argstr, OPT_PIDFILE, gettext_noop("record process id of server"), NULL},
{"brief", 0, POPT_ARG_NONE, NULL, OPT_BRIEF, gettext_noop("print a brief version of the normal output"), NULL},
{"diffs", 0, POPT_ARG_NONE, NULL, OPT_DIFFS, gettext_noop("print diffs along with logs"), NULL},
@@ -403,6 +404,10 @@
app.set_last(arglong);
break;
+ case OPT_NEXT:
+ app.set_next(arglong);
+ break;
+
case OPT_DEPTH:
app.set_depth(arglong);
break;
============================================================
--- options.hh 1d2cb0bc377c4b051b2fbd288a5225891bcb8b35
+++ options.hh 6dc48543e2cb20ea82ded241dc5bb6088c3cb09c
@@ -34,19 +34,20 @@
#define OPT_DIFFS 25
#define OPT_MERGES 26
#define OPT_LAST 27
+#define OPT_NEXT 28
+#define OPT_VERBOSE 29
+#define OPT_SET_DEFAULT 30
+#define OPT_EXCLUDE 31
+#define OPT_UNIFIED_DIFF 32
+#define OPT_CONTEXT_DIFF 33
+#define OPT_EXTERNAL_DIFF 34
+#define OPT_EXTERNAL_DIFF_ARGS 35
+#define OPT_LCA 36
+#define OPT_EXECUTE 37
+#define OPT_KEY_DIR 38
+#define OPT_BIND 39
+#define OPT_MISSING 40
+#define OPT_UNKNOWN 41
+#define OPT_KEY_TO_PUSH 42
+#define OPT_CONF_DIR 43
+#define OPT_DROP_ATTR 44
-#define OPT_VERBOSE 28
-#define OPT_SET_DEFAULT 29
-#define OPT_EXCLUDE 30
-#define OPT_UNIFIED_DIFF 31
-#define OPT_CONTEXT_DIFF 32
-#define OPT_EXTERNAL_DIFF 33
-#define OPT_EXTERNAL_DIFF_ARGS 34
-#define OPT_LCA 35
-#define OPT_EXECUTE 36
-#define OPT_KEY_DIR 37
-#define OPT_BIND 38
-#define OPT_MISSING 39
-#define OPT_UNKNOWN 40
-#define OPT_KEY_TO_PUSH 41
-#define OPT_CONF_DIR 42
-#define OPT_DROP_ATTR 43
============================================================
--- tests/t_log_depth.at 850fc51a2454f9e2a9a352bed17e9f2e485f13b6
+++ tests/t_log_last_next.at b90e1c651ecda4499cd37ce76444701b55c43c09
@@ -1,10 +1,11 @@
-AT_SETUP([log --last=N])
+AT_SETUP([log --last=N/--next=N])
MONOTONE_SETUP
ADD_FILE(foo, [foo
])
AT_CHECK(MONOTONE --branch=testbranch commit --message "Addition of foo.",
[], [ignore], [ignore])
+FOO=`BASE_REVISION`
ADD_FILE(bar, [bar
])
@@ -16,6 +17,7 @@
AT_CHECK(MONOTONE --branch=testbranch commit --message "Addition of baz.",
[], [ignore], [ignore])
+
AT_CHECK(MONOTONE log --last=0, [1], [], [ignore])
AT_CHECK(MONOTONE log --last=1 | grep '^Revision:', [], [stdout], [ignore])
@@ -24,4 +26,22 @@
AT_CHECK(MONOTONE log --last=2 | grep '^Revision:', [], [stdout], [ignore])
AT_CHECK(test 2 -eq "`wc -l