mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Sync
- Changed the wording on most error messages and diagnostics so that the user is not alarmed, and is somewhat guided toward a solution.
This commit is contained in:
parent
4028a2fce4
commit
74dcdd897a
11 changed files with 118 additions and 123 deletions
14
src/TDB.cpp
14
src/TDB.cpp
|
@ -1106,7 +1106,7 @@ void TDB::merge (const std::string& mergeFile)
|
|||
|
||||
// file has to contain at least one entry
|
||||
if (r.size () < 3)
|
||||
throw std::string ("There are no transactions to apply.");
|
||||
throw std::string ("There are no changes to merge.");
|
||||
|
||||
// load undo file (left/local branch)
|
||||
Directory location (context.config.get ("data.location"));
|
||||
|
@ -1198,7 +1198,7 @@ void TDB::merge (const std::string& mergeFile)
|
|||
{
|
||||
if ( (*lmod_it).isNew ())
|
||||
{
|
||||
std::cout << "Skipping the new local task "
|
||||
std::cout << "Skipping new local task "
|
||||
<< (*lmod_it).getUuid()
|
||||
<< "\n";
|
||||
|
||||
|
@ -1222,7 +1222,7 @@ void TDB::merge (const std::string& mergeFile)
|
|||
// new uuid?
|
||||
if (tmod.isNew ())
|
||||
{
|
||||
std::cout << "Adding the new remote task "
|
||||
std::cout << "Adding new remote task "
|
||||
<< tmod.getUuid()
|
||||
<< "\n";
|
||||
uuid_new.insert (tmod.getUuid ());
|
||||
|
@ -1357,12 +1357,12 @@ void TDB::merge (const std::string& mergeFile)
|
|||
{
|
||||
// nothing happend on the remote branch
|
||||
// local branch is up-to-date
|
||||
throw std::string ("Database is already up-to-date.");
|
||||
throw std::string ("Database is up to date.");
|
||||
}
|
||||
else // lit == undo.end ()
|
||||
{
|
||||
// nothing happend on the local branch
|
||||
std::cout << "No changes were made on the local database. Appending changes...\n";
|
||||
std::cout << "No changes were made on the local database. Adding remote changes...\n";
|
||||
|
||||
// add remaining lines (remote branch) to the list of modifications
|
||||
readTaskmods (r, rit, mods);
|
||||
|
@ -1515,7 +1515,7 @@ void TDB::merge (const std::string& mergeFile)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Not adding duplicate " << uuid << "\n";
|
||||
std::cout << "Skipping duplicate " << uuid << "\n";
|
||||
mods.erase (current);
|
||||
}
|
||||
}
|
||||
|
@ -1546,7 +1546,7 @@ void TDB::merge (const std::string& mergeFile)
|
|||
}
|
||||
else // nothing to be done
|
||||
{
|
||||
std::cout << "Nothing to be done.\n";
|
||||
std::cout << "No merge required.\n";
|
||||
}
|
||||
|
||||
// delete objects
|
||||
|
|
|
@ -38,9 +38,8 @@ TransportCurl::TransportCurl(const Uri& uri) : Transport(uri)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportCurl::send(const std::string& source)
|
||||
{
|
||||
if (uri.host == "") {
|
||||
throw std::string ("Hostname is empty");
|
||||
}
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'curl' protocol, the uri must contain a hostname.");
|
||||
|
||||
if (is_filelist(source))
|
||||
{
|
||||
|
@ -48,10 +47,10 @@ void TransportCurl::send(const std::string& source)
|
|||
pos = source.find("{");
|
||||
|
||||
if (pos == std::string::npos)
|
||||
throw std::string ("Curl does not support wildcards!");
|
||||
throw std::string ("When using the 'curl' protocol, wildcards are not supported.");
|
||||
|
||||
if (!uri.is_directory())
|
||||
throw std::string ("'" + uri.path + "' is not a directory!");
|
||||
throw std::string ("The uri '"); + uri.path + "' does not appear to be a directory.";
|
||||
|
||||
std::string toSplit;
|
||||
std::string suffix;
|
||||
|
@ -88,15 +87,14 @@ void TransportCurl::send(const std::string& source)
|
|||
}
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Failed to run curl!");
|
||||
throw std::string ("Could not run curl. Is it installed, and available in $PATH?");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportCurl::recv(std::string target)
|
||||
{
|
||||
if (uri.host == "") {
|
||||
throw std::string ("Hostname is empty");
|
||||
}
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'curl' protocol, the uri must contain a hostname.");
|
||||
|
||||
if (is_filelist(uri.path))
|
||||
{
|
||||
|
@ -104,10 +102,10 @@ void TransportCurl::recv(std::string target)
|
|||
pos = uri.path.find("{");
|
||||
|
||||
if (pos == std::string::npos)
|
||||
throw std::string ("Curl does not support wildcards!");
|
||||
throw std::string ("When using the 'curl' protocol, wildcards are not supported.");
|
||||
|
||||
if (!is_directory(target))
|
||||
throw std::string ("'" + target + "' is not a directory!");
|
||||
throw std::string ("The uri '"); + target + "' does not appear to be a directory.";
|
||||
|
||||
std::string toSplit;
|
||||
std::string suffix;
|
||||
|
@ -142,7 +140,7 @@ void TransportCurl::recv(std::string target)
|
|||
arguments.push_back (target);
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Failed to run curl!");
|
||||
throw std::string ("Could not run curl. Is it installed, and available in $PATH?");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -36,8 +36,8 @@ public:
|
|||
|
||||
virtual void send (const std::string&);
|
||||
virtual void recv (std::string);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -36,14 +36,13 @@ TransportRSYNC::TransportRSYNC(const Uri& uri) : Transport(uri)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportRSYNC::send(const std::string& source)
|
||||
{
|
||||
if (uri.host == "") {
|
||||
throw std::string ("Hostname is empty");
|
||||
}
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'rsync' protocol, the uri must contain a hostname.");
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then path has to end with a '/'
|
||||
if (is_filelist(source) && !uri.is_directory())
|
||||
throw std::string ("'" + uri.path + "' is not a directory!");
|
||||
throw std::string ("The uri '"); + uri.path + "' does not appear to be a directory.";
|
||||
|
||||
// cmd line is: rsync [--port=PORT] source [user@]host::path
|
||||
if (uri.port != "")
|
||||
|
@ -63,26 +62,23 @@ void TransportRSYNC::send(const std::string& source)
|
|||
}
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Failed to run rsync!");
|
||||
throw std::string ("Could not run rsync. Is it installed, and available in $PATH?");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportRSYNC::recv(std::string target)
|
||||
{
|
||||
if (uri.host == "") {
|
||||
throw std::string ("Hostname is empty");
|
||||
}
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'rsync' protocol, the uri must contain a hostname.");
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then target has to end with a '/'
|
||||
if (is_filelist(uri.path) && !is_directory(target))
|
||||
throw std::string ("'" + target + "' is not a directory!");
|
||||
throw std::string ("The uri '"); + target + "' does not appear to be a directory.";
|
||||
|
||||
// cmd line is: rsync [--port=PORT] [user@]host::path target
|
||||
if (uri.port != "")
|
||||
{
|
||||
arguments.push_back ("--port=" + uri.port);
|
||||
}
|
||||
|
||||
if (uri.user != "")
|
||||
{
|
||||
|
@ -96,7 +92,7 @@ void TransportRSYNC::recv(std::string target)
|
|||
arguments.push_back (target);
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Failed to run rsync!");
|
||||
throw std::string ("Could not run rsync. Is it installed, and available in $PATH?");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -36,14 +36,13 @@ TransportSSH::TransportSSH(const Uri& uri) : Transport(uri)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportSSH::send(const std::string& source)
|
||||
{
|
||||
if (uri.host == "") {
|
||||
throw std::string ("Hostname is empty");
|
||||
}
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'ssh' protocol, the uri must contain a hostname.");
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then path has to end with a '/'
|
||||
if (is_filelist(source) && !uri.is_directory())
|
||||
throw std::string ("'" + uri.path + "' is not a directory!");
|
||||
throw std::string ("The uri '"); + uri.path + "' does not appear to be a directory.";
|
||||
|
||||
// cmd line is: scp [-p port] [user@]host:path
|
||||
if (uri.port != "")
|
||||
|
@ -64,20 +63,19 @@ void TransportSSH::send(const std::string& source)
|
|||
}
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Failed to run scp!");
|
||||
throw std::string ("Could not run scp. Is it installed, and available in $PATH?");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TransportSSH::recv(std::string target)
|
||||
{
|
||||
if (uri.host == "") {
|
||||
throw std::string ("Hostname is empty");
|
||||
}
|
||||
if (uri.host == "")
|
||||
throw std::string ("when using the 'ssh' protocol, the uri must contain a hostname.");
|
||||
|
||||
// Is there more than one file to transfer?
|
||||
// Then target has to end with a '/'
|
||||
if (is_filelist(uri.path) && !is_directory(target))
|
||||
throw std::string ("'" + target + "' is not a directory!");
|
||||
throw std::string ("The uri '"); + target + "' does not appear to be a directory.";
|
||||
|
||||
// cmd line is: scp [-p port] [user@]host:path
|
||||
if (uri.port != "")
|
||||
|
@ -98,7 +96,7 @@ void TransportSSH::recv(std::string target)
|
|||
arguments.push_back (target);
|
||||
|
||||
if (execute())
|
||||
throw std::string ("Failed to run scp!");
|
||||
throw std::string ("Could not run scp. Is it installed, and available in $PATH?");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -213,7 +213,7 @@ void Uri::parse ()
|
|||
}
|
||||
else
|
||||
{
|
||||
throw std::string ("Could not parse \""+data+"\"");
|
||||
throw std::string ("The uri '") + data + "' is not in the expected format.";
|
||||
}
|
||||
|
||||
// parse host
|
||||
|
|
|
@ -586,7 +586,7 @@ void handleMerge (std::string& outs)
|
|||
std::string pushfile = "";
|
||||
std::string tmpfile = "";
|
||||
|
||||
std::string sAutopush = context.config.get ("merge.autopush");
|
||||
std::string sAutopush = lowerCase (context.config.get ("merge.autopush"));
|
||||
bool bAutopush = context.config.getBoolean ("merge.autopush");
|
||||
|
||||
Uri uri (file, "merge");
|
||||
|
@ -625,20 +625,19 @@ void handleMerge (std::string& outs)
|
|||
context.hooks.trigger ("post-merge-command");
|
||||
|
||||
if (tmpfile != "")
|
||||
{
|
||||
remove (tmpfile.c_str());
|
||||
}
|
||||
|
||||
if ( ((sAutopush == "ask") && (confirm ("Do you want to push the changes to \'" + pushfile + "\'?")) )
|
||||
if ( ((sAutopush == "ask") && (confirm ("Would you like to push the changes to \'" + pushfile + "\'?")) )
|
||||
|| (bAutopush) )
|
||||
{
|
||||
std::string out;
|
||||
handlePush(out);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
throw std::string ("You must specify a file to merge.");
|
||||
throw std::string ("No uri was specified for the merge. Either specify "
|
||||
"the uri of a remote .task directory, or create a "
|
||||
"'merge.default.uri' entry in your .taskrc file.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -666,7 +665,7 @@ void handlePush (std::string& outs)
|
|||
{
|
||||
// copy files locally
|
||||
if (!uri.is_directory())
|
||||
throw std::string ("'" + uri.path + "' is not a directory!");
|
||||
throw std::string ("The uri '"); + uri.path + "' does not appear to be a directory.";
|
||||
|
||||
std::ifstream ifile1 ((location.data + "/undo.data").c_str(), std::ios_base::binary);
|
||||
std::ofstream ofile1 ((uri.path + "undo.data").c_str(), std::ios_base::binary);
|
||||
|
@ -684,7 +683,9 @@ void handlePush (std::string& outs)
|
|||
context.hooks.trigger ("post-push-command");
|
||||
}
|
||||
else
|
||||
throw std::string ("You must specify a target.");
|
||||
throw std::string ("No uri was specified for the push. Either specify "
|
||||
"the uri of a remote .task directory, or create a "
|
||||
"'push.default.uri' entry in your .taskrc file.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -703,7 +704,7 @@ void handlePull (std::string& outs)
|
|||
Directory location (context.config.get ("data.location"));
|
||||
|
||||
if (!uri.append ("{pending,undo,completed}.data"))
|
||||
throw std::string ("'" + uri.path + "' is not a directory!");
|
||||
throw std::string ("The uri '"); + uri.path + "' does not appear to be a directory.";
|
||||
|
||||
Transport* transport;
|
||||
if ((transport = Transport::getTransport (uri)) != NULL)
|
||||
|
@ -745,7 +746,9 @@ void handlePull (std::string& outs)
|
|||
context.hooks.trigger ("post-pull-command");
|
||||
}
|
||||
else
|
||||
throw std::string ("You must specify a target.");
|
||||
throw std::string ("No uri was specified for the pull. Either specify "
|
||||
"the uri of a remote .task directory, or create a "
|
||||
"'pull.default.uri' entry in your .taskrc file.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue