monotone

monotone Commit Details

Date:2010-11-19 20:51:39 (8 years 7 months ago)
Author:stephen_leake-2@stephe-leake.org
Branch:net.venge.monotone
Commit:af0b5d1b31f5f340c715c57364d3de5d7fec995f
Parents: 33a6ead1972f65826f5018fbe38d4681207da24a
Message:add default path for 'mtn conflicts resolve_first interactive', also progress messages.

* NEWS:
* monotone.texi (Conflicts):
* cmd_conflicts.cc (set_first_conflict): add default path for 'mtn
conflicts resolve_first interactive', also progress messages.

* paths.hh:
* paths.cc (normalize_external_path): make public

* tests/resolve_conflicts_content/__driver__.lua: test 'interactive'

* tests/resolve_conflicts_content/update-1:
* tests/resolve_conflicts_content/merge-1:
* tests/resolve_conflicts_content/conflicts-2:
* tests/resolve_conflicts_content/conflicts-1: match test changes

* tests/resolve_conflicts_content/conflicts-3: New file.
* tests/resolve_conflicts_content/merge.lua: New file.

* win32/README: fix upload URL
Changes:
Atests/resolve_conflicts_content/conflicts-3 (full)
Atests/resolve_conflicts_content/merge.lua (full)
MNEWS (1 diff)
Mcmd_conflicts.cc (2 diffs)
Mmonotone.texi (1 diff)
Mpaths.cc (1 diff)
Mpaths.hh (1 diff)
Mtests/resolve_conflicts_content/__driver__.lua (4 diffs)
Mtests/resolve_conflicts_content/conflicts-1 (2 diffs)
Mtests/resolve_conflicts_content/conflicts-2 (2 diffs)
Mtests/resolve_conflicts_content/merge-1 (1 diff)
Mtests/resolve_conflicts_content/update-1 (1 diff)
Mwin32/README (1 diff)
Ptests/resolve_conflicts_content/conflicts-3
mtn:execute true
Ptests/resolve_conflicts_content/merge.lua
mtn:execute true

File differences

