monotone

monotone Commit Details

Date:2010-11-20 02:07:14 (8 years 6 months ago)
Author:stephen_leake-2@stephe-leake.org
Branch:net.venge.monotone
Commit:c26b91d1884512efa7adf1b209f207d142c03606
Parents: 0441b58e2b76c2aac899688f2feebc6ebd064268
Message:show_conflicts: output summary for non-automate

* NEWS: note change

* cmd_merging.cc (show_conflicts_core): output summary for non-automate
(CMD store): output summary

* merge_roster.hh:
* merge_roster.cc (count_supported_resolution): new

* tests/resolve_conflicts_all_resolutions/__driver__.lua:
* tests/resolve_conflicts_content/__driver__.lua:
* tests/resolve_conflicts_duplicate_name/__driver__.lua:
* tests/resolve_conflicts_duplicate_name_directory/__driver__.lua:
* tests/resolve_conflicts_errors/__driver__.lua:
* tests/resolve_conflicts_errors/conflicts-attr-store-1:
* tests/resolve_conflicts_multiple_names/__driver__.lua:
* tests/resolve_conflicts_none/__driver__.lua:
* tests/resolve_conflicts_orphaned_file/__driver__.lua:
* tests/resolve_conflicts_propagate/__driver__.lua: check summary
Changes:
MNEWS (1 diff)
Mcmd_merging.cc (6 diffs)
Mmerge_roster.cc (2 diffs)
Mmerge_roster.hh (2 diffs)
Mtests/resolve_conflicts_all_resolutions/__driver__.lua (2 diffs)
Mtests/resolve_conflicts_content/__driver__.lua (1 diff)
Mtests/resolve_conflicts_duplicate_name/__driver__.lua (1 diff)
Mtests/resolve_conflicts_duplicate_name_directory/__driver__.lua (2 diffs)
Mtests/resolve_conflicts_errors/__driver__.lua (2 diffs)
Mtests/resolve_conflicts_errors/conflicts-attr-store-1 (1 diff)
Mtests/resolve_conflicts_multiple_names/__driver__.lua (1 diff)
Mtests/resolve_conflicts_none/__driver__.lua (1 diff)
Mtests/resolve_conflicts_orphaned_file/__driver__.lua (2 diffs)
Mtests/resolve_conflicts_propagate/__driver__.lua (2 diffs)

File differences

