[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone: 092691a982d08391cfd1356a86
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone: 092691a982d08391cfd1356a869716471cb5706e |
Date: |
Tue, 11 Jan 2011 01:38:44 GMT |
revision: 092691a982d08391cfd1356a869716471cb5706e
date: 2011-01-11T01:38:18
author: Timothy Brownawell <address@hidden>
branch: net.venge.monotone
changelog:
Fix the line merger to not change everything to "\n".
split_into_lines() now takes an enum for flags, to include the
line endings in the splitted parts or append the "no trailing
newline" line for diff.
manifest:
format_version "1"
new_manifest [3f4a948fd2e034ea2f0e1001c95ff6824a4ed8a1]
old_revision [6d854164c71f5b5b1e8c635a0fedb494f0ee05f6]
patch "NEWS"
from [158aeaaa4f6dc2adee1de8f698bcf52783cf9633]
to [f9ce17392993af31e59748c969baa33ab5296c42]
patch "diff_output.cc"
from [aeb8a9d42f608944af177b292651de8ba27ca7b4]
to [1e537406208bd9ff6afd2a728389d1c4f34acaf2]
patch "merge_content.cc"
from [7b3d119b5dbc73304ab5b11fba31fc78c10b82d8]
to [620a2b95ee5b72299ee2780ec0077e25c03b8795]
patch "simplestring_xform.cc"
from [de3c230648303fb799bdd907bb90985d2ed7e97a]
to [e779da92dc0c8e2f09d5800d26073d4d2ca5d130]
patch "simplestring_xform.hh"
from [fb077a97ed6338787a652441b97c809750aac454]
to [ab0d125445f13982344bbe3f713e2ce90d11cb66]
patch "tests/automate_file_merge/__driver__.lua"
from [b3f8fc5291e23981a76c9c30352978ae1127d488]
to [15a2032d1312df8460a20bcbcfb54d995a02ad49]
patch "tests/resolve_conflicts_content/__driver__.lua"
from [00570ab4eeccfc248746cca7ffada958461d4102]
to [1b10a05d8783432462a1af35c855035d59383361]
patch "tests/resolve_conflicts_content/merge-1"
from [bb23ecbb7f05a2de91d69a101ef6df827173c202]
to [0a6aa4e9b65e60ab29cdd4c6467e9c4e7cc51dd4]
patch "tests/resolve_conflicts_content/update-1"
from [2db72e362d04f0510378fc7b364d9cc6d1bc7e9f]
to [d46c485d67feccba79540fc6cd164d963ffdf500]
patch "tests/workspace_migration/twoparent-2/testfile"
from [a9c24589987aa6b2771ec6d8a419499a563bfa31]
to [ee18013e989404cbf57ff0af6db2a6c7ed17299d]
============================================================
--- NEWS 158aeaaa4f6dc2adee1de8f698bcf52783cf9633
+++ NEWS f9ce17392993af31e59748c969baa33ab5296c42
@@ -29,6 +29,9 @@ XXX XXX XX XX:XX:XX UTC 2010
Bugs fixed
+ - The internal line merger will actually preserve your line
+ endings now, instead of changing everything to "\n".
+
- Improve help, fix arg indexing in 'conflicts resolve_first'
(fixes monotone issue 101)
============================================================
--- diff_output.cc aeb8a9d42f608944af177b292651de8ba27ca7b4
+++ diff_output.cc 1e537406208bd9ff6afd2a728389d1c4f34acaf2
@@ -485,8 +485,8 @@ make_diff(string const & filename1,
}
vector<string> lines1, lines2;
- split_into_lines(data1(), lines1, true);
- split_into_lines(data2(), lines2, true);
+ split_into_lines(data1(), lines1, split_flags::diff_compat);
+ split_into_lines(data2(), lines2, split_flags::diff_compat);
vector<long, QA(long)> left_interned;
vector<long, QA(long)> right_interned;
============================================================
--- merge_content.cc 7b3d119b5dbc73304ab5b11fba31fc78c10b82d8
+++ merge_content.cc 620a2b95ee5b72299ee2780ec0077e25c03b8795
@@ -424,15 +424,18 @@ content_merger::attempt_auto_merge(file_
string const right_encoding(get_file_encoding(right_path, right_ros));
vector<string> left_lines, ancestor_lines, right_lines, merged_lines;
- split_into_lines(left_unpacked(), left_encoding, left_lines);
- split_into_lines(ancestor_unpacked(), anc_encoding, ancestor_lines);
- split_into_lines(right_unpacked(), right_encoding, right_lines);
+ split_into_lines(left_unpacked(), left_encoding, left_lines,
+ split_flags::keep_endings);
+ split_into_lines(ancestor_unpacked(), anc_encoding, ancestor_lines,
+ split_flags::keep_endings);
+ split_into_lines(right_unpacked(), right_encoding, right_lines,
+ split_flags::keep_endings);
if (merge3(ancestor_lines, left_lines, right_lines, merged_lines))
{
string tmp;
- join_lines(merged_lines, tmp);
+ join_lines(merged_lines, tmp, "");
merge_data = file_data(tmp, origin::internal);
return true;
}
============================================================
--- simplestring_xform.cc de3c230648303fb799bdd907bb90985d2ed7e97a
+++ simplestring_xform.cc e779da92dc0c8e2f09d5800d26073d4d2ca5d130
@@ -60,22 +60,15 @@ void split_into_lines(string const & in,
void split_into_lines(string const & in,
vector<string> & out,
- bool diff_compat)
+ split_flags::split_flags flags)
{
- return split_into_lines(in, constants::default_encoding, out, diff_compat);
+ return split_into_lines(in, constants::default_encoding, out, flags);
}
void split_into_lines(string const & in,
string const & encoding,
- vector<string> & out)
-{
- return split_into_lines(in, encoding, out, false);
-}
-
-void split_into_lines(string const & in,
- string const & encoding,
vector<string> & out,
- bool diff_compat)
+ split_flags::split_flags flags)
{
string lc_encoding = lowercase(encoding);
out.clear();
@@ -105,13 +98,22 @@ void split_into_lines(string const & in,
while (end != string::npos && end >= begin)
{
- out.push_back(in.substr(begin, end-begin));
+ string::size_type next_begin;
+
if (in.at(end) == '\r'
&& in.size() > end+1
&& in.at(end+1) == '\n')
- begin = end + 2;
+ next_begin = end + 2;
else
- begin = end + 1;
+ next_begin = end + 1;
+
+ if (flags & split_flags::keep_endings)
+ out.push_back(in.substr(begin, next_begin-begin));
+ else
+ out.push_back(in.substr(begin, end-begin));
+
+ begin = next_begin;
+
if (begin >= in.size())
break;
end = in.find_first_of("\r\n", begin);
@@ -119,7 +121,7 @@ void split_into_lines(string const & in,
if (begin < in.size()) {
// special case: last line without trailing newline
string s = in.substr(begin, in.size() - begin);
- if (diff_compat) {
+ if (flags & split_flags::diff_compat) {
// special handling: produce diff(1) compatible output
s += (in.find_first_of("\r") != string::npos ? "\r\n" : "\n");
s += "\\ No newline at end of file";
@@ -134,12 +136,6 @@ void split_into_lines(string const & in,
}
-void
-split_into_lines(string const & in,
- vector<string> & out)
-{
- split_into_lines(in, constants::default_encoding, out);
-}
void
join_lines(vector<string> const & in,
============================================================
--- simplestring_xform.hh fb077a97ed6338787a652441b97c809750aac454
+++ simplestring_xform.hh ab0d125445f13982344bbe3f713e2ce90d11cb66
@@ -15,21 +15,23 @@ std::string lowercase(std::string const
std::string uppercase(std::string const & in);
std::string lowercase(std::string const & in);
-void split_into_lines(std::string const & in,
- std::vector<std::string> & out);
+namespace split_flags
+{
+ enum split_flags {
+ none = 0,
+ diff_compat = 1,
+ keep_endings = 2
+ };
+}
void split_into_lines(std::string const & in,
- std::string const & encoding,
- std::vector<std::string> & out);
-
-void split_into_lines(std::string const & in,
std::vector<std::string> & out,
- bool diff_compat);
+ split_flags::split_flags flags = split_flags::none);
void split_into_lines(std::string const & in,
std::string const & encoding,
std::vector<std::string> & out,
- bool diff_compat);
+ split_flags::split_flags flags = split_flags::none);
void join_lines(std::vector<std::string> const & in,
std::string & out,
============================================================
--- tests/workspace_migration/twoparent-2/testfile a9c24589987aa6b2771ec6d8a419499a563bfa31
+++ tests/workspace_migration/twoparent-2/testfile ee18013e989404cbf57ff0af6db2a6c7ed17299d
@@ -1,2 +1,2 @@ left
left
-right
+right
\ No newline at end of file
============================================================
--- tests/resolve_conflicts_content/__driver__.lua 00570ab4eeccfc248746cca7ffada958461d4102
+++ tests/resolve_conflicts_content/__driver__.lua 1b10a05d8783432462a1af35c855035d59383361
@@ -81,7 +81,7 @@ check(readfile("files/foo") == "foo\nmer
check(samefilestd("update-1", "stderr"))
check(readfile("files/foo") == "foo\nmerged\nrevision")
-check(readfile("files/bar") == "bar\nzero\none\ntwo\nthree\nfour\n")
+check(readfile("files/bar") == "bar\nzero\none\ntwo\nthree\nfour")
check(readfile("files/baz") == "baz\nAaa\nBbb\nCcc")
check(readfile("files/inter1") == "files/inter1")
check(readfile("files/inter2") == "files/inter2")
============================================================
--- tests/resolve_conflicts_content/merge-1 bb23ecbb7f05a2de91d69a101ef6df827173c202
+++ tests/resolve_conflicts_content/merge-1 0a6aa4e9b65e60ab29cdd4c6467e9c4e7cc51dd4
@@ -5,4 +5,4 @@ mtn: replacing content of files/inter2,
mtn: replacing content of files/foo, files/foo with files/foo
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: [merged] b221355d26015cd04668aa4587cff8068e4646a2
============================================================
--- tests/resolve_conflicts_content/update-1 2db72e362d04f0510378fc7b364d9cc6d1bc7e9f
+++ tests/resolve_conflicts_content/update-1 d46c485d67feccba79540fc6cd164d963ffdf500
@@ -1,9 +1,9 @@ mtn: updating along branch 'testbranch'
mtn: updating along branch 'testbranch'
-mtn: selected update target bd6a2c0363cab1cf19220bce150c77b84b1a5a32
+mtn: selected update target b221355d26015cd04668aa4587cff8068e4646a2
mtn: [left] a047a11aae2e43f05171d8ffd8bbfde054f8a4f5
-mtn: [right] bd6a2c0363cab1cf19220bce150c77b84b1a5a32
+mtn: [right] b221355d26015cd04668aa4587cff8068e4646a2
mtn: updating files/bar
mtn: updating files/baz
mtn: updating files/inter1
mtn: updating files/inter2
-mtn: updated to base revision bd6a2c0363cab1cf19220bce150c77b84b1a5a32
+mtn: updated to base revision b221355d26015cd04668aa4587cff8068e4646a2
============================================================
--- tests/automate_file_merge/__driver__.lua b3f8fc5291e23981a76c9c30352978ae1127d488
+++ tests/automate_file_merge/__driver__.lua 15a2032d1312df8460a20bcbcfb54d995a02ad49
@@ -3,22 +3,22 @@ addfile("foo", "foo")
mtn_setup()
addfile("foo", "foo")
-addfile("bar", "bar\none\ntwo\nthree")
-addfile("baz", "baz\naaa\nbbb\nccc")
+addfile("bar", "bar\none\ntwo\nthree\n")
+addfile("baz", "baz\r\naaa\r\nbbb\r\nccc")
commit("testbranch", "base")
base = base_revision()
writefile("foo", "foo\nfirst\nrevision")
-writefile("bar", "bar\nzero\none\ntwo\nthree")
-writefile("baz", "baz\nAAA\nbbb\nccc")
+writefile("bar", "bar\nzero\none\ntwo\nthree\n")
+writefile("baz", "baz\r\nAAA\r\nbbb\r\nccc")
commit("testbranch", "first")
first = base_revision()
revert_to(base)
writefile("foo", "foo\nsecond\nrevision")
-writefile("bar", "bar\none\ntwo\nthree\nfour")
-writefile("baz", "baz\naaa\nbbb\nCCC")
+writefile("bar", "bar\none\ntwo\nthree\nfour\n")
+writefile("baz", "baz\r\naaa\r\nbbb\r\nCCC")
commit("testbranch", "second")
second = base_revision()
@@ -30,7 +30,7 @@ check(samefile("expected_bar", "stdout")
canonicalize("stdout")
check(samefile("expected_bar", "stdout"))
-writefile("expected_baz", "baz\nAAA\nbbb\nCCC\n")
+writefile("expected_baz", "baz\r\nAAA\r\nbbb\r\nCCC")
check(mtn("automate", "file_merge", first, "baz", second, "baz"), 0, true, nil)
canonicalize("stdout")
check(samefile("expected_baz", "stdout"))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone: 092691a982d08391cfd1356a869716471cb5706e,
code <=