NEWS
44
55
66
7
8
9
10
711
812
913
Changes
- in 'mtn conflicts resolve_first interactive', the result
file name now defaults to _MTN/resolutions/<left_path>.
Fixes monotone issue 103.
New Features
Bugs fixed
cmd_conflicts.cc
1
1
22
33
44
......
365365
366366
367367
368
369
370
371
372
373
368
374369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
375396
376397
377398
378399
379400
401
380402
403
404
381405
382406
383407
// Copyright (C) 2008, 2009 Stephen Leake <stephen_leake@stephe-leake.org>
// Copyright (C) 2008 - 2010 Stephen Leake <stephen_leake@stephe-leake.org>
//
// This program is made available under the GNU GPL version 2.0 or
// greater. See the accompanying file COPYING for details.
{
if ("interactive" == idx(args,0)())
{
E(args.size() == 2, origin::user,
F("wrong number of arguments"));
E(bookkeeping_path::external_string_is_bookkeeping_path(idx(args,1)),
origin::user,
F("result path must be under _MTN"));
bookkeeping_path const result_path(idx(args,1)(), origin::user);
bookkeeping_path result_path;
switch (args.size())
{
case 1:
// use default path for resolution file
{
file_path left_path;
conflicts.left_roster->get_name(conflict.nid, left_path);
result_path = bookkeeping_path("_MTN/resolutions", origin::internal) / left_path;
}
break;
case 2:
// user path for resolution file
{
string normalized;
normalize_external_path(idx(args,1)(),
normalized,
false); // to_workspace_root
result_path = bookkeeping_path(normalized, origin::user);
}
break;
default:
E(false, origin::user, F("wrong number of arguments"));
}
if (do_interactive_merge(db, lua, conflicts, conflict.nid,
conflict.ancestor, conflict.left, conflict.right, result_path))
{
conflict.resolution.first = resolve_conflicts::content_user;
conflict.resolution.second = boost::shared_ptr<any_path>(new bookkeeping_path(result_path));
P(F("interactive merge result saved in '%s'") % result_path.as_internal());
}
else
P(F("interactive merge failed."));
}
else if ("user" == idx(args,0)())
{
monotone.texi
51665166
51675167
51685168
5169
5169
51705170
51715171
51725172
5173
5173
5174
5175
51745176
51755177
51765178
For single file conflicts, there are several possible resolutions:
@ftable @command
@item interactive @var{file}
@item interactive @var{[file]}
The Lua @code{merge3} hook is called to allow the user to manually
merge the left and right files, leaving the result in the specified file.
@var{file} must be a bookkeeping path; under @file{_MTN}.
@var{file} must be a bookkeeping path; under @file{_MTN}. If not
specified, @var{file} defaults to @file{_MTN/resolutions/<path>},
where @file{<path>} is the path to the file that has the conflict.
This inserts a @var{resolved_user_left file} conflict resolution in the
conflicts file.
paths.cc
345345
346346
347347
348
348
349349
350350
351351
return leader;
}
static void
void
normalize_external_path(string const & path, string & normalized, bool to_workspace_root)
{
if (!initial_rel_path.initialized)
paths.hh
354354
355355
356356
357
358
357359
358360
359361
// for migration
#define old_bookkeeping_root_component (path_component("MT"))
void normalize_external_path(std::string const & path, std::string & normalized, bool to_workspace_root);
// this will always be an absolute path
class system_path : public any_path
{
tests/resolve_conflicts_content/__driver__.lua
55
66
77
8
9
810
911
1012
1113
14
15
1216
1317
1418
1519
1620
1721
22
23
1824
1925
2026
......
2329
2430
2531
32
33
2634
2735
2836
37
38
2939
3040
3141
32
33
42
43
44
45
46
3447
3548
3649
......
3952
4053
4154
42
55
56
57
58
59
60
61
62
63
64
65
66
67
68
4369
4470
4571
......
5076
5177
5278
79
80
5381
mtn_setup()
get("merge.lua")
mkdir("files")
addfile("files/foo", "foo")
addfile("files/bar", "bar\none\ntwo\nthree")
addfile("files/baz", "baz\naaa\nbbb\nccc")
addfile("files/inter1", "inter1\naaa\nbbb\nccc")
addfile("files/inter2", "inter2\naaa\nbbb\nccc")
commit("testbranch", "base")
base = base_revision()
writefile("files/foo", "foo\nfirst\nrevision")
writefile("files/bar", "bar\nzero\none\ntwo\nthree")
writefile("files/baz", "baz\nAAA\nbbb\nccc")
writefile("files/inter1", "inter1\nAAA\nbbb\nccc")
writefile("files/inter2", "inter2\nAAA\nbbb\nccc")
commit("testbranch", "first")
first = base_revision()
writefile("files/foo", "foo\nsecond\nrevision")
writefile("files/bar", "bar\none\ntwo\nthree\nfour")
writefile("files/baz", "baz\nAaa\nbbb\nCCC")
writefile("files/inter1", "inter1\nAaa\nbbb\nccc")
writefile("files/inter2", "inter2\nAaa\nbbb\nccc")
commit("testbranch", "second")
second = base_revision()
-- 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(samefilestd("conflicts-1", "_MTN/conflicts"))
-- foo and baz can't be handled by the internal line merger. We
-- specify one user file in _MTN, one out, to ensure mtn handles both.
-- bar is the first conflict (alphabetical by file name); it is
-- 'resolved_internal'. The rest are not resolved internal.
--
-- For baz and foo, we specify one user file in _MTN, one out, to
-- ensure mtn handles both.
writefile("files/foo", "foo\nmerged\nrevision")
mkdir("_MTN/result")
writefile("_MTN/result/baz", "baz\nAaa\nBbb\nCcc")
check(indir("files", mtn("conflicts", "resolve_first", "user", "foo")), 0, nil, nil)
check(samefilestd("conflicts-2", "_MTN/conflicts"))
check(mtn("merge", "--resolve-conflicts"), 0, nil, true)
-- For inter1, inter2, we use 'interactive', with the default and
-- user-supplied file names. merge.lua overrides the merge hook to
-- just return the left file name as the merge result.
check(indir("files", mtn("--rcfile=../merge.lua", "conflicts", "resolve_first", "interactive")), 0, nil, true)
check(qgrep("interactive merge result saved in '_MTN/resolutions/files/inter1'", "stderr"))
check(indir("files", mtn("--rcfile=../merge.lua", "conflicts", "resolve_first", "interactive", "../_MTN/resolutions/inter_merged")), 0, nil, true)
check(qgrep("interactive merge result saved in '_MTN/resolutions/inter_merged'", "stderr"))
check(samefilestd("conflicts-3", "_MTN/conflicts"))
-- we specified 'first second' on 'conflicts store', so we need it
-- here as well; the default order is different.
check(mtn("explicit_merge", "--resolve-conflicts", first, second, "testbranch"), 0, nil, true)
canonicalize("stderr")
check(samefilestd("merge-1", "stderr"))
check(readfile("files/foo") == "foo\nmerged\nrevision")
check(readfile("files/bar") == "bar\nzero\none\ntwo\nthree\nfour\n")
check(readfile("files/baz") == "baz\nAaa\nBbb\nCcc")
check(readfile("files/inter1") == "files/inter1")
check(readfile("files/inter2") == "files/inter2")
-- end of file
tests/resolve_conflicts_content/conflicts-1
1
2
3
1
2
3
44
55
66
......
2929
3030
3131
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
left [36cfb5960784df07636cc9d119617326fe87c3f6]
right [be155249f011e658f913c109bafd743b1bfea0fe]
ancestor [574e08409c35c5c0eb6e929bf1e3abf49a8bacd4]
left [fe616087506ae4e770e4a51e091e4c338b2f176d]
right [eccae629399090f99632cf9e9cc7156af2d238fb]
ancestor [19451bb6dc1137d540500c63d399bac8babcbe78]
conflict content
node_type "file"
left_file_id [841e3d2ada1a56123f9efe9db0d0c045ff9e6d8f]
right_name "files/foo"
right_file_id [3506995775abf41d3cdeb1e0417bdd3bcf059395]
conflict content
node_type "file"
ancestor_name "files/inter1"
ancestor_file_id [bad8d100ec34a19496dc4f18277334cd7f3ad647]
left_name "files/inter1"
left_file_id [28347eacdbd7d870349c9954a1b6d49d9f1acd8e]
right_name "files/inter1"
right_file_id [d261697ad5379583618ed62a582d513bba79c1fd]
conflict content
node_type "file"
ancestor_name "files/inter2"
ancestor_file_id [a6c0b6bcbb1a10a30372e499126c14c1b170535c]
left_name "files/inter2"
left_file_id [ad2d9c733b3aaea250e88b4869db63baa8a00e8e]
right_name "files/inter2"
right_file_id [8f6b7ea0a3f2dd75a23294069b03268f41974edb]
tests/resolve_conflicts_content/conflicts-2
1
2
3
1
2
3
44
55
66
......
3131
3232
3333
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
left [36cfb5960784df07636cc9d119617326fe87c3f6]
right [be155249f011e658f913c109bafd743b1bfea0fe]
ancestor [574e08409c35c5c0eb6e929bf1e3abf49a8bacd4]
left [fe616087506ae4e770e4a51e091e4c338b2f176d]
right [eccae629399090f99632cf9e9cc7156af2d238fb]
ancestor [19451bb6dc1137d540500c63d399bac8babcbe78]
conflict content
node_type "file"
right_name "files/foo"
right_file_id [3506995775abf41d3cdeb1e0417bdd3bcf059395]
resolved_user_left "files/foo"
conflict content
node_type "file"
ancestor_name "files/inter1"
ancestor_file_id [bad8d100ec34a19496dc4f18277334cd7f3ad647]
left_name "files/inter1"
left_file_id [28347eacdbd7d870349c9954a1b6d49d9f1acd8e]
right_name "files/inter1"
right_file_id [d261697ad5379583618ed62a582d513bba79c1fd]
conflict content
node_type "file"
ancestor_name "files/inter2"
ancestor_file_id [a6c0b6bcbb1a10a30372e499126c14c1b170535c]
left_name "files/inter2"
left_file_id [ad2d9c733b3aaea250e88b4869db63baa8a00e8e]
right_name "files/inter2"
right_file_id [8f6b7ea0a3f2dd75a23294069b03268f41974edb]
tests/resolve_conflicts_content/conflicts-3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
left [fe616087506ae4e770e4a51e091e4c338b2f176d]
right [eccae629399090f99632cf9e9cc7156af2d238fb]
ancestor [19451bb6dc1137d540500c63d399bac8babcbe78]
conflict content
node_type "file"
ancestor_name "files/bar"
ancestor_file_id [fc8a40f0b775e86503c7522399f309f6ac298348]
left_name "files/bar"
left_file_id [bf227d19bccee7740bb58219910ff0930b6200c1]
right_name "files/bar"
right_file_id [5fd4e3cf64e24e969cfcd2380cf244aee9e52d5d]
resolved_internal
conflict content
node_type "file"
ancestor_name "files/baz"
ancestor_file_id [ae708173915e11248629c18d16c96c3a34f87d16]
left_name "files/baz"
left_file_id [c438704db55b0d6f819e7e79c1622e5d757b926b]
right_name "files/baz"
right_file_id [b87f48c43f61d258cc0b12d07bd53a7ddde357a9]
resolved_user_left "_MTN/result/baz"
conflict content
node_type "file"
ancestor_name "files/foo"
ancestor_file_id [0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33]
left_name "files/foo"
left_file_id [841e3d2ada1a56123f9efe9db0d0c045ff9e6d8f]
right_name "files/foo"
right_file_id [3506995775abf41d3cdeb1e0417bdd3bcf059395]
resolved_user_left "files/foo"
conflict content
node_type "file"
ancestor_name "files/inter1"
ancestor_file_id [bad8d100ec34a19496dc4f18277334cd7f3ad647]
left_name "files/inter1"
left_file_id [28347eacdbd7d870349c9954a1b6d49d9f1acd8e]
right_name "files/inter1"
right_file_id [d261697ad5379583618ed62a582d513bba79c1fd]
resolved_user_left "_MTN/resolutions/files/inter1"
conflict content
node_type "file"
ancestor_name "files/inter2"
ancestor_file_id [a6c0b6bcbb1a10a30372e499126c14c1b170535c]
left_name "files/inter2"
left_file_id [ad2d9c733b3aaea250e88b4869db63baa8a00e8e]
right_name "files/inter2"
right_file_id [8f6b7ea0a3f2dd75a23294069b03268f41974edb]
resolved_user_left "_MTN/resolutions/inter_merged"
tests/resolve_conflicts_content/merge-1
1
2
3
4
5
1
2
63
74
85
9
6
7
8
109
mtn: 2 heads on branch 'testbranch'
mtn: merge 1 / 1:
mtn: calculating best pair of heads to merge next
mtn: [left] 36cfb5960784df07636cc9d119617326fe87c3f6
mtn: [right] be155249f011e658f913c109bafd743b1bfea0fe
mtn: [left] fe616087506ae4e770e4a51e091e4c338b2f176d
mtn: [right] eccae629399090f99632cf9e9cc7156af2d238fb
mtn: merged files/bar, files/bar
mtn: replacing content of files/baz, files/baz with _MTN/result/baz
mtn: replacing content of files/foo, files/foo with files/foo
mtn: [merged] d18cecd65445fa5b10732c6ca8a8bbdac2a6610a
mtn: replacing content of files/inter1, files/inter1 with _MTN/resolutions/files/inter1
mtn: replacing content of files/inter2, files/inter2 with _MTN/resolutions/inter_merged
mtn: [merged] bd6a2c0363cab1cf19220bce150c77b84b1a5a32
mtn: note: your workspace has not been updated
tests/resolve_conflicts_content/merge.lua
1
2
3
4
5
function merge3 (ancestor, left, right)
-- just return the name of the left file as the merge contents;
-- enough to prove this hook was called.
return left
end
tests/resolve_conflicts_content/update-1
11
2
3
4
2
3
4
55
66
7
7
8
9
mtn: updating along branch 'testbranch'
mtn: selected update target d18cecd65445fa5b10732c6ca8a8bbdac2a6610a
mtn: [left] e9d684d80d320d181793766e43a2feb525d254f8
mtn: [right] d18cecd65445fa5b10732c6ca8a8bbdac2a6610a
mtn: selected update target bd6a2c0363cab1cf19220bce150c77b84b1a5a32
mtn: [left] a047a11aae2e43f05171d8ffd8bbfde054f8a4f5
mtn: [right] bd6a2c0363cab1cf19220bce150c77b84b1a5a32
mtn: updating files/bar
mtn: updating files/baz
mtn: updated to base revision d18cecd65445fa5b10732c6ca8a8bbdac2a6610a
mtn: updating files/inter1
mtn: updating files/inter2
mtn: updated to base revision bd6a2c0363cab1cf19220bce150c77b84b1a5a32
win32/README
3535
3636
3737
38
38
3939
4040
Publish the binary on the monotone website with proper permissions:
chmod a+r monotone-<version>-setup.exe
scp -p monotone-<version>-setup.exe mtn-uploads@monotone.ca:~/<version>
scp -p monotone-<version>-setup.exe mtn-uploads@monotone.ca:<version>
Download from the web and test, both the installed mtn and the documentation.

Archive Download the corresponding diff file

Branches

Tags

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