diff --git a/src/TDB.cpp b/src/TDB.cpp index e1f31bdca..f868d1da2 100644 --- a/src/TDB.cpp +++ b/src/TDB.cpp @@ -1313,8 +1313,9 @@ void TDB::merge (const std::string& mergeFile) // which one is newer? if (tmod_r > tmod_l) { - std::cout << "Found remote change to " + std::cout << "Found remote change to " << (useColor ? colorChanged.colorize (uuid) : uuid) + << " \"" << cutOff (tmod_r.getBefore ().get ("description"), 10) << "\"" << "\n"; mods.push_front(tmod_r); @@ -1328,8 +1329,9 @@ void TDB::merge (const std::string& mergeFile) } else { - std::cout << "Retaining local changes to " + 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 () { @@ -1447,7 +1454,7 @@ void TDB::merge (const std::string& mergeFile) { // Update the completed record. /* - std::cout << "Modifying " + std::cout << "Modifying " << (useColor ? colorChanged.colorize (uuid) : uuid) << "\n"; */ @@ -1489,8 +1496,9 @@ void TDB::merge (const std::string& mergeFile) if (it->find (uuid) != std::string::npos) { // Update the pending record. - std::cout << "Found remote change to " + std::cout << "Found remote change to " << (useColor ? colorChanged.colorize (uuid) : uuid) + << " \"" << cutOff (tmod.getBefore ().get ("description"), 10) << "\"" << "\n"; // remove the \n from composeF4() string @@ -1523,8 +1531,9 @@ void TDB::merge (const std::string& mergeFile) if (!found) { - std::cout << "Missing " + std::cout << "Missing " << (useColor ? colorRejected.colorize (uuid) : uuid) + << " \"" << cutOff (tmod.getBefore ().get ("description"), 10) << "\"" << "\n"; mods.erase (current); } @@ -1548,8 +1557,9 @@ void TDB::merge (const std::string& mergeFile) if (!found) { - std::cout << "Merging new remote task " + std::cout << "Merging new remote task " << (useColor ? colorAdded.colorize (uuid) : uuid) + << " \"" << cutOff (tmod.getBefore ().get ("description"), 10) << "\"" << "\n"; // remove the \n from composeF4() string diff --git a/src/text.cpp b/src/text.cpp index b87d7f53e..b9899bba2 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -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; + } +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/text.h b/src/text.h index fd758b6b8..bf695bce8 100644 --- a/src/text.h +++ b/src/text.h @@ -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&);