# # # patch "cmd_conflicts.cc" # from [e024806a8cf16675a1dfa7c1dca4464c3e6d0054] # to [9aa0ed528a8ce15ffe0aa7399df492c106f55365] # # patch "tests/resolve_conflicts_errors/__driver__.lua" # from [db22998c9bfcef5bf298a8a923f546077855c5a6] # to [736f31939a9ede1735ac142306f8807072ad0294] # ============================================================ --- cmd_conflicts.cc e024806a8cf16675a1dfa7c1dca4464c3e6d0054 +++ cmd_conflicts.cc 9aa0ed528a8ce15ffe0aa7399df492c106f55365 @@ -289,12 +289,11 @@ set_first_conflict(database & db, { if ("interactive" == idx(args,0)()) { + N(args.size() == 2, F("wrong number of arguments")); N(bookkeeping_path::external_string_is_bookkeeping_path(utf8(idx(args,1)())), F("result path must be under _MTN")); bookkeeping_path const result_path(idx(args,1)()); - N(args.size() == 2, F("wrong number of arguments")); - if (do_interactive_merge(db, lua, conflicts, conflict.nid, conflict.ancestor, conflict.left, conflict.right, result_path)) { @@ -352,6 +351,7 @@ CMD(show_first, "show_first", "", CMD_RE database db(app); conflicts_t conflicts (db, app.opts.conflicts_file); + N(args.size() == 0, F("wrong number of arguments")); show_conflicts(db, conflicts, first); } @@ -364,6 +364,7 @@ CMD(show_remaining, "show_remaining", "" database db(app); conflicts_t conflicts (db, app.opts.conflicts_file); + N(args.size() == 0, F("wrong number of arguments")); show_conflicts(db, conflicts, remaining); } ============================================================ --- tests/resolve_conflicts_errors/__driver__.lua db22998c9bfcef5bf298a8a923f546077855c5a6 +++ tests/resolve_conflicts_errors/__driver__.lua 736f31939a9ede1735ac142306f8807072ad0294 @@ -18,14 +18,24 @@ right_1 = base_revision() commit("testbranch", "right 1") right_1 = base_revision() +-- invalid number of parameters for 'store' +check(mtn("conflicts", "store", left_1), 1, nil, true) +check(mtn("conflicts", "store", left_1, right_1, right_1), 1, nil, true) + check(mtn("conflicts", "store", left_1, right_1), 0, nil, true) canonicalize("stderr") check(samefilestd("conflicts-attr-store-1", "stderr")) +check(mtn("conflicts", "show_remaining", "foo"), 1, nil, true) +check(qgrep("wrong number of arguments", "stderr")) + check(mtn("conflicts", "show_remaining"), 0, nil, true) canonicalize("stderr") check(samefilestd("conflicts-attr-show-1", "stderr")) +check(mtn("conflicts", "show_first", "foo"), 1, nil, true) +check(qgrep("wrong number of arguments", "stderr")) + check(mtn("conflicts", "show_first"), 0, nil, true) canonicalize("stderr") check(samefilestd("conflicts-attr-show-2", "stderr")) @@ -62,6 +72,16 @@ check(mtn("conflicts", "store"), 0, true check(mtn("conflicts", "store"), 0, true, nil) +-- invalid number of params +check(mtn("conflicts", "resolve_first_left", "user"), 1, nil, true) +check(qgrep("wrong number of arguments", "stderr")) +check(mtn("conflicts", "resolve_first_left", "user", "checkout.sh", "foo"), 1, nil, true) +check(qgrep("wrong number of arguments", "stderr")) +check(mtn("conflicts", "resolve_first_right", "user"), 1, nil, true) +check(qgrep("wrong number of arguments", "stderr")) +check(mtn("conflicts", "resolve_first_right", "user", "checkout.sh", "foo"), 1, nil, true) +check(qgrep("wrong number of arguments", "stderr")) + -- both sides specify user file check(mtn("conflicts", "resolve_first_left", "user", "checkout.sh"), 0, nil, nil) check(mtn("conflicts", "resolve_first_right", "user", "checkout.sh"), 1, nil, true)