mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Code Cleanup
- Removed deprecated 'push', 'pull' and 'merge' commands.
This commit is contained in:
parent
341c2fb474
commit
8b736934d7
47 changed files with 22 additions and 3941 deletions
|
@ -35,12 +35,9 @@ set (commands_SRCS Command.cpp Command.h
|
|||
CmdInfo.cpp CmdInfo.h
|
||||
CmdLog.cpp CmdLog.h
|
||||
CmdLogo.cpp CmdLogo.h
|
||||
CmdMerge.cpp CmdMerge.h
|
||||
CmdModify.cpp CmdModify.h
|
||||
CmdPrepend.cpp CmdPrepend.h
|
||||
CmdProjects.cpp CmdProjects.h
|
||||
CmdPull.cpp CmdPull.h
|
||||
CmdPush.cpp CmdPush.h
|
||||
CmdReports.cpp CmdReports.h
|
||||
CmdShow.cpp CmdShow.h
|
||||
CmdStart.cpp CmdStart.h
|
||||
|
|
|
@ -260,66 +260,7 @@ int CmdDiagnostics::execute (std::string& output)
|
|||
<< credentials
|
||||
<< "\n\n";
|
||||
|
||||
// External commands.
|
||||
// Deprecated in 2.3.0 with push, pull, merge.
|
||||
out << bold.colorize (STRING_CMD_DIAG_EXTERNAL)
|
||||
<< "\n";
|
||||
{
|
||||
std::vector <std::string> matches;
|
||||
char buffer [1024] = {0};
|
||||
FILE* fp;
|
||||
if ((fp = popen ("/usr/bin/env scp 2>&1", "r")))
|
||||
{
|
||||
char* p = fgets (buffer, 1023, fp);
|
||||
pclose (fp);
|
||||
|
||||
RX r ("usage", false);
|
||||
if (p)
|
||||
out << " scp: "
|
||||
<< (r.match (buffer)
|
||||
? STRING_CMD_DIAG_FOUND
|
||||
: STRING_CMD_DIAG_MISSING)
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
if ((fp = popen ("/usr/bin/env rsync --version 2>&1", "r")))
|
||||
{
|
||||
char* p = fgets (buffer, 1023, fp);
|
||||
pclose (fp);
|
||||
|
||||
// rsync version 2.6.9 protocol version 29
|
||||
if (p)
|
||||
{
|
||||
RX r ("version ([0-9]+\\.[0-9]+\\.[0-9]+)", false);
|
||||
matches.clear ();
|
||||
r.match (matches, buffer);
|
||||
out << " rsync: "
|
||||
<< (matches.size () ? matches[0] : STRING_CMD_DIAG_MISSING)
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ((fp = popen ("/usr/bin/env curl --version 2>&1", "r")))
|
||||
{
|
||||
char* p = fgets (buffer, 1023, fp);
|
||||
pclose (fp);
|
||||
|
||||
// curl 7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
|
||||
if (p)
|
||||
{
|
||||
RX r ("curl ([0-9]+\\.[0-9]+\\.[0-9]+)", false);
|
||||
matches.clear ();
|
||||
r.match (matches, buffer);
|
||||
out << " curl: "
|
||||
<< (matches.size () ? matches[0] : STRING_CMD_DIAG_MISSING)
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
}
|
||||
|
||||
// Generate 1000 UUIDs and verify they are all unique.
|
||||
// Verify UUIDs are all unique.
|
||||
out << bold.colorize (STRING_CMD_DIAG_TESTS)
|
||||
<< "\n";
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
|
||||
// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -29,7 +28,6 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <Context.h>
|
||||
#include <Transport.h>
|
||||
#include <JSON.h>
|
||||
#include <text.h>
|
||||
#include <util.h>
|
||||
|
@ -55,7 +53,7 @@ int CmdImport::execute (std::string& output)
|
|||
int rc = 0;
|
||||
int count = 0;
|
||||
|
||||
// Use the description as a file name.
|
||||
// Use the description as a file name.
|
||||
std::vector <std::string> words = context.a3.extract_words ();
|
||||
if (! words.size ())
|
||||
throw std::string (STRING_CMD_IMPORT_NOFILE);
|
||||
|
@ -66,21 +64,6 @@ int CmdImport::execute (std::string& output)
|
|||
std::string file = *word;
|
||||
std::cout << format (STRING_CMD_IMPORT_FILE, file) << "\n";
|
||||
|
||||
std::string tmpfile = "";
|
||||
Uri uri (file);
|
||||
uri.parse ();
|
||||
|
||||
Transport* transport;
|
||||
if ((transport = Transport::getTransport (uri)) != NULL)
|
||||
{
|
||||
std::string location (context.config.get ("data.location"));
|
||||
tmpfile = location + "/import.data";
|
||||
transport->recv (tmpfile);
|
||||
delete transport;
|
||||
|
||||
file = tmpfile;
|
||||
}
|
||||
|
||||
// Load the file.
|
||||
std::vector <std::string> lines;
|
||||
File::read (file, lines);
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmake.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <Context.h>
|
||||
#include <Uri.h>
|
||||
#include <Transport.h>
|
||||
#include <assert.h>
|
||||
#include <i18n.h>
|
||||
#include <text.h>
|
||||
#include <util.h>
|
||||
#include <CmdMerge.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdMerge::CmdMerge ()
|
||||
{
|
||||
_keyword = "merge";
|
||||
_usage = "task merge <URL>";
|
||||
_description = STRING_CMD_MERGE_USAGE;
|
||||
_read_only = false;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdMerge::execute (std::string& output)
|
||||
{
|
||||
context.footnote ("The 'merge' command is deprecated, and will be removed in a subsequent release.");
|
||||
|
||||
// invoke gc and commit before merging in order to update data files
|
||||
context.tdb2.gc ();
|
||||
context.tdb2.commit ();
|
||||
|
||||
std::vector <std::string> words = context.a3.extract_words ();
|
||||
std::string file;
|
||||
if (words.size ())
|
||||
file = words[0];
|
||||
|
||||
std::string pushfile = "";
|
||||
std::string tmpfile = "";
|
||||
|
||||
std::string sAutopush = lowerCase (context.config.get ("merge.autopush"));
|
||||
bool bAutopush = context.config.getBoolean ("merge.autopush");
|
||||
|
||||
Uri uri (file, "merge");
|
||||
uri.parse();
|
||||
|
||||
if (uri._data.length ())
|
||||
{
|
||||
Directory location (context.config.get ("data.location"));
|
||||
|
||||
// be sure that uri points to a file
|
||||
uri.append ("undo.data");
|
||||
|
||||
Transport* transport;
|
||||
if ((transport = Transport::getTransport (uri)) != NULL )
|
||||
{
|
||||
tmpfile = location._data + "/undo_remote.data";
|
||||
transport->recv (tmpfile);
|
||||
delete transport;
|
||||
|
||||
file = tmpfile;
|
||||
}
|
||||
else
|
||||
file = uri._path;
|
||||
|
||||
// XXX the following function could indicate whether a modification was
|
||||
// performed without an exception (by returning a boolean, within a status
|
||||
// object or with a specific function)
|
||||
try
|
||||
{
|
||||
context.tdb2.merge (file);
|
||||
}
|
||||
catch (const std::string& e) {
|
||||
if (e == STRING_TDB2_UP_TO_DATE)
|
||||
{
|
||||
output += e + "\n";
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
throw e;
|
||||
}
|
||||
|
||||
output += std::string (STRING_CMD_MERGE_COMPLETE) + "\n";
|
||||
|
||||
if (tmpfile != "")
|
||||
remove (tmpfile.c_str ());
|
||||
|
||||
if (((sAutopush == "ask") && (confirm (format (STRING_CMD_MERGE_CONFIRM, uri.ToString ()))))
|
||||
|| (bAutopush))
|
||||
{
|
||||
// Derive autopush uri from merge.default.uri? otherwise: change prompt above
|
||||
|
||||
// Change the "merge" command to "push".
|
||||
std::vector <Arg>::iterator i;
|
||||
for (i = context.a3.begin (); i != context.a3.end (); ++i)
|
||||
{
|
||||
if (i->_category == Arg::cat_command)
|
||||
{
|
||||
i->_raw = "push";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Append the URI argument.
|
||||
context.a3.push_back (Arg (uri._data, Arg::cat_literal));
|
||||
|
||||
std::string out;
|
||||
assert (context.commands["push"]);
|
||||
context.commands["push"]->execute (out);
|
||||
}
|
||||
}
|
||||
else
|
||||
throw std::string (STRING_CMD_MERGE_NO_URI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,42 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDED_CMDMERGE
|
||||
#define INCLUDED_CMDMERGE
|
||||
|
||||
#include <string>
|
||||
#include <Command.h>
|
||||
|
||||
class CmdMerge : public Command
|
||||
{
|
||||
public:
|
||||
CmdMerge ();
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,123 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmake.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <Context.h>
|
||||
#include <Uri.h>
|
||||
#include <Transport.h>
|
||||
#include <i18n.h>
|
||||
#include <text.h>
|
||||
#include <CmdPull.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdPull::CmdPull ()
|
||||
{
|
||||
_keyword = "pull";
|
||||
_usage = "task pull <URL>";
|
||||
_description = STRING_CMD_PULL_USAGE;
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdPull::execute (std::string& output)
|
||||
{
|
||||
context.footnote ("The 'pull' command is deprecated, and will be removed in a subsequent release.");
|
||||
|
||||
std::vector <std::string> words = context.a3.extract_words ();
|
||||
std::string file;
|
||||
if (words.size ())
|
||||
file = words[0];
|
||||
|
||||
Uri uri (file, "pull");
|
||||
uri.parse ();
|
||||
|
||||
if (uri._data.length ())
|
||||
{
|
||||
Directory location (context.config.get ("data.location"));
|
||||
|
||||
if (! uri.append ("{pending,undo,completed}.data"))
|
||||
throw format (STRING_CMD_PULL_NOT_DIR, uri._path);
|
||||
|
||||
Transport* transport;
|
||||
if ((transport = Transport::getTransport (uri)) != NULL)
|
||||
{
|
||||
transport->recv (location._data + "/");
|
||||
delete transport;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Verify that files are not being copied from rc.data.location to the
|
||||
// same place.
|
||||
if (Directory (uri._path) == Directory (context.config.get ("data.location")))
|
||||
throw std::string (STRING_CMD_PULL_SAME);
|
||||
|
||||
// copy files locally
|
||||
|
||||
// remove {pending,undo,completed}.data
|
||||
uri._path = uri.parent();
|
||||
|
||||
Path path1 (uri._path + "undo.data");
|
||||
Path path2 (uri._path + "pending.data");
|
||||
Path path3 (uri._path + "completed.data");
|
||||
|
||||
if (path1.exists() && path2.exists() && path3.exists())
|
||||
{
|
||||
// if (confirm ("xxxxxxxxxxxxx"))
|
||||
// {
|
||||
std::ofstream ofile1 ((location._data + "/undo.data").c_str(), std::ios_base::binary);
|
||||
std::ifstream ifile1 (path1._data.c_str() , std::ios_base::binary);
|
||||
ofile1 << ifile1.rdbuf();
|
||||
|
||||
std::ofstream ofile2 ((location._data + "/pending.data").c_str(), std::ios_base::binary);
|
||||
std::ifstream ifile2 (path2._data.c_str() , std::ios_base::binary);
|
||||
ofile2 << ifile2.rdbuf();
|
||||
|
||||
std::ofstream ofile3 ((location._data + "/completed.data").c_str(), std::ios_base::binary);
|
||||
std::ifstream ifile3 (path3._data.c_str() , std::ios_base::binary);
|
||||
ofile3 << ifile3.rdbuf();
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
throw format (STRING_CMD_PULL_MISSING, uri._path);
|
||||
}
|
||||
}
|
||||
|
||||
output += format (STRING_CMD_PULL_TRANSFERRED, uri.ToString ()) + "\n";
|
||||
}
|
||||
else
|
||||
throw std::string (STRING_CMD_PULL_NO_URI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,42 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDED_CMDPULL
|
||||
#define INCLUDED_CMDPULL
|
||||
|
||||
#include <string>
|
||||
#include <Command.h>
|
||||
|
||||
class CmdPull : public Command
|
||||
{
|
||||
public:
|
||||
CmdPull ();
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,108 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmake.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <Context.h>
|
||||
#include <Uri.h>
|
||||
#include <Transport.h>
|
||||
#include <i18n.h>
|
||||
#include <text.h>
|
||||
#include <CmdPush.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdPush::CmdPush ()
|
||||
{
|
||||
_keyword = "push";
|
||||
_usage = "task push <URL>";
|
||||
_description = STRING_CMD_PUSH_USAGE;
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Transfers the local data (from rc.location._data) to the remote path.
|
||||
// Because this is potentially on another machine, no checking can be performed.
|
||||
int CmdPush::execute (std::string& output)
|
||||
{
|
||||
context.footnote ("The 'push' command is deprecated, and will be removed in a subsequent release.");
|
||||
|
||||
std::vector <std::string> words = context.a3.extract_words ();
|
||||
std::string file;
|
||||
if (words.size ())
|
||||
file = words[0];
|
||||
|
||||
Uri uri (file, "push");
|
||||
uri.parse ();
|
||||
|
||||
if (uri._data.length ())
|
||||
{
|
||||
Directory location (context.config.get ("data.location"));
|
||||
|
||||
Transport* transport;
|
||||
if ((transport = Transport::getTransport (uri)) != NULL )
|
||||
{
|
||||
std::vector<std::string> sourcelist;
|
||||
transport->send (location._data + "/{pending,undo,completed}.data");
|
||||
delete transport;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Verify that files are not being copied from rc.data.location to the
|
||||
// same place.
|
||||
if (Directory (uri._path) == Directory (context.config.get ("data.location")))
|
||||
throw std::string (STRING_CMD_PUSH_SAME);
|
||||
|
||||
// copy files locally
|
||||
if (! Path (uri._data).is_directory ())
|
||||
throw format (STRING_CMD_PUSH_NONLOCAL, uri._path);
|
||||
|
||||
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);
|
||||
ofile1 << ifile1.rdbuf();
|
||||
|
||||
std::ifstream ifile2 ((location._data + "/pending.data").c_str(), std::ios_base::binary);
|
||||
std::ofstream ofile2 ((uri._path + "/pending.data").c_str(), std::ios_base::binary);
|
||||
ofile2 << ifile2.rdbuf();
|
||||
|
||||
std::ifstream ifile3 ((location._data + "/completed.data").c_str(), std::ios_base::binary);
|
||||
std::ofstream ofile3 ((uri._path + "/completed.data").c_str(), std::ios_base::binary);
|
||||
ofile3 << ifile3.rdbuf();
|
||||
}
|
||||
|
||||
output += format (STRING_CMD_PUSH_TRANSFERRED, uri.ToString ()) + "\n";
|
||||
}
|
||||
else
|
||||
throw std::string (STRING_CMD_PUSH_NO_URI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,42 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2014, Paul Beckingham, Federico Hernandez.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDED_CMDPUSH
|
||||
#define INCLUDED_CMDPUSH
|
||||
|
||||
#include <string>
|
||||
#include <Command.h>
|
||||
|
||||
class CmdPush : public Command
|
||||
{
|
||||
public:
|
||||
CmdPush ();
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -36,7 +36,6 @@
|
|||
#include <Directory.h>
|
||||
#include <ViewText.h>
|
||||
#include <CmdShow.h>
|
||||
#include <Uri.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
|
@ -166,14 +165,10 @@ int CmdShow::execute (std::string& output)
|
|||
" list.all.tags"
|
||||
" locale"
|
||||
" locking"
|
||||
" merge.autopush" // Deprecated 2.3.0
|
||||
" merge.default.uri" // Deprecated 2.3.0
|
||||
" monthsperline"
|
||||
" nag"
|
||||
" patterns"
|
||||
" print.empty.columns"
|
||||
" pull.default.uri" // Deprecated 2.3.0
|
||||
" push.default.uri" // Deprecated 2.3.0
|
||||
" recurrence.indicator"
|
||||
" recurrence.limit"
|
||||
" regex"
|
||||
|
@ -236,9 +231,6 @@ int CmdShow::execute (std::string& output)
|
|||
i->first.substr (0, 7) != "report." &&
|
||||
i->first.substr (0, 6) != "alias." &&
|
||||
i->first.substr (0, 5) != "hook." &&
|
||||
i->first.substr (0, 5) != "push." && // Deprecated 2.3.0
|
||||
i->first.substr (0, 5) != "pull." && // Deprecated 2.3.0
|
||||
i->first.substr (0, 6) != "merge." && // Deprecated 2.3.0
|
||||
i->first.substr (0, 4) != "uda." &&
|
||||
i->first.substr (0, 4) != "default." &&
|
||||
i->first.substr (0, 21) != "urgency.user.project." &&
|
||||
|
|
|
@ -78,13 +78,6 @@ int CmdSync::execute (std::string& output)
|
|||
connection.rfind (':') == std::string::npos)
|
||||
throw std::string (STRING_CMD_SYNC_NO_SERVER);
|
||||
|
||||
// If push/pull/merge is configured, quit.
|
||||
if (context.config.get ("merge.autopush") != "" ||
|
||||
context.config.get ("merge.default.uri") != "" ||
|
||||
context.config.get ("push.default.uri") != "" ||
|
||||
context.config.get ("pull.default.uri") != "")
|
||||
throw std::string (STRING_CMD_SYNC_NOMERGE);
|
||||
|
||||
// Obtain credentials.
|
||||
std::string credentials_string = context.config.get ("taskd.credentials");
|
||||
if (credentials_string == "")
|
||||
|
|
|
@ -70,12 +70,9 @@
|
|||
//#include <CmdInstall.h>
|
||||
#include <CmdLog.h>
|
||||
#include <CmdLogo.h>
|
||||
#include <CmdMerge.h>
|
||||
#include <CmdModify.h>
|
||||
#include <CmdPrepend.h>
|
||||
#include <CmdProjects.h>
|
||||
#include <CmdPull.h>
|
||||
#include <CmdPush.h>
|
||||
#include <CmdReports.h>
|
||||
#include <CmdShow.h>
|
||||
#include <CmdStart.h>
|
||||
|
@ -146,12 +143,9 @@ void Command::factory (std::map <std::string, Command*>& all)
|
|||
// c = new CmdInstall (); all[c->keyword ()] = c;
|
||||
c = new CmdLog (); all[c->keyword ()] = c;
|
||||
c = new CmdLogo (); all[c->keyword ()] = c;
|
||||
c = new CmdMerge (); all[c->keyword ()] = c;
|
||||
c = new CmdModify (); all[c->keyword ()] = c;
|
||||
c = new CmdPrepend (); all[c->keyword ()] = c;
|
||||
c = new CmdProjects (); all[c->keyword ()] = c;
|
||||
c = new CmdPull (); all[c->keyword ()] = c;
|
||||
c = new CmdPush (); all[c->keyword ()] = c;
|
||||
c = new CmdReports (); all[c->keyword ()] = c;
|
||||
c = new CmdShow (); all[c->keyword ()] = c;
|
||||
c = new CmdShowRaw (); all[c->keyword ()] = c;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue