[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone: af0b5d1b31f5f340c715c57364
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone: af0b5d1b31f5f340c715c57364d3de5d7fec995f |
Date: |
Sat, 20 Nov 2010 01:08:52 GMT |
revision: af0b5d1b31f5f340c715c57364d3de5d7fec995f
date: 2010-11-19T19:51:39
author: address@hidden
branch: net.venge.monotone
changelog:
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
manifest:
format_version "1"
new_manifest [f7615a78f3a2a8171d704f6544406cd700e7e2d4]
old_revision [33a6ead1972f65826f5018fbe38d4681207da24a]
add_file "tests/resolve_conflicts_content/conflicts-3"
content [9de0da17483ea43b23944ec8e175659c4199bcc5]
add_file "tests/resolve_conflicts_content/merge.lua"
content [caaa25ce21f6cb7a12d24e442c728796a350a207]
patch "NEWS"
from [54f6f6f9977e74124c61714b66ee8d4ed14a1158]
to [74bdf628c944221412f4acba031341616cc660ba]
patch "cmd_conflicts.cc"
from [17a90f031a297292508aff6bb4ae9113eedc0f1f]
to [c9d3ecf7590fbe2436adb5b33813906aa8e4f53a]
patch "monotone.texi"
from [59a2256544032fa8597ab23f964232a0b66f75d4]
to [fcbb03be116d85a953e1075fd67b3e779b7e3c01]
patch "paths.cc"
from [e6b106e1074a0547c4f4c99b8aa87f233ad9e299]
to [c724539af68eb71b98431d565eade79c2dcadf15]
patch "paths.hh"
from [b2dbcce45edb5e8f882948c1ceb6452083604b34]
to [52cf28b7d0b27dc3dcc58086196d682c73129c8d]
patch "tests/resolve_conflicts_content/__driver__.lua"
from [765e3324aa792233c9aff67c452731295c929c46]
to [7912acb9ca5802127db04a8f41a339836e565415]
patch "tests/resolve_conflicts_content/conflicts-1"
from [97fe0c8dfc0a80ab005b6799ed04a949eebad177]
to [dc427145229cbd25860b9fb79ae714f4525451c5]
patch "tests/resolve_conflicts_content/conflicts-2"
from [9dbe490ea9bae5cac631c4e445c84048a57ca89b]
to [7201ad336999c4df2fcbf29da4fbf4f23f1a6a36]
patch "tests/resolve_conflicts_content/merge-1"
from [eaae4c9145e686cd082dea54e19d6554363aaa29]
to [ee763684ea041eb0f99b496fa3c75a94b32add4e]
patch "tests/resolve_conflicts_content/update-1"
from [bf2839ab5ecb18963df0ed50fa3545ff359b2fac]
to [2db72e362d04f0510378fc7b364d9cc6d1bc7e9f]
patch "win32/README"
from [9683d80a2134629236725419a2bf59908d66769b]
to [6ce0e6b83b446a50ba05afee29916d0676861f03]
set "tests/resolve_conflicts_content/conflicts-3"
attr "mtn:execute"
value "true"
set "tests/resolve_conflicts_content/merge.lua"
attr "mtn:execute"
value "true"
============================================================
--- NEWS 54f6f6f9977e74124c61714b66ee8d4ed14a1158
+++ NEWS 74bdf628c944221412f4acba031341616cc660ba
@@ -4,6 +4,10 @@ XXX XXX XX XX:XX:XX UTC 2010
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
============================================================
--- monotone.texi 59a2256544032fa8597ab23f964232a0b66f75d4
+++ monotone.texi fcbb03be116d85a953e1075fd67b3e779b7e3c01
@@ -5166,11 +5166,13 @@ @subheading Single file conflict resolut
For single file conflicts, there are several possible resolutions:
@ftable @command
address@hidden interactive @var{file}
address@hidden 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.
address@hidden must be a bookkeeping path; under @file{_MTN}.
address@hidden 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.
============================================================
--- win32/README 9683d80a2134629236725419a2bf59908d66769b
+++ win32/README 6ce0e6b83b446a50ba05afee29916d0676861f03
@@ -35,6 +35,6 @@ chmod a+r monotone-<version>-setup.exe
Publish the binary on the monotone website with proper permissions:
chmod a+r monotone-<version>-setup.exe
-scp -p monotone-<version>-setup.exe address@hidden:~/<version>
+scp -p monotone-<version>-setup.exe address@hidden:<version>
Download from the web and test, both the installed mtn and the documentation.
============================================================
--- paths.cc e6b106e1074a0547c4f4c99b8aa87f233ad9e299
+++ paths.cc c724539af68eb71b98431d565eade79c2dcadf15
@@ -345,7 +345,7 @@ normalize_path(string const & in)
return leader;
}
-static void
+void
normalize_external_path(string const & path, string & normalized, bool to_workspace_root)
{
if (!initial_rel_path.initialized)
============================================================
--- paths.hh b2dbcce45edb5e8f882948c1ceb6452083604b34
+++ paths.hh 52cf28b7d0b27dc3dcc58086196d682c73129c8d
@@ -354,6 +354,8 @@ private:
// 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 765e3324aa792233c9aff67c452731295c929c46
+++ tests/resolve_conflicts_content/__driver__.lua 7912acb9ca5802127db04a8f41a339836e565415
@@ -5,16 +5,22 @@ mtn_setup()
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()
@@ -23,14 +29,21 @@ writefile("files/baz", "baz\nAaa\nbbb\nC
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")
@@ -39,7 +52,20 @@ check(samefilestd("conflicts-2", "_MTN/c
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"))
@@ -50,4 +76,6 @@ check(readfile("files/baz") == "baz\nAaa
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 97fe0c8dfc0a80ab005b6799ed04a949eebad177
+++ tests/resolve_conflicts_content/conflicts-1 dc427145229cbd25860b9fb79ae714f4525451c5
@@ -1,6 +1,6 @@
- left [36cfb5960784df07636cc9d119617326fe87c3f6]
- right [be155249f011e658f913c109bafd743b1bfea0fe]
-ancestor [574e08409c35c5c0eb6e929bf1e3abf49a8bacd4]
+ left [fe616087506ae4e770e4a51e091e4c338b2f176d]
+ right [eccae629399090f99632cf9e9cc7156af2d238fb]
+ancestor [19451bb6dc1137d540500c63d399bac8babcbe78]
conflict content
node_type "file"
@@ -29,3 +29,21 @@ ancestor_file_id [0beec7b5ea3f0fdbc95d0d
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/merge-1 eaae4c9145e686cd082dea54e19d6554363aaa29
+++ tests/resolve_conflicts_content/merge-1 ee763684ea041eb0f99b496fa3c75a94b32add4e
@@ -1,10 +1,9 @@
-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/conflicts-2 9dbe490ea9bae5cac631c4e445c84048a57ca89b
+++ tests/resolve_conflicts_content/conflicts-2 7201ad336999c4df2fcbf29da4fbf4f23f1a6a36
@@ -1,6 +1,6 @@
- left [36cfb5960784df07636cc9d119617326fe87c3f6]
- right [be155249f011e658f913c109bafd743b1bfea0fe]
-ancestor [574e08409c35c5c0eb6e929bf1e3abf49a8bacd4]
+ left [fe616087506ae4e770e4a51e091e4c338b2f176d]
+ right [eccae629399090f99632cf9e9cc7156af2d238fb]
+ancestor [19451bb6dc1137d540500c63d399bac8babcbe78]
conflict content
node_type "file"
@@ -31,3 +31,21 @@ resolved_user_left "files/foo"
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/update-1 bf2839ab5ecb18963df0ed50fa3545ff359b2fac
+++ tests/resolve_conflicts_content/update-1 2db72e362d04f0510378fc7b364d9cc6d1bc7e9f
@@ -1,7 +1,9 @@ mtn: updating along branch 'testbranch'
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
============================================================
--- cmd_conflicts.cc 17a90f031a297292508aff6bb4ae9113eedc0f1f
+++ cmd_conflicts.cc c9d3ecf7590fbe2436adb5b33813906aa8e4f53a
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2009 Stephen Leake <address@hidden>
+// Copyright (C) 2008 - 2010 Stephen Leake <address@hidden>
//
// This program is made available under the GNU GPL version 2.0 or
// greater. See the accompanying file COPYING for details.
@@ -365,19 +365,43 @@ set_first_conflict(database & db,
{
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)())
{
============================================================
--- /dev/null
+++ tests/resolve_conflicts_content/conflicts-3 9de0da17483ea43b23944ec8e175659c4199bcc5
@@ -0,0 +1,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"
============================================================
--- /dev/null
+++ tests/resolve_conflicts_content/merge.lua caaa25ce21f6cb7a12d24e442c728796a350a207
@@ -0,0 +1,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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone: af0b5d1b31f5f340c715c57364d3de5d7fec995f,
code <=