- added description substrings to output of merge command
This commit is contained in:
Johannes Schlatow 2010-10-20 22:41:45 +02:00
parent 1e38cbd6a0
commit af490fb634
3 changed files with 35 additions and 9 deletions

View file

@ -1315,6 +1315,7 @@ void TDB::merge (const std::string& mergeFile)
{
std::cout << "Found remote change to "
<< (useColor ? colorChanged.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod_r.getBefore ().get ("description"), 10) << "\""
<< "\n";
mods.push_front(tmod_r);
@ -1330,6 +1331,7 @@ void TDB::merge (const std::string& mergeFile)
{
std::cout << "Retaining local changes to "
<< (useColor ? colorRejected.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod_l.getBefore ().get ("description"), 10) << "\""
<< "\n";
// inserting right mod into history of local database
@ -1383,10 +1385,15 @@ void TDB::merge (const std::string& mergeFile)
// local branch is up-to-date
// nothing happend on the local branch either
/*
// break, to suppress autopush
if (lit != l.end ())
std::cout << "No remote changes detected.\n";
*/
{
mods.clear ();
lmods.clear ();
throw std::string ("Database is up-to-date, no merge required.");
}
}
else // lit == l.end ()
{
@ -1491,6 +1498,7 @@ void TDB::merge (const std::string& mergeFile)
// Update the pending record.
std::cout << "Found remote change to "
<< (useColor ? colorChanged.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod.getBefore ().get ("description"), 10) << "\""
<< "\n";
// remove the \n from composeF4() string
@ -1525,6 +1533,7 @@ void TDB::merge (const std::string& mergeFile)
{
std::cout << "Missing "
<< (useColor ? colorRejected.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod.getBefore ().get ("description"), 10) << "\""
<< "\n";
mods.erase (current);
}
@ -1550,6 +1559,7 @@ void TDB::merge (const std::string& mergeFile)
{
std::cout << "Merging new remote task "
<< (useColor ? colorAdded.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod.getBefore ().get ("description"), 10) << "\""
<< "\n";
// remove the \n from composeF4() string

View file

@ -654,3 +654,18 @@ int characters (const std::string& str)
}
////////////////////////////////////////////////////////////////////////////////
std::string cutOff (const std::string& str, std::string::size_type len)
{
if (str.length () > len)
{
return (str.substr(0,len-2) + "..");
}
else
{
std::string res = str;
res.resize (len, ' ');
return res;
}
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -60,6 +60,7 @@ bool compare (const std::string&, const std::string&, bool sensitive = true);
std::string::size_type find (const std::string&, const std::string&, bool sensitive = true);
std::string::size_type find (const std::string&, const std::string&, std::string::size_type, bool sensitive = true);
int strippedLength (const std::string&);
std::string cutOff (const std::string&, std::string::size_type);
// UTF-8 aware.
int characters (const std::string&);