#
#
# patch "ChangeLog"
# from [a7881c874204701800cd0878af8daa6eae7c3dae]
# to [3ce6a9b7c2a6e0040ae0eec5d6253ca46cb77b20]
#
# patch "commands.cc"
# from [56402af73e434e13767e819a3768d8a48d2bf155]
# to [15afd8ac3ced9888561297092a553a9eace20d58]
#
# patch "tests/t_log_selectors.at"
# from [065aef2750178115bdae3224253d1ded604887cb]
# to [3d000a79a2acdff3df5c7a8a804d2e38aa035dc5]
#
============================================================
--- ChangeLog a7881c874204701800cd0878af8daa6eae7c3dae
+++ ChangeLog 3ce6a9b7c2a6e0040ae0eec5d6253ca46cb77b20
@@ -1,5 +1,12 @@
2006-02-23 Matthew Gregan
+ * tests/t_log_selectors.at: UnXFAIL.
+
+ * commands.cc (complete): Refactor selector completion to enable
+ return of single or sets of completed revisions.
+ (CMD(log)): Do something sensible with selectors that return
+ multiple revisions.
+
* tests/t_log_selectors.at: XFAILed test for bug #15877.
* testsuite.at: Add it.
============================================================
--- commands.cc 56402af73e434e13767e819a3768d8a48d2bf155
+++ commands.cc 15afd8ac3ced9888561297092a553a9eace20d58
@@ -461,10 +461,11 @@
return description;
}
+
static void
complete(app_state & app,
string const & str,
- revision_id & completion,
+ set & completion,
bool must_exist=true)
{
// This copies the start of selectors::parse_selector().to avoid
@@ -475,10 +476,10 @@
if (str.find_first_not_of(constants::legal_id_bytes) == string::npos
&& str.size() == constants::idlen)
{
- completion = revision_id(str);
+ completion.insert(revision_id(str));
if (must_exist)
- N(app.db.revision_exists(completion),
- F("no such revision '%s'") % completion);
+ N(app.db.revision_exists(*completion.begin()),
+ F("no such revision '%s'") % *completion.begin());
return;
}
@@ -494,16 +495,36 @@
N(completions.size() != 0,
F("no match for selection '%s'") % str);
+
+ for (set::const_iterator i = completions.begin();
+ i != completions.end(); ++i)
+ {
+ pair::const_iterator, bool> p = completion.insert(revision_id(*i));
+ P(F("expanded to '%s'\n") % *(p.first));
+ }
+}
+
+
+static void
+complete(app_state & app,
+ string const & str,
+ revision_id & completion,
+ bool must_exist=true)
+{
+ set completions;
+
+ complete(app, str, completions, must_exist);
+
if (completions.size() > 1)
{
string err = (F("selection '%s' has multiple ambiguous expansions: \n") % str).str();
- for (set::const_iterator i = completions.begin();
+ for (set::const_iterator i = completions.begin();
i != completions.end(); ++i)
- err += (describe_revision(app, revision_id(*i)) + "\n");
+ err += (describe_revision(app, *i) + "\n");
N(completions.size() == 1, i18n_format(err));
}
- completion = revision_id(*(completions.begin()));
- P(F("expanded to '%s'\n") % completion);
+
+ completion = *completions.begin();
}
@@ -3558,11 +3579,11 @@
for (std::vector::const_iterator i = app.revision_selectors.begin();
i != app.revision_selectors.end(); i++)
{
- revision_id rid;
- complete(app, (*i)(), rid);
- frontier.insert(rid);
+ set rids;
+ complete(app, (*i)(), rids);
+ frontier.insert(rids.begin(), rids.end());
if (i == app.revision_selectors.begin())
- first_rid = rid;
+ first_rid = *rids.begin();
}
}
============================================================
--- tests/t_log_selectors.at 065aef2750178115bdae3224253d1ded604887cb
+++ tests/t_log_selectors.at 3d000a79a2acdff3df5c7a8a804d2e38aa035dc5
@@ -1,10 +1,8 @@
AT_SETUP([log and selectors returning multiple rids])
MONOTONE_SETUP
-# an xfailed testcase for bug #15877
+# testcase for bug #15877
-AT_XFAIL_IF(true)
-
ADD_FILE(testfile, [blah blah
])
AT_CHECK(MONOTONE commit -b testbranch --date "2005-08-16T03:16:00" -m foo, [], [ignore], [ignore])