#
#
# patch "ChangeLog"
# from [fe130ad65f80e1ada20bda8192cb24d119a1e9af]
# to [a2df4c2fe12838f080c4c9eb73a5317cf3b4cb50]
#
# patch "randomfile.hh"
# from [ce70849e7fde36f69821216a73848cb1b68e11fe]
# to [f2e58276f497e0e2aa8a25bcc7db9ce5a138dcab]
#
============================================================
--- ChangeLog fe130ad65f80e1ada20bda8192cb24d119a1e9af
+++ ChangeLog a2df4c2fe12838f080c4c9eb73a5317cf3b4cb50
@@ -1,5 +1,13 @@
2006-07-05 Timothy Brownawell
+ * randomfile.hh (file_randomizer::build_random_fork): When generating
+ two consecutive 'insert' hunks where the inserts occur on opposite
+ sides of the fork, insert spacer lines between the hunks. This
+ prevents it from generating some real conflicts that were making some
+ of the unit_tests (which expect cleanly mergable files) fail.
+
+2006-07-05 Timothy Brownawell
+
* tester.lua: Use open_or_err more.
2006-07-04 Alex Queiroz
============================================================
--- randomfile.hh ce70849e7fde36f69821216a73848cb1b68e11fe
+++ randomfile.hh f2e58276f497e0e2aa8a25bcc7db9ce5a138dcab
@@ -95,13 +95,17 @@
std::vector & merged,
int n_hunks = 10)
{
+ bool last_was_insert = false;
+ bool last_insert_was_left = false;
file_randomizer fr;
// maybe prepend something to one side or the other
if (randomizer::flip())
{
+ last_was_insert = true;
fr.prepend_sequential_lines();
- if (randomizer::flip())
+ last_insert_was_left = randomizer::flip();
+ if (last_insert_was_left)
fr.append_to(left);
else
fr.append_to(right);
@@ -114,11 +118,23 @@
file_randomizer hr;
hr.set_prefix(std::string("hunk ") + boost::lexical_cast(h) + " -- ");
hr.initial_sequential_lines(10);
- hr.append_to(ancestor);
if (randomizer::flip())
{
+ bool this_insert_is_left = randomizer::flip();
+ if (last_was_insert && (this_insert_is_left != last_insert_was_left))
+ {
+ fr.set_prefix("spacer ");
+ fr.initial_sequential_lines(3);
+ fr.append_to(left);
+ fr.append_to(right);
+ fr.append_to(ancestor);
+ fr.append_to(merged);
+ fr.set_prefix("");
+ }
+ last_insert_was_left = this_insert_is_left;
// doing an insert
- if (randomizer::flip())
+ hr.append_to(ancestor);
+ if (this_insert_is_left)
{
// inserting in left
hr.append_to(right);
@@ -133,10 +149,12 @@
hr.append_to(right);
}
hr.append_to(merged);
+ last_was_insert = true;
}
else
{
// doing a delete
+ hr.append_to(ancestor);
if (randomizer::flip())
{
// deleting in left
@@ -152,14 +170,26 @@
hr.append_to(right);
}
hr.append_to(merged);
+ last_was_insert = false;
}
}
// maybe append something to one side or the other
if (randomizer::flip())
{
+ bool this_insert_is_left = randomizer::flip();
+ if (last_was_insert && (this_insert_is_left != last_insert_was_left))
+ {
+ fr.set_prefix("spacer ");
+ fr.initial_sequential_lines(3);
+ fr.append_to(left);
+ fr.append_to(right);
+ fr.append_to(ancestor);
+ fr.append_to(merged);
+ fr.set_prefix("");
+ }
fr.append_sequential_lines();
- if (randomizer::flip())
+ if (this_insert_is_left)
fr.append_to(left);
else
fr.append_to(right);