#
#
# patch "ChangeLog"
# from [b0ae4b41d3d703bb154becfd5800bcd489ebac3d]
# to [581f9d8d9742b61cc8e3e48c1d27500a869bfd85]
#
# patch "cmd_merging.cc"
# from [5b938e9490b4d30b4db85fd893d7049798452b04]
# to [83b6e63909346e8be0d9ab2d748ef5d102c75da6]
#
# patch "tests/t_update_off_branch.at"
# from [f4621ad8f41fe39c125e95b0b6dc7a03b9d700f8]
# to [b1583db803c2fcbd42f7990ca5427ee7cdc32475]
#
# patch "ui.cc"
# from [e3911a0054262d5b445af1a5e66ab699faeab8eb]
# to [745a3861497007c7b45e3fc44ec8145b3036ba32]
#
============================================================
--- ChangeLog b0ae4b41d3d703bb154becfd5800bcd489ebac3d
+++ ChangeLog 581f9d8d9742b61cc8e3e48c1d27500a869bfd85
@@ -1,3 +1,11 @@
+2006-05-01 Nathaniel Smith
+
+ * cmd_merging.cc (update): Hopefully clarify messages in the
+ different cases where target branch differs from current branch.
+ * tests/t_update_off_branch.at: Test all paths.
+ * ui.cc (warn): Use prefix_lines_with and mark "warning:" for
+ translation.
+
2006-05-01 Matthew Gregan
* win32/terminal.cc (have_smart_terminal): Simplify smart terminal
============================================================
--- cmd_merging.cc 5b938e9490b4d30b4db85fd893d7049798452b04
+++ cmd_merging.cc 83b6e63909346e8be0d9ab2d748ef5d102c75da6
@@ -140,27 +140,29 @@
}
else
{
+ P(F("target revision is not in current branch"));
if (branches.size() > 1)
{
// multiple non-matching branchnames
string branch_list;
for (set::const_iterator i = branches.begin();
i != branches.end(); i++)
- branch_list += "\n" + (*i)();
- N(false, F("revision %s is a member of multiple branches:\n%s\n\ntry again with explicit --branch") % r_chosen_id % branch_list);
+ branch_list += "\n " + (*i)();
+ N(false, F("target revision is in multiple branches:%s\n\n"
+ "try again with explicit --branch") % branch_list);
}
else if (branches.size() == 1)
{
// one non-matching, inform and update
app.branch_name = (*(branches.begin()))();
- P(F("revision %s is a member of\n%s, updating workspace branch")
- % r_chosen_id % app.branch_name());
+ P(F("switching branches; next commit will use branch %s") % app.branch_name());
}
else
{
I(branches.size() == 0);
- W(F("revision %s is a member of no branches,\nusing branch %s for workspace")
- % r_chosen_id % app.branch_name());
+ W(F("target revision not in any branch\n"
+ "next commit will use branch %s")
+ % app.branch_name());
}
}
}
============================================================
--- tests/t_update_off_branch.at f4621ad8f41fe39c125e95b0b6dc7a03b9d700f8
+++ tests/t_update_off_branch.at b1583db803c2fcbd42f7990ca5427ee7cdc32475
@@ -11,8 +11,38 @@
COMMIT(otherbranch)
OR=`BASE_REVISION`
+SET_FILE(testfile, [third third
+])
+COMMIT(somebranch)
+SR=`BASE_REVISION`
+AT_CHECK(MTN cert $SR branch otherbranch, [], [ignore], [ignore])
+
+SET_FILE(testfile, [double double
+])
+COMMIT(nobranch)
+NR=`BASE_REVISION`
+AT_CHECK(MTN db kill_branch_certs_locally nobranch)
+
AT_CHECK(MTN checkout --branch=testbranch --revision=$TR codir, [], [ignore], [ignore])
+AT_CHECK(grep '^ *branch "testbranch"' codir/_MTN/options, [], [ignore], [ignore])
+# make sure that updating to a rev in one other branch puts us in that branch
AT_CHECK(cd codir && MTN update --revision=$OR, [], [ignore], [ignore])
-AT_CHECK(grep '^ *branch "otherbranch"' _MTN/options, [], [ignore], [ignore])
+AT_CHECK(grep '^ *branch "otherbranch"' codir/_MTN/options, [], [ignore], [ignore])
+# updating to a rev in multiple branches, including current branch, leaves branch alone
+AT_CHECK(cd codir && MTN update -r $SR, [], [ignore], [ignore])
+AT_CHECK(grep '^ *branch "otherbranch"' codir/_MTN/options, [], [ignore], [ignore])
+
+# but updating to a rev in multiple branches that _don't_ include the current one, fails
+# first go back out to TR
+AT_CHECK(cd codir && MTN update -r $TR, [], [ignore], [ignore])
+AT_CHECK(grep '^ *branch "testbranch"' codir/_MTN/options, [], [ignore], [ignore])
+# and now jumping to SR directly should fail
+AT_CHECK(cd codir && MTN update -r $SR, [1], [ignore], [ignore])
+AT_CHECK(grep '^ *branch "testbranch"' codir/_MTN/options, [], [ignore], [ignore])
+
+# updating to a rev in no branches at all succeeds, and leaves current branch alone
+AT_CHECK(cd codir && MTN update -r $NR, [], [ignore], [ignore])
+AT_CHECK(grep '^ *branch "testbranch"' codir/_MTN/options, [], [ignore], [ignore])
+
AT_CLEANUP
============================================================
--- ui.cc e3911a0054262d5b445af1a5e66ab699faeab8eb
+++ ui.cc 745a3861497007c7b45e3fc44ec8145b3036ba32
@@ -398,7 +398,11 @@
user_interface::warn(string const & warning)
{
if (issued_warnings.find(warning) == issued_warnings.end())
- inform("warning: " + warning);
+ {
+ std::string message;
+ prefix_lines_with(_("warning: "), warning, message);
+ inform(message);
+ }
issued_warnings.insert(warning);
}