- 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

@ -1313,8 +1313,9 @@ void TDB::merge (const std::string& mergeFile)
// which one is newer? // which one is newer?
if (tmod_r > tmod_l) if (tmod_r > tmod_l)
{ {
std::cout << "Found remote change to " std::cout << "Found remote change to "
<< (useColor ? colorChanged.colorize (uuid) : uuid) << (useColor ? colorChanged.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod_r.getBefore ().get ("description"), 10) << "\""
<< "\n"; << "\n";
mods.push_front(tmod_r); mods.push_front(tmod_r);
@ -1328,8 +1329,9 @@ void TDB::merge (const std::string& mergeFile)
} }
else else
{ {
std::cout << "Retaining local changes to " std::cout << "Retaining local changes to "
<< (useColor ? colorRejected.colorize (uuid) : uuid) << (useColor ? colorRejected.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod_l.getBefore ().get ("description"), 10) << "\""
<< "\n"; << "\n";
// inserting right mod into history of local database // 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 // local branch is up-to-date
// nothing happend on the local branch either // nothing happend on the local branch either
/*
// break, to suppress autopush
if (lit != l.end ()) 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 () else // lit == l.end ()
{ {
@ -1447,7 +1454,7 @@ void TDB::merge (const std::string& mergeFile)
{ {
// Update the completed record. // Update the completed record.
/* /*
std::cout << "Modifying " std::cout << "Modifying "
<< (useColor ? colorChanged.colorize (uuid) : uuid) << (useColor ? colorChanged.colorize (uuid) : uuid)
<< "\n"; << "\n";
*/ */
@ -1489,8 +1496,9 @@ void TDB::merge (const std::string& mergeFile)
if (it->find (uuid) != std::string::npos) if (it->find (uuid) != std::string::npos)
{ {
// Update the pending record. // Update the pending record.
std::cout << "Found remote change to " std::cout << "Found remote change to "
<< (useColor ? colorChanged.colorize (uuid) : uuid) << (useColor ? colorChanged.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod.getBefore ().get ("description"), 10) << "\""
<< "\n"; << "\n";
// remove the \n from composeF4() string // remove the \n from composeF4() string
@ -1523,8 +1531,9 @@ void TDB::merge (const std::string& mergeFile)
if (!found) if (!found)
{ {
std::cout << "Missing " std::cout << "Missing "
<< (useColor ? colorRejected.colorize (uuid) : uuid) << (useColor ? colorRejected.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod.getBefore ().get ("description"), 10) << "\""
<< "\n"; << "\n";
mods.erase (current); mods.erase (current);
} }
@ -1548,8 +1557,9 @@ void TDB::merge (const std::string& mergeFile)
if (!found) if (!found)
{ {
std::cout << "Merging new remote task " std::cout << "Merging new remote task "
<< (useColor ? colorAdded.colorize (uuid) : uuid) << (useColor ? colorAdded.colorize (uuid) : uuid)
<< " \"" << cutOff (tmod.getBefore ().get ("description"), 10) << "\""
<< "\n"; << "\n";
// remove the \n from composeF4() string // 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&, bool sensitive = true);
std::string::size_type find (const std::string&, const std::string&, std::string::size_type, 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&); int strippedLength (const std::string&);
std::string cutOff (const std::string&, std::string::size_type);
// UTF-8 aware. // UTF-8 aware.
int characters (const std::string&); int characters (const std::string&);