Merge branch '2.2.0' of tasktools.org:task into 2.2.0

This commit is contained in:
Paul Beckingham 2012-09-16 15:19:39 -04:00
commit ad3e249a64
3 changed files with 168 additions and 6 deletions

View file

@ -759,6 +759,10 @@ void TDB2::merge (const std::string& mergeFile)
break;
}
}
else
{
undo_lines.push_back (lline + "\n");
}
// Add some color.
Color colorAdded (context.config.get ("color.sync.added"));
@ -768,10 +772,12 @@ void TDB2::merge (const std::string& mergeFile)
// at this point we can assume: (lline==rline) || (lit == l.end())
// thus we search for the first non-equal lines or the EOF
bool found = false;
for ( ; (lit != l.end ()) && (rit != r.end ()); ++lit, ++rit)
for (std::vector<std::string>::const_iterator tmp_lit = lit, tmp_rit = rit;
(tmp_lit != l.end ()) && (tmp_rit != r.end ());
++tmp_lit, ++tmp_rit)
{
lline = *lit;
rline = *rit;
lline = *tmp_lit;
rline = *tmp_rit;
// found first non-matching lines?
if (lline.compare (rline) != 0)
@ -779,13 +785,28 @@ void TDB2::merge (const std::string& mergeFile)
found = true;
break;
}
else
else if (tmp_lit->substr (0, 3) == "---")
{
// push the line to the new undo.data
undo_lines.push_back (lline + "\n");
while (lit != tmp_lit)
{
++lit;
++rit;
undo_lines.push_back(*lit + "\n");
}
// at this point, all iterators (tmp_{lit,rit}, lit and rit) are at the same line
}
}
if (!found)
{
// set iterators to r.end() or l.end() if they are point to the last line
if (++rit != r.end())
--rit;
if (++lit != l.end())
--lit;
}
///////////////////////////////////////
// branch-off point found:
if (found)
@ -1883,3 +1904,4 @@ void TDB2::dump ()
}
////////////////////////////////////////////////////////////////////////////////
// vim: ts=2 et sw=2

View file

@ -66,6 +66,8 @@ int CmdIDs::execute (std::string& output)
std::sort (ids.begin (), ids.end ());
output = compressIds (ids) + "\n";
context.headers.clear ();
return 0;
}
@ -98,6 +100,8 @@ int CmdCompletionIds::execute (std::string& output)
std::sort (ids.begin (), ids.end ());
join (output, "\n", ids);
output += "\n";
context.headers.clear ();
return 0;
}
@ -131,6 +135,8 @@ int CmdZshCompletionIds::execute (std::string& output)
<< "\n";
output = out.str ();
context.headers.clear ();
return 0;
}
@ -161,6 +167,8 @@ int CmdUUIDs::execute (std::string& output)
std::sort (uuids.begin (), uuids.end ());
join (output, ",", uuids);
output += "\n";
context.headers.clear ();
return 0;
}
@ -191,6 +199,8 @@ int CmdCompletionUuids::execute (std::string& output)
std::sort (uuids.begin (), uuids.end ());
join (output, "\n", uuids);
output += "\n";
context.headers.clear ();
return 0;
}
@ -222,6 +232,8 @@ int CmdZshCompletionUuids::execute (std::string& output)
<< "\n";
output = out.str ();
context.headers.clear ();
return 0;
}