# # # patch "ChangeLog" # from [751a9720e72dd7078011dee1b74f138ffded2d00] # to [2a3f7f5a1c02fdb7e21e9f46b220708b8e6c0596] # # patch "commands.cc" # from [81f2beb1173e9cc60fb3d704e1faced488db536c] # to [efe7626fa7994ffcd89c71dd0bebfabb15d2cde0] # # patch "tests/t_ls_branches.at" # from [31a8e65c7c54f965b6ae75546dd5f69d5140b168] # to [caac8dadea76a6ee60b9a9e11390e0b49fd0251a] # ============================================================ --- ChangeLog 751a9720e72dd7078011dee1b74f138ffded2d00 +++ ChangeLog 2a3f7f5a1c02fdb7e21e9f46b220708b8e6c0596 @@ -1,3 +1,8 @@ +2006-04-11 Timothy Brownawell + + * commands.cc (ls_branches): Allow "ls branches ". + * tests/t_ls_branches.at: Test it. + 2006-04-09 Timothy Brownawell * platform.hh (make_io_binary): new function, turn off textmode ============================================================ --- commands.cc 81f2beb1173e9cc60fb3d704e1faced488db536c +++ commands.cc efe7626fa7994ffcd89c71dd0bebfabb15d2cde0 @@ -1627,12 +1627,20 @@ static void ls_branches(string name, app_state & app, vector const & args) { + utf8 inc("*"); + utf8 exc; + if (args.size() == 1) + inc = idx(args,0); + else if (args.size() > 1) + throw usage(name); + combine_and_check_globish(app.exclude_patterns, exc); + globish_matcher match(inc, exc); vector names; app.db.get_branches(names); sort(names.begin(), names.end()); for (size_t i = 0; i < names.size(); ++i) - if (!app.lua.hook_ignore_branch(idx(names, i))) + if (match(idx(names, i)) && !app.lua.hook_ignore_branch(idx(names, i))) cout << idx(names, i) << endl; } @@ -1869,7 +1877,7 @@ CMD(list, N_("informative"), N_("certs ID\n" "keys [PATTERN]\n" - "branches\n" + "branches [PATTERN]\n" "epochs [BRANCH [...]]\n" "tags\n" "vars [DOMAIN]\n" ============================================================ --- tests/t_ls_branches.at 31a8e65c7c54f965b6ae75546dd5f69d5140b168 +++ tests/t_ls_branches.at caac8dadea76a6ee60b9a9e11390e0b49fd0251a @@ -31,6 +31,16 @@ ]) AT_CHECK(cmp branches stdout,[],[ignore]) +AT_CHECK(MTN ls branches "other*",[0],[stdout],[stderr]) +AT_CHECK(CANONICALISE(stdout)) +AT_DATA(branches2,[otherbranch +]) +AT_CHECK(cmp branches2 stdout,[],[ignore]) + +AT_CHECK(MTN ls branches --exclude "test*",[0],[stdout],[stderr]) +AT_CHECK(CANONICALISE(stdout)) +AT_CHECK(cmp branches2 stdout,[],[ignore]) + # Create an ignore_branch hook to pass in AT_DATA(ignore_branch.lua,[ function ignore_branch(branchname)