NEWS
1010
1111
1212
13
14
15
16
1317
1418
1519
New Features
- 'mtn conflicts store' now outputs a count of the conflicts,
and the name of the conflicts file. Fixes monotone issue
108.
Bugs fixed
- improve help, fix arg indexing in 'conflicts resolve_first'
cmd_merging.cc
966966
967967
968968
969
969
970970
971971
972972
......
10371037
10381038
10391039
1040
1041
1040
1041
1042
10421043
10431044
10441045
......
10681069
10691070
10701071
1071
1072
10721073
1073
1074
1074
1075
1076
1077
1078
1079
1080
1081
10751082
10761083
1077
1084
10781085
10791086
10801087
......
10941101
10951102
10961103
1097
1104
1105
1106
1107
10981108
10991109
11001110
......
11591169
11601170
11611171
1162
1172
1173
1174
1175
11631176
11641177
11651178
......
11791192
11801193
11811194
1182
1195
1196
1197
1198
11831199
11841200
11851201
1202
11861203
11871204
11881205
revision_id const & l_id,
revision_id const & r_id,
bool const basic_io,
bool warn_unsupported,
bool automate,
std::ostream & output)
{
// Note that left and right are in the order specified on the command line.
pr.print_stanza(st);
output.write(pr.buf.data(), pr.buf.size());
}
else
P(F("no conflicts detected"));
if (!automate)
P(F("0 conflicts"));
}
else
{
result.report_attribute_conflicts(*l_roster, *r_roster, adaptor, basic_io, output);
result.report_file_content_conflicts(lua, *l_roster, *r_roster, adaptor, basic_io, output);
if (warn_unsupported)
if (!automate)
{
int const count = result.count_unsupported_resolution();
if (count > 0)
int const supported = result.count_supported_resolution();
int const unsupported = result.count_unsupported_resolution();
P(FP("%d conflict with supported resolutions.",
"%d conflicts with supported resolutions.",
supported) % supported);
if (unsupported > 0)
P(FP("warning: %d conflict with no supported resolutions.",
"warning: %d conflicts with no supported resolutions.",
count) % count);
unsupported) % unsupported);
}
}
}
complete(app.opts, app.lua, project, idx(args,0)(), l_id);
complete(app.opts, app.lua, project, idx(args,1)(), r_id);
show_conflicts_core(db, app.lua, l_id, r_id, false, false, std::cout);
show_conflicts_core(db, app.lua, l_id, r_id,
false, // basic_io
false, // automate
std::cout);
}
static void get_conflicts_rids(args_vector const & args,
revision_id l_id, r_id;
get_conflicts_rids(args, db, project, app, l_id, r_id);
show_conflicts_core(db, app.lua, l_id, r_id, true, false, output);
show_conflicts_core(db, app.lua, l_id, r_id,
true, // basic_io
true, // automate
output);
}
CMD(store, "store", "", CMD_REF(conflicts),
get_conflicts_rids(args, db, project, app, left_id, right_id);
std::ostringstream output;
show_conflicts_core(db, app.lua, left_id, right_id, true, true, output);
show_conflicts_core(db, app.lua, left_id, right_id,
true, // basic_io
false, // automate
output);
data dat(output.str(), origin::internal);
write_data(app.opts.conflicts_file, dat);
P(F("stored in '%s'") % app.opts.conflicts_file);
}
CMD_AUTOMATE(file_merge, N_("LEFT_REVID LEFT_FILENAME RIGHT_REVID RIGHT_FILENAME"),
merge_roster.cc
1
1
22
33
44
......
180180
181181
182182
183
184
185
186
187
188
189
190
183191
184192
185193
// Copyright (C) 2008 Stephen Leake <stephen_leake@stephe-leake.org>
// Copyright (C) 2008, 2010 Stephen Leake <stephen_leake@stephe-leake.org>
// 2005 Nathaniel Smith <njs@pobox.com>
//
// This program is made available under the GNU GPL version 2.0 or
}
int
roster_merge_result::count_supported_resolution() const
{
return orphaned_node_conflicts.size()
+ file_content_conflicts.size()
+ duplicate_name_conflicts.size();
}
int
roster_merge_result::count_unsupported_resolution() const
{
return (missing_root_conflict ? 1 : 0)
merge_roster.hh
1
1
22
33
44
......
187187
188188
189189
190
190191
191192
192193
// Copyright (C) 2005 Nathaniel Smith <njs@pobox.com>
// Copyright (C) 2005, 2010 Nathaniel Smith <njs@pobox.com>
// 2008, 2009 Stephen Leake <stephen_leake@stephe-leake.org>
//
// This program is made available under the GNU GPL version 2.0 or
bool is_clean() const;
bool has_content_conflicts() const;
bool has_non_content_conflicts() const;
int count_supported_resolution() const;
int count_unsupported_resolution() const;
void log_conflicts() const;
tests/resolve_conflicts_all_resolutions/__driver__.lua
6363
6464
6565
66
66
67
68
6769
6870
6971
......
120122
121123
122124
123
125
124126
125127
126128
-- Test non-default conflicts file name
mkdir("resolutions")
check (mtn("conflicts", "--conflicts-file=_MTN/conflicts-1", "store", abe_1, beth_1), 0, nil, nil)
check (mtn("conflicts", "--conflicts-file=_MTN/conflicts-1", "store", abe_1, beth_1), 0, nil, true)
check(samelines("stderr", {"mtn: 8 conflicts with supported resolutions.",
"mtn: stored in '_MTN/conflicts-1'"}))
check(samefilestd("conflicts-1", "_MTN/conflicts-1"))
check(mtn("conflicts", "--conflicts-file=_MTN/conflicts-1", "show_remaining"), 0, nil, true)
check(samefilestd("show_first-interactive", "stderr"))
mkdir("_MTN/resolutions")
check(mtn("--rcfile=merge3_hook.lua", "conflicts", "--conflicts-file=_MTN/conflicts-1", "resolve_first", "interactive", "_MTN/resolutions/interactive_file"), 0, true, true)
check(mtn("--rcfile=merge3_hook.lua", "conflicts", "--conflicts-file=_MTN/conflicts-1", "resolve_first", "interactive", "_MTN/resolutions/interactive_file"), 0, nil, true)
check(samelines("stderr", { "mtn: lua: running merge3 hook",
"mtn: interactive merge result saved in '_MTN/resolutions/interactive_file'"}))
tests/resolve_conflicts_content/__driver__.lua
3636
3737
3838
39
39
40
41
42
4043
4144
4245
-- We specify 'first second' so the left/right don't change as when we
-- make small changes to the test (default order is alphabetical rev id).
check(indir("files", mtn("conflicts", "store", first, second)), 0, nil, nil)
check(indir("files", mtn("conflicts", "store", first, second)), 0, nil, true)
check(samelines("stderr",
{"mtn: 5 conflicts with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
check(samefilestd("conflicts-1", "_MTN/conflicts"))
-- invalid resolution identifier
tests/resolve_conflicts_duplicate_name/__driver__.lua
4444
4545
4646
47
47
48
49
4850
4951
5052
-- For thermostat.c, she specifies a conflict resolution that renames
-- both versions.
check(mtn("conflicts", "store"), 0, true, nil)
check(mtn("conflicts", "store"), 0, nil, true)
check(samelines("stderr", {"mtn: 2 conflicts with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
check(samefilestd("conflicts-1", "_MTN/conflicts"))
-- Find out what the first unresolved conflict is
tests/resolve_conflicts_duplicate_name_directory/__driver__.lua
2525
2626
2727
28
28
29
30
2931
3032
3133
......
4042
4143
4244
43
45
46
47
4448
4549
4650
beth_1 = base_revision()
-- Resolve conflict
check(mtn("conflicts", "store"), 0, true, nil)
check(mtn("conflicts", "store"), 0, false, true)
check(samelines("stderr", {"mtn: 1 conflict with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
check(mtn("conflicts", "show_first"), 0, nil, true)
check(qgrep("duplicate_name gui", "stderr"))
-- Start again, use renames for both sides
check(mtn("conflicts", "clean"), 0, nil, true)
check(mtn("conflicts", "store"), 0, true, nil)
check(mtn("conflicts", "store"), 0, nil, true)
check(samelines("stderr", {"mtn: 1 conflict with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
check(mtn("conflicts", "show_first"), 0, nil, true)
check(qgrep("duplicate_name gui", "stderr"))
tests/resolve_conflicts_errors/__driver__.lua
2222
2323
2424
25
2526
2627
2728
......
7273
7374
7475
75
76
77
78
7679
7780
7881
check(mtn("conflicts", "store", left_1), 1, nil, true)
check(mtn("conflicts", "store", left_1, right_1, right_1), 1, nil, true)
-- success
check(mtn("conflicts", "store", left_1, right_1), 0, nil, true)
canonicalize("stderr")
check(samefilestd("conflicts-attr-store-1", "stderr"))
addfile("checkout.sh", "checkout.sh left 1")
commit("testbranch", "left 2")
check(mtn("conflicts", "store"), 0, true, nil)
check(mtn("conflicts", "store"), 0, nil, true)
check(samelines("stderr", {"mtn: 1 conflict with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
-- invalid number of params
check(mtn("conflicts", "resolve_first_left", "user"), 1, nil, true)
tests/resolve_conflicts_errors/conflicts-attr-store-1
1
12
3
mtn: 0 conflicts with supported resolutions.
mtn: warning: 1 conflict with no supported resolutions.
mtn: stored in '_MTN/conflicts'
tests/resolve_conflicts_multiple_names/__driver__.lua
2525
2626
2727
28
29
28
29
30
3031
31
3232
right_1 = base_revision()
check(mtn("conflicts", "store"), 0, nil, true)
canonicalize("stderr")
check("mtn: warning: 1 conflict with no supported resolutions.\n" == readfile("stderr"))
check(samelines("stderr", {"mtn: 1 conflict with supported resolutions.",
"mtn: warning: 1 conflict with no supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
-- mtn("conflicts", "show_first")
-- end of file
tests/resolve_conflicts_none/__driver__.lua
2020
2121
2222
23
23
24
25
2426
2527
2628
commit("testbranch", "second")
second = base_revision()
check(mtn("conflicts", "store"), 0, nil, nil)
check(mtn("conflicts", "store"), 0, nil, true)
check(samelines("stderr", {"mtn: 0 conflicts",
"mtn: stored in '_MTN/conflicts'"}))
check(samefilestd("conflicts-1", "_MTN/conflicts"))
check(mtn("conflicts", "show_first"), 0, nil, true)
tests/resolve_conflicts_orphaned_file/__driver__.lua
2626
2727
2828
29
29
30
31
3032
3133
3234
33
34
35
36
37
38
35
36
37
38
3939
4040
4141
......
7979
8080
8181
82
82
83
84
8385
8486
8587
commit("testbranch", "left 1")
left_1 = base_revision()
check(mtn("conflicts", "store"), 0, nil, nil)
check(mtn("conflicts", "store"), 0, nil, true)
check(samelines("stderr", {"mtn: 5 conflicts with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
-- Check suggested resolutions for orphaned directory
check(mtn("conflicts", "show_first"), 0, nil, true)
canonicalize("stderr")
check(
"mtn: orphaned node stuff/dir1\n" ..
"mtn: possible resolutions:\n" ..
"mtn: resolve_first drop\n" ..
"mtn: resolve_first rename \"file_name\"\n" == readfile("stderr"))
check(samelines("stderr", {"mtn: orphaned node stuff/dir1",
"mtn: possible resolutions:",
"mtn: resolve_first drop",
"mtn: resolve_first rename \"file_name\""}))
-- invalid resolution identifier
check(mtn("conflicts", "resolve_first", "foo"), 1, nil, true)
right_2 = base_revision()
-- and now we start the resolution process over again
check(mtn("conflicts", "store"), 0, nil, nil)
check(mtn("conflicts", "store"), 0, nil, true)
check(samelines("stderr", {"mtn: 5 conflicts with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
check(mtn("conflicts", "show_first"), 0, nil, true)
check(qgrep("orphaned node stuff/dir1", "stderr"));
check(mtn("conflicts", "resolve_first", "rename", "dir1"), 0, nil, nil)
tests/resolve_conflicts_propagate/__driver__.lua
3030
3131
3232
33
33
34
35
3436
3537
3638
......
6365
6466
6567
66
68
69
70
6771
6872
6973
-- Propagate abe_branch to beth_branch
check(mtn("conflicts", "store", abe_1, beth_1), 0, true, nil)
check(mtn("conflicts", "store", abe_1, beth_1), 0, nil, true)
check(samelines("stderr", {"mtn: 2 conflicts with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
check(samefilestd("conflicts-1", "_MTN/conflicts"))
check(mtn("conflicts", "resolve_first_left", "drop"), 0, nil, nil)
canonicalize("stdout")
check(samefilestd("conflicts-2", "stdout"))
check(mtn("conflicts", "store", beth_1, abe_1), 0, nil, nil)
check(mtn("conflicts", "store", beth_1, abe_1), 0, nil, true)
check(samelines("stderr", {"mtn: 2 conflicts with supported resolutions.",
"mtn: stored in '_MTN/conflicts'"}))
check(samefilestd("conflicts-2", "_MTN/conflicts"))
check(mtn("propagate", "beth_branch", "abe_branch"), 0, nil, true)

Archive Download the corresponding diff file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status