From 8b736934d77b5d3eefc8c934fde3868014c7897e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 18 Jan 2014 19:12:48 -0500 Subject: [PATCH] Code Cleanup - Removed deprecated 'push', 'pull' and 'merge' commands. --- ChangeLog | 1 + EXPOSITION | 6 +- NEWS | 5 +- scripts/bash/task.sh | 40 +- scripts/zsh/_task | 24 -- src/CMakeLists.txt | 7 - src/Hooks.cpp | 1 - src/TDB2.cpp | 647 -------------------------------- src/TDB2.h | 1 - src/Taskmod.cpp | 259 ------------- src/Taskmod.h | 89 ----- src/Transport.cpp | 166 -------- src/Transport.h | 61 --- src/TransportCurl.cpp | 136 ------- src/TransportCurl.h | 44 --- src/TransportRSYNC.cpp | 129 ------- src/TransportRSYNC.h | 44 --- src/TransportSSH.cpp | 121 ------ src/TransportSSH.h | 44 --- src/TransportShell.cpp | 101 ----- src/TransportShell.h | 44 --- src/Uri.cpp | 324 ---------------- src/Uri.h | 71 ---- src/commands/CMakeLists.txt | 3 - src/commands/CmdDiagnostics.cpp | 61 +-- src/commands/CmdImport.cpp | 21 +- src/commands/CmdMerge.cpp | 146 ------- src/commands/CmdMerge.h | 42 --- src/commands/CmdPull.cpp | 123 ------ src/commands/CmdPull.h | 42 --- src/commands/CmdPush.cpp | 108 ------ src/commands/CmdPush.h | 42 --- src/commands/CmdShow.cpp | 8 - src/commands/CmdSync.cpp | 7 - src/commands/Command.cpp | 6 - src/en-US.h | 49 --- src/es-ES.h | 50 --- src/fr-FR.h | 49 --- src/it-IT.h | 50 +-- src/legacy.cpp | 6 - test/CMakeLists.txt | 4 +- test/bug.1104.t | 200 ---------- test/bug.1117.t | 117 ------ test/bug.1192.t | 72 ---- test/bug.580.t | 107 ------ test/taskmod.t.cpp | 143 ------- test/uri.t.cpp | 142 ------- 47 files changed, 22 insertions(+), 3941 deletions(-) delete mode 100644 src/Taskmod.cpp delete mode 100644 src/Taskmod.h delete mode 100644 src/Transport.cpp delete mode 100644 src/Transport.h delete mode 100644 src/TransportCurl.cpp delete mode 100644 src/TransportCurl.h delete mode 100644 src/TransportRSYNC.cpp delete mode 100644 src/TransportRSYNC.h delete mode 100644 src/TransportSSH.cpp delete mode 100644 src/TransportSSH.h delete mode 100644 src/TransportShell.cpp delete mode 100644 src/TransportShell.h delete mode 100644 src/Uri.cpp delete mode 100644 src/Uri.h delete mode 100644 src/commands/CmdMerge.cpp delete mode 100644 src/commands/CmdMerge.h delete mode 100644 src/commands/CmdPull.cpp delete mode 100644 src/commands/CmdPull.h delete mode 100644 src/commands/CmdPush.cpp delete mode 100644 src/commands/CmdPush.h delete mode 100755 test/bug.1104.t delete mode 100755 test/bug.1117.t delete mode 100755 test/bug.1192.t delete mode 100755 test/bug.580.t delete mode 100644 test/taskmod.t.cpp delete mode 100644 test/uri.t.cpp diff --git a/ChangeLog b/ChangeLog index ea094b0b0..058ab144e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ Features token.. + Includes utility 'calc' for quick command line calculations using the new expression evaluator. + + Removed deprecated 'push', 'pull' and 'merge' commands. Bugs + Removed debugging code. diff --git a/EXPOSITION b/EXPOSITION index bf3e8f903..d88ba21e4 100644 --- a/EXPOSITION +++ b/EXPOSITION @@ -86,12 +86,10 @@ Files The completed.data file accumulates data over time, and grows unbounded. The undo.data file accumulates changes over time, and grows unbounded. It - provides all the necessary metadata to support the 'undo' command and the - 'merge' command. + provides all the necessary metadata to support the 'undo' command. The backlog.data file contains an accumulated set of changes that have not - been transmitted to the Taskserver. It grows unbounded between 'synch' - commands. + been transmitted to Taskserver. It grows unbounded between 'sync' commands. Filter diff --git a/NEWS b/NEWS index bb25945e3..c15164756 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ New Features in taskwarrior 2.4.0 - - + - Removed deprecated commands 'push', 'pull' and 'merge'. New commands in taskwarrior 2.4.0 @@ -9,10 +9,11 @@ New commands in taskwarrior 2.4.0 New configuration options in taskwarrior 2.4.0 + - Newly deprecated features in taskwarrior 2.4.0 - - + - Known Issues diff --git a/scripts/bash/task.sh b/scripts/bash/task.sh index 23986f4d9..147b76bc5 100644 --- a/scripts/bash/task.sh +++ b/scripts/bash/task.sh @@ -1,8 +1,6 @@ ################################################################################ -# bash completion support for taskwarrior -# 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 @@ -166,36 +164,18 @@ _task() COMPREPLY=( $(compgen -W "${config}" -- ${cur}) ) return 0 ;; - *) - case "${prev}" in - merge) - local servers=$(_task_get_config | grep merge | grep uri | sed 's/^merge\.\(.*\)\.uri/\1/') - COMPREPLY=( $(compgen -W "${servers}" -- ${cur}) ) - _known_hosts_real -a "$cur" - return 0 - ;; - push) - local servers=$(_task_get_config | grep push | grep uri | sed 's/^push\.\(.*\)\.uri/\1/') - COMPREPLY=( $(compgen -W "${servers}" -- ${cur}) ) - _known_hosts_real -a "$cur" - return 0 - ;; - pull) - local servers=$(_task_get_config | grep pull | grep uri | sed 's/^pull\.\(.*\)\.uri/\1/') - COMPREPLY=( $(compgen -W "${servers}" -- ${cur}) ) - _known_hosts_real -a "$cur" - return 0 - ;; - import) - COMPREPLY=( $(compgen -o "default" -- ${cur}) ) - return 0 - ;; - esac - ;; + *) + case "${prev}" in + import) + COMPREPLY=( $(compgen -o "default" -- ${cur}) ) + return 0 + ;; esac ;; + esac + ;; esac - + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 } diff --git a/scripts/zsh/_task b/scripts/zsh/_task index 13651937b..71dfc6b58 100644 --- a/scripts/zsh/_task +++ b/scripts/zsh/_task @@ -1,7 +1,4 @@ #compdef task -# zsh completion for taskwarrior -# -# taskwarrior - a command line task list manager. # # Copyright 2010 - 2014 Johannes Schlatow # Copyright 2009 P.C. Shyamshankar @@ -215,27 +212,6 @@ _task_filter() { _describe -t default 'task conjunctions' _task_conjunctions } -# merge completion -(( $+functions[_task_merge] )) || -_task_merge() { - # TODO match URIs in .taskrc - _files -} - -# push completion -(( $+functions[_task_push] )) || -_task_push() { - # TODO match URIs in .taskrc - _files -} - -# pull completion -(( $+functions[_task_pull] )) || -_task_pull() { - # TODO match URIs in .taskrc - _files -} - # execute completion (( $+functions[_task_execute] )) || _task_execute() { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a23eeaa22..b61809333 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,16 +30,9 @@ set (task_SRCS A3.cpp A3.h RX.cpp RX.h TDB2.cpp TDB2.h Task.cpp Task.h - Taskmod.cpp Taskmod.h Timer.cpp Timer.h TLSClient.cpp TLSClient.h - Transport.cpp Transport.h - TransportCurl.cpp TransportCurl.h - TransportRSYNC.cpp TransportRSYNC.h - TransportSSH.cpp TransportSSH.h - TransportShell.cpp TransportShell.h Tree.cpp Tree.h - Uri.cpp Uri.h Variant.cpp Variant.h ViewTask.cpp ViewTask.h ViewText.cpp ViewText.h diff --git a/src/Hooks.cpp b/src/Hooks.cpp index a5da7d9db..8a0ab0727 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -87,7 +87,6 @@ Hooks::Hooks () _validProgramEvents.push_back ("on-file-read"); // Unimplemented _validProgramEvents.push_back ("on-file-write"); // Unimplemented _validProgramEvents.push_back ("on-synch"); // Unimplemented - _validProgramEvents.push_back ("on-merge"); // Unimplemented _validProgramEvents.push_back ("on-gc"); // Unimplemented } diff --git a/src/TDB2.cpp b/src/TDB2.cpp index c04ccda11..a4e98aa90 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -44,22 +44,6 @@ extern Context context; -#define NDEBUG -#include -#include - -#define DEBUG_OUTPUT 0 - -#if DEBUG_OUTPUT > 0 - #define DEBUG_STR(str) std::cerr << "DEBUG: " << str << "\n"; std::cerr.flush() - #define DEBUG_STR_PART(str) std::cerr << "DEBUG: " << str; std::cerr.flush() - #define DEBUG_STR_END(str) std::cerr << str << "\n"; std::cerr.flush() -#else - #define DEBUG_STR(str) - #define DEBUG_STR_PART(str) - #define DEBUG_STR_END(str) -#endif - //////////////////////////////////////////////////////////////////////////////// TF2::TF2 () : _read_only (false) @@ -643,637 +627,6 @@ void TDB2::commit () context.timer_commit.stop (); } -//////////////////////////////////////////////////////////////////////////////// -// Helper function for TDB::merge -void readTaskmods (std::vector &input, - std::vector ::iterator &start, - std::list &list) -{ - static int resourceID = 1; - std::string line; - Taskmod tmod_tmp(resourceID++); - - DEBUG_STR ("reading taskmods from file: "); - - for ( ; start != input.end (); ++start) - { - line = *start; - - if (line.substr (0, 4) == "time") - { - std::stringstream stream (line.substr (5)); - long ts; - stream >> ts; - - if (stream.fail ()) - throw std::string (STRING_TDB2_UNDO_TIMESTAMP); - - // 'time' is the first line of a modification - // thus we will (re)set the taskmod object - tmod_tmp.reset (ts); - - } - else if (line.substr (0, 3) == "old") - { - tmod_tmp.setBefore (Task (line.substr (4))); - - } - else if (line.substr (0, 3) == "new") - { - tmod_tmp.setAfter (Task (line.substr (4))); - - // 'new' is the last line of a modification, - // thus we can push to the list - list.push_back (tmod_tmp); - - assert (tmod_tmp.isValid ()); - DEBUG_STR (" taskmod complete"); - } - } - - DEBUG_STR ("DONE"); -} - -//////////////////////////////////////////////////////////////////////////////// -void TDB2::merge (const std::string& mergeFile) -{ - /////////////////////////////////////// - // Copyright 2010 - 2014, Johannes Schlatow. - /////////////////////////////////////// - - // list of modifications that we want to add to the local database - std::list mods; - - // list of modifications that we want to add to the local history - std::list mods_history; - - // list of modifications on the local database - // has to be merged with mods to create the new undo.data - std::list lmods; - - // will contain the NEW undo.data - std::vector undo_lines; - - /////////////////////////////////////// - // initialize the files: - - // load merge file (undo file of right/remote branch) - std::vector r; - if (! File::read (mergeFile, r)) - throw format (STRING_TDB2_UNREADABLE, mergeFile); - - // file has to contain at least one entry - if (r.size () < 3) - throw std::string (STRING_TDB2_NO_CHANGES); - - if (! undo._file.exists ()) - undo._file.create (); - - // load undo file (left/local branch) - std::vector l; - if (! File::read (undo._file._data, l)) - throw format (STRING_TDB2_UNREADABLE, undo._file._data); - - std::string rline, lline; - std::vector ::iterator rit, lit; - - // read first line - rit = r.begin (); - lit = l.begin (); - - if (rit != r.end()) - rline = *rit; - if (lit != l.end()) - lline = *lit; - - /////////////////////////////////////// - // find the branch-off point: - - // first mods are not equal => assuming mergeFile starts at a - // later point in time - if (lline.compare (rline) == 0) { - std::vector::const_iterator tmp_lit = lit; - std::vector::const_iterator tmp_rit = rit; - tmp_lit++; - tmp_rit++; - - int lookahead = 1; - if (tmp_lit->substr (0, 3) == "old") { - lookahead = 2; - } - - while (lookahead--) { - if (tmp_lit->compare(*tmp_rit) != 0) { - break; - } - tmp_lit++; - tmp_rit++; - } - - if (lookahead == -1) { - // at this point we know that the first lines are the same - undo_lines.push_back (lline + "\n"); - } - } - - // Add some color. - Color colorAdded (context.config.get ("color.sync.added")); - Color colorChanged (context.config.get ("color.sync.changed")); - Color colorRejected (context.config.get ("color.sync.rejected")); - - // at this point we can assume: (lline==rline) || (lit == l.end()) - // thus we search for the first non-equal lines or the EOF - bool found = false; - for (std::vector::const_iterator tmp_lit = lit, tmp_rit = rit; - (tmp_lit != l.end ()) && (tmp_rit != r.end ()); - ++tmp_lit, ++tmp_rit) - { - lline = *tmp_lit; - rline = *tmp_rit; - - // found first non-matching lines? - if (lline.compare (rline) != 0) - { - found = true; - break; - } - else if (tmp_lit->substr (0, 3) == "---") - { - while (lit != tmp_lit) - { - ++lit; - ++rit; - undo_lines.push_back(*lit + "\n"); - } - // at this point, all iterators (tmp_{lit,rit}, lit and rit) are at the same line - } - } - - if (!found) - { - // set iterators to r.end() or l.end() if they point to the last line - if (++rit != r.end()) - --rit; - - if (++lit != l.end()) - --lit; - } - - /////////////////////////////////////// - // branch-off point found: - if (found) - { - DEBUG_STR_PART ("Branch-off point found at: "); - DEBUG_STR_END (lline); - - std::list rmods; - - // helper lists - std::set uuid_new, uuid_left; - - // 1. read taskmods out of the remaining lines - readTaskmods (r, rit, rmods); - readTaskmods (l, lit, lmods); - - // 2. move new uuids into mods - DEBUG_STR_PART ("adding new uuids (left) to skip list..."); - - // modifications on the left side are already in the database - // we just need them to merge conflicts, so we add the mods for - // new uuids to the skip-list 'uuid_left' - std::list::iterator lmod_it; - for (lmod_it = lmods.begin (); lmod_it != lmods.end (); lmod_it++) - { - if (lmod_it->isNew ()) - { -/* - // TODO Don't forget L10N. - std::cout << "New local task " - << (context.color () ? colorAdded.colorize (lmod_it->getUuid ()) : lmod_it->getUuid ()) - << "\n"; -*/ - - uuid_left.insert (lmod_it->getUuid ()); - } - } - - DEBUG_STR_END ("done"); - DEBUG_STR_PART ("move new uuids (right) to redo list..."); - - // new items on the right side need to be inserted into the - // local database - std::list::iterator rmod_it; - for (rmod_it = rmods.begin (); rmod_it != rmods.end (); ) - { - // we have to save and increment the iterator because we may want to delete - // the object from the list - std::list::iterator current = rmod_it++; - Taskmod tmod = *current; - - if (uuid_left.find (tmod.getUuid ()) != uuid_left.end ()) - { - // check whether the remote side has added a task with the same UUID - // this happens if it inserted a modification with an older timestamp - // into the undo.data and thereby moved the branch point to an earlier - // point in time. Normally this case will be solved by the merge logic, - // BUT if the UUID is considered new the merge logic will be skipped. - // - // This flaw resulted in a couple of duplication issues and bloated - // undo files (e.g. #1104). - // - // This is just a "hack" which discards all the modifications of the - // remote side to UUIDs that are considered new by both sides. - // There may be more issues with the algorithm; probably a redesign - // and proper encapsulation of the merge algorithm is due. - - rmods.erase(current); - } - else if (tmod.isNew ()) - { - // new uuid? -/* - // TODO Don't forget L10N. - std::cout << "Adding new remote task " - << (context.color () ? colorAdded.colorize (tmod.getUuid ()) : tmod.getUuid ()) - << "\n"; -*/ - - uuid_new.insert (tmod.getUuid ()); - mods.push_back (tmod); - rmods.erase (current); - } - else if (uuid_new.find (tmod.getUuid ()) != uuid_new.end ()) - { - // uuid of modification was new - mods.push_back (tmod); - rmods.erase (current); - } - } - - DEBUG_STR_END ("done"); - - /////////////////////////////////////// - // merge modifications: - DEBUG_STR ("Merging modifications:"); - - // we iterate backwards to resolve conflicts by timestamps (newest one wins) - std::list::reverse_iterator lmod_rit; - std::list::reverse_iterator rmod_rit; - for (lmod_rit = lmods.rbegin (); lmod_rit != lmods.rend (); ++lmod_rit) - { - Taskmod tmod_l = *lmod_rit; - std::string uuid = tmod_l.getUuid (); - - DEBUG_STR (" left uuid: " + uuid); - - // skip if uuid had already been merged - if (uuid_left.find (uuid) == uuid_left.end ()) - { - bool rwin = false; - bool lwin = false; - for (rmod_rit = rmods.rbegin (); rmod_rit != rmods.rend (); rmod_rit++) - { - Taskmod tmod_r = *rmod_rit; - - DEBUG_STR (" right uuid: " + tmod_r.getUuid ()); - if (tmod_r.getUuid () == uuid) - { - DEBUG_STR (" uuid match found for " + uuid); - - // we already decided to take the mods from the right side - // but we have to find the first modification newer than - // the one on the left side to merge the history too - if (rwin) - { - DEBUG_STR (" scanning right side"); - if (tmod_r > tmod_l) - mods.push_front (tmod_r); - - std::list::iterator tmp_it = rmod_rit.base (); - rmods.erase (--tmp_it); - rmod_rit--; - } - else if (lwin) - { - DEBUG_STR (" cleaning up right side"); - - // add tmod_r to local history - mods_history.push_front (tmod_r); - - std::list::iterator tmp_it = rmod_rit.base (); - rmods.erase (--tmp_it); - rmod_rit--; - } - else - { - // which one is newer? - if (tmod_r > tmod_l) - { - std::cout << format (STRING_TDB2_REMOTE_CHANGE, - (context.color () ? colorChanged.colorize (uuid) : uuid), - cutOff (tmod_r.getBefore ().get ("description"), 10)) - << "\n"; - - mods.push_front(tmod_r); - - // delete tmod from right side - std::list::iterator tmp_it = rmod_rit.base (); - rmods.erase (--tmp_it); - rmod_rit--; - - rwin = true; - } - else - { - std::cout << format (STRING_TDB2_LOCAL_CHANGE, - (context.color () ? colorChanged.colorize (uuid) : uuid), - cutOff (tmod_l.getBefore ().get ("description"), 10)) - << "\n"; - - // inserting right mod into history of local database - // so that it can be restored later - // AND more important: create a history that looks the same - // as if we switched the roles 'remote' and 'local' - - // thus we have to find the oldest change on the local branch that is not on remote branch - std::list::iterator lmod_it; - std::list::iterator last = lmod_it; - for (lmod_it = lmods.begin (); lmod_it != lmods.end (); ++lmod_it) { - if ((*lmod_it).getUuid () == uuid) { - last = lmod_it; - } - } - - if (tmod_l > tmod_r) { // local change is newer - last->setBefore(tmod_r.getAfter ()); - - // add tmod_r to local history - lmods.push_back(tmod_r); - } - else { // both mods have equal timestamps - // in this case the local branch wins as above, but the remote change with the - // same timestamp will be discarded - - // find next (i.e. older) mod of this uuid on remote side - std::list::reverse_iterator rmod_rit2; - for (rmod_rit2 = rmod_rit, ++rmod_rit2; rmod_rit2 != rmods.rend (); ++rmod_rit2) { - Taskmod tmp_mod = *rmod_rit2; - if (tmp_mod.getUuid () == uuid) { - last->setBefore (tmp_mod.getAfter ()); - break; - } - } - } - - // TODO feature: restore command? We would have to add a marker to the undo.file. - - // delete tmod from right side - std::list::iterator tmp_it = rmod_rit.base (); - rmods.erase (--tmp_it); - rmod_rit--; - - // mark this uuid as merged - uuid_left.insert (uuid); - lwin = true; - } - } - } - } // for - - if (rwin) - { - DEBUG_STR (" concat the first match to left branch"); - // concat the oldest (but still newer) modification on the right - // to the endpoint on the left - mods.front ().setBefore(tmod_l.getAfter ()); - } - } - } // for - - DEBUG_STR ("adding non-conflicting changes from the right branch"); - mods.splice (mods.begin (), rmods); - - DEBUG_STR ("sorting taskmod list"); - mods.sort (compareTaskmod); - mods_history.sort (compareTaskmod); - } - else if (rit == r.end ()) - { - // nothing happened on the remote branch - // local branch is up-to-date - - // nothing happened on the local branch either - - // break, to suppress autopush - if (lit == l.end ()) - { - mods.clear (); - lmods.clear (); - throw std::string (STRING_TDB2_UP_TO_DATE); - } - } - else // lit == l.end () - { - // nothing happened on the local branch -/* - std::cout << "No local changes detected.\n"; -*/ - - // add remaining lines (remote branch) to the list of modifications -/* - std::cout << "Remote changes detected.\n"; -*/ - readTaskmods (r, rit, mods); - } - - /////////////////////////////////////// - // Now apply the changes. - // redo command: - - if (!mods.empty ()) - { - std::vector pending_lines; - - std::vector completed_lines; - - if (! File::read (pending._file._data, pending_lines)) - throw format (STRING_TDB2_UNREADABLE, pending._file._data); - - if (! File::read (completed._file._data, completed_lines)) - throw format (STRING_TDB2_UNREADABLE, completed._file._data); - - // iterate over taskmod list - std::list::iterator it; - for (it = mods.begin (); it != mods.end (); ) - { - std::list::iterator current = it++; - Taskmod tmod = *current; - - // Modification to an existing task. - if (!tmod.isNew ()) - { - std::string uuid = tmod.getUuid (); - Task::status statusBefore = tmod.getBefore().getStatus (); - Task::status statusAfter = tmod.getAfter().getStatus (); - - std::vector ::iterator it; - - bool found = false; - if ( (statusBefore == Task::completed) - || (statusBefore == Task::deleted) ) - { - // Find the same uuid in completed data - for (it = completed_lines.begin (); it != completed_lines.end (); ++it) - { - if (it->find ("uuid:\"" + uuid) != std::string::npos) - { - // Update the completed record. -/* - std::cout << "Modifying " - << (context.color () ? colorChanged.colorize (uuid) : uuid) - << "\n"; -*/ - - std::string newline = tmod.getAfter ().composeF4 (); - - // does the tasks move to pending data? - // this taskmod will not arise from - // normal usage of task, but those kinds of - // taskmods may be constructed to merge databases - if ( (statusAfter != Task::completed) - && (statusAfter != Task::deleted) ) - { - // insert task into pending data - pending_lines.push_back (newline); - - // remove task from completed data - completed_lines.erase (it); - - } - else - { - // replace the current line - *it = newline; - } - - found = true; - break; - } - } - } - else - { - // Find the same uuid in the pending data. - for (it = pending_lines.begin (); it != pending_lines.end (); ++it) - { - if (it->find ("uuid:\"" + uuid) != std::string::npos) - { - // Update the pending record. - std::cout << format (STRING_TDB2_REMOTE_CHANGE, - (context.color () ? colorChanged.colorize (uuid) : uuid), - cutOff (tmod.getBefore ().get ("description"), 10)) - << "\n"; - - std::string newline = tmod.getAfter ().composeF4 (); - - // does the tasks move to completed data - if ( (statusAfter == Task::completed) - || (statusAfter == Task::deleted) ) - { - // insert task into completed data - completed_lines.push_back (newline); - - // remove task from pending data - pending_lines.erase (it); - - } - else - { - // replace the current line - *it = newline; - } - - found = true; - break; - } - } - } - - if (!found) - { - std::cout << format (STRING_TDB2_MISSING, - (context.color () ? colorRejected.colorize (uuid) : uuid), - cutOff (tmod.getBefore ().get ("description"), 10)) - << "\n"; - mods.erase (current); - } - } - else - { - // Check for dups. - std::string uuid = tmod.getAfter ().get ("uuid"); - - // Find the same uuid in the pending data. - bool found = false; - std::vector ::iterator pit; - for (pit = pending_lines.begin (); pit != pending_lines.end (); ++pit) - { - if (pit->find ("uuid:\"" + uuid) != std::string::npos) - { - found = true; - break; - } - } - - if (!found) - { - std::cout << format (STRING_TDB2_MERGING, - (context.color () ? colorAdded.colorize (uuid) : uuid), - cutOff (tmod.getAfter ().get ("description"), 10)) - << "\n"; - - pending_lines.push_back (tmod.getAfter ().composeF4 ()); - } - else - { - mods.erase (current); - } - } - } - - // write pending file - if (! File::write (pending._file._data, pending_lines)) - throw format (STRING_TDB2_UNWRITABLE, pending._file._data); - - // write completed file - if (! File::write (completed._file._data, completed_lines)) - throw format (STRING_TDB2_UNWRITABLE, completed._file._data); - } - - if (!mods.empty() || !lmods.empty() || !mods_history.empty()) { - // at this point undo contains the lines up to the branch-off point - // now we merge mods (new modifications from mergefile) - // with lmods (part of old undo.data) - lmods.sort(compareTaskmod); - mods.merge (lmods, compareTaskmod); - mods.merge (mods_history, compareTaskmod); - - // generate undo.data format - std::list::iterator it; - for (it = mods.begin (); it != mods.end (); it++) - undo_lines.push_back(it->toString ()); - - // write undo file - if (! File::write (undo._file._data, undo_lines, false)) - throw format (STRING_TDB2_UNWRITABLE, undo._file._data); - } - - // delete objects - lmods.clear (); - mods.clear (); - mods_history.clear (); -} - //////////////////////////////////////////////////////////////////////////////// void TDB2::revert () { diff --git a/src/TDB2.h b/src/TDB2.h index 3654f2761..94265ad48 100644 --- a/src/TDB2.h +++ b/src/TDB2.h @@ -103,7 +103,6 @@ public: void add (Task&, bool add_to_backlog = true); void modify (Task&, bool add_to_backlog = true); void commit (); - void merge (const std::string&); void revert (); int gc (); int next_id (); diff --git a/src/Taskmod.cpp b/src/Taskmod.cpp deleted file mode 100644 index 55fac47a8..000000000 --- a/src/Taskmod.cpp +++ /dev/null @@ -1,259 +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 -#include -#include -#include -#include -#include - -unsigned long Taskmod::curSequenceNumber = 0; - -bool compareTaskmod (Taskmod first, Taskmod second) -{ - if (first._timestamp == second._timestamp) - { - // preserve relative order within the same resource - if (first._resource == second._resource) - return first._sequenceNumber < second._sequenceNumber; - // sort by UUID if mods where made on different resources - else - return first._resource < second._resource; - } - else - { - return first._timestamp < second._timestamp; - } -} - -//////////////////////////////////////////////////////////////////////////////// -Taskmod::Taskmod () -{ - _timestamp = 0; - _bAfterSet = false; - _bBeforeSet = false; - _sequenceNumber = curSequenceNumber++; - _resource = -1; -} - -Taskmod::Taskmod (int resourceID) -{ - _timestamp = 0; - _bAfterSet = false; - _bBeforeSet = false; - _sequenceNumber = curSequenceNumber++; - _resource = resourceID; -} - -//////////////////////////////////////////////////////////////////////////////// -Taskmod::Taskmod (const Taskmod& other) -{ - this->_before = other._before; - this->_after = other._after; - this->_timestamp = other._timestamp; - this->_bAfterSet = other._bAfterSet; - this->_bBeforeSet = other._bBeforeSet; - this->_sequenceNumber = other._sequenceNumber; - this->_resource = other._resource; -} - -//////////////////////////////////////////////////////////////////////////////// -Taskmod::~Taskmod () -{ -} - -//////////////////////////////////////////////////////////////////////////////// -bool Taskmod::operator< (const Taskmod &compare) -{ - return (_timestamp < compare.getTimestamp ()); -} - -//////////////////////////////////////////////////////////////////////////////// -bool Taskmod::operator> (const Taskmod &compare) -{ - return (_timestamp > compare.getTimestamp ()); -} - -//////////////////////////////////////////////////////////////////////////////// -bool Taskmod::operator== (const Taskmod& compare) -{ - return ( (compare._after == this->_after) - && (compare._before == this->_before) - && (compare._timestamp == this->_timestamp) ); -} - -//////////////////////////////////////////////////////////////////////////////// -bool Taskmod::operator!= (const Taskmod& compare) -{ - return !this->operator== (compare); -} - -//////////////////////////////////////////////////////////////////////////////// -Taskmod& Taskmod::operator= (const Taskmod& other) -{ - if (this != &other) - { - this->_before = other._before; - this->_after = other._after; - this->_timestamp = other._timestamp; - this->_bAfterSet = other._bAfterSet; - this->_bBeforeSet = other._bBeforeSet; - this->_sequenceNumber = other._sequenceNumber; - this->_resource = other._resource; - } - - return *this; -} - -//////////////////////////////////////////////////////////////////////////////// -void Taskmod::reset (long timestamp) -{ - this->_bAfterSet = false; - this->_bBeforeSet = false; - this->_timestamp = timestamp; - this->_sequenceNumber = curSequenceNumber++; -} - -//////////////////////////////////////////////////////////////////////////////// -bool Taskmod::isNew () -{ - return !_bBeforeSet; -} - -//////////////////////////////////////////////////////////////////////////////// -bool Taskmod::issetAfter () -{ - return _bAfterSet; -} - -//////////////////////////////////////////////////////////////////////////////// -bool Taskmod::issetBefore () -{ - return _bBeforeSet; -} - -//////////////////////////////////////////////////////////////////////////////// -bool Taskmod::isValid () -{ - return (_timestamp > 0) && (_bAfterSet); -} - -//////////////////////////////////////////////////////////////////////////////// -std::string Taskmod::getUuid () -{ - if (!_bAfterSet) - throw std::string (STRING_TASKMOD_BAD_INIT); - - return _after.get ("uuid"); -} - -//////////////////////////////////////////////////////////////////////////////// -std::string Taskmod::toString () -{ - assert (_bAfterSet); - - std::stringstream stream; - stream << STRING_TASKMOD_TIME << _timestamp << "\n"; - - if (_bBeforeSet) - { - stream << STRING_TASKMOD_OLD << _before.composeF4() << "\n"; - } - - stream << STRING_TASKMOD_NEW << _after.composeF4() << "\n"; - stream << "---\n"; - - return stream.str (); -} - -//////////////////////////////////////////////////////////////////////////////// -void Taskmod::setAfter (const Task& after) -{ - this->_after = after; - this->_bAfterSet = true; -} - -//////////////////////////////////////////////////////////////////////////////// -void Taskmod::setBefore (const Task& before) -{ - this->_before = before; - this->_bBeforeSet = true; -} - -//////////////////////////////////////////////////////////////////////////////// -void Taskmod::setTimestamp (long timestamp) -{ - this->_timestamp = timestamp; -} - -//////////////////////////////////////////////////////////////////////////////// -void Taskmod::incSequenceNumber () -{ - this->_sequenceNumber++; -} - -//////////////////////////////////////////////////////////////////////////////// -Task& Taskmod::getAfter () -{ - return _after; -} - -//////////////////////////////////////////////////////////////////////////////// -Task& Taskmod::getBefore () -{ - return _before; -} - -//////////////////////////////////////////////////////////////////////////////// -long Taskmod::getTimestamp () const -{ - return _timestamp; -} - -//////////////////////////////////////////////////////////////////////////////// -unsigned long Taskmod::getSequenceNumber () const -{ - return _sequenceNumber; -} - -//////////////////////////////////////////////////////////////////////////////// -int Taskmod::getResource () const -{ - return _resource; -} - -//////////////////////////////////////////////////////////////////////////////// -std::string Taskmod::getTimeStr () const -{ - std::stringstream sstream; - sstream << _timestamp; - - return sstream.str (); -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Taskmod.h b/src/Taskmod.h deleted file mode 100644 index a1b394f4d..000000000 --- a/src/Taskmod.h +++ /dev/null @@ -1,89 +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_TASKMOD -#define INCLUDED_TASKMOD - -#include -#include - -class Taskmod { - friend bool compareTaskmod (Taskmod first, Taskmod second); - -public: - Taskmod (); - Taskmod (int resourceID); - Taskmod (const Taskmod& other); - ~Taskmod (); - - // operators - bool operator< (const Taskmod& compare); - bool operator> (const Taskmod& compare); - bool operator== (const Taskmod& compare); - bool operator!= (const Taskmod& compare); - Taskmod& operator= (const Taskmod& other); - - // helper - void reset (long timestamp=0); - bool isNew (); - bool issetBefore (); - bool issetAfter (); - bool isValid (); - - std::string getUuid (); - std::string toString (); - - // setter - void setAfter (const Task& after); - void setBefore (const Task& before); - void setTimestamp (long timestamp); - void incSequenceNumber (); - - // getter - Task& getAfter (); - Task& getBefore (); - long getTimestamp () const; - unsigned long getSequenceNumber () const; - int getResource () const; - std::string getTimeStr () const; - -protected: - Task _after; - Task _before; - long _timestamp; - bool _bAfterSet; - bool _bBeforeSet; - unsigned long _sequenceNumber; - int _resource; - - static unsigned long curSequenceNumber; -}; - -bool compareTaskmod (Taskmod first, Taskmod second); - -#endif - diff --git a/src/Transport.cpp b/src/Transport.cpp deleted file mode 100644 index f69b0c1bd..000000000 --- a/src/Transport.cpp +++ /dev/null @@ -1,166 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -Transport::Transport (const Uri& uri) -{ - _executable = ""; - this->_uri = uri; -} - -//////////////////////////////////////////////////////////////////////////////// -Transport::~Transport () -{ -} - -//////////////////////////////////////////////////////////////////////////////// -Transport* Transport::getTransport(const Uri& uri) -{ - if (uri._protocol == "ssh") - { - return new TransportSSH(uri); - } - else if (uri._protocol == "rsync") - { - return new TransportRSYNC(uri); - } - else if ( (uri._protocol == "http") - || (uri._protocol == "https") - || (uri._protocol == "ftp") ) - { - return new TransportCurl(uri); - } - else if ( uri._protocol == "sh+cp") - { - return new TransportShell(uri); - } - - return NULL; -} - -//////////////////////////////////////////////////////////////////////////////// -int Transport::execute() -{ - // quote arguments - std::vector::iterator it = _arguments.begin (); - for (; it != _arguments.end (); it++) - { - // quote until the first appearance of '{' - size_t pos = it->find('{'); - if (pos != 0) - { - // '{' is not the first character - it->insert(0, "\""); - if (pos != std::string::npos) - it->insert(pos+1, "\""); - else - it->append("\""); - } - } - int result = ::execute (_executable, _arguments); - int err; - switch (result) - { - case 127: - throw format (STRING_TRANSPORT_NORUN, _executable); - case -1: - err = errno; - throw format (STRING_TRANSPORT_NOFORK, _executable, ::strerror(err)); - default: - return result; - } -} - -//////////////////////////////////////////////////////////////////////////////// -bool Transport::is_directory(const std::string& path) -{ - return path[path.length()-1] == '/'; -} - - -//////////////////////////////////////////////////////////////////////////////// -bool Transport::is_filelist(const std::string& path) -{ - return (path.find ("*") != std::string::npos) - || (path.find ("?") != std::string::npos) - || (path.find ("{") != std::string::npos); -} - -//////////////////////////////////////////////////////////////////////////////// -void Transport::expand_braces(const std::string& path, - const std::string& sourceortarget, - std::vector& paths) -{ - // Is is_filelist appropriate here? We only care about {} - if (is_filelist(path)) - { - std::string::size_type pos; - pos = path.find("{"); - - if (pos == std::string::npos) - throw std::string (STRING_TRANSPORT_CURL_WILDCD); - - if (!is_directory(sourceortarget)) - throw format (STRING_TRANSPORT_URI_NODIR, sourceortarget); - - std::string toSplit; - std::string suffix; - std::string prefix = path.substr (0, pos); - std::vector splitted; - toSplit = path.substr (pos+1); - pos = toSplit.find ("}"); - suffix = toSplit.substr (pos+1); - split (splitted, toSplit.substr(0, pos), ','); - - std::vector ::iterator file; - for (file = splitted.begin (); file != splitted.end (); ++file) { - std::cout << " -- " << (prefix + *file + suffix) << "\n"; - paths.push_back (prefix + *file + suffix); - } - } - else - { - // Not brace expandable - use the path as is. - paths.push_back (path); - } -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Transport.h b/src/Transport.h deleted file mode 100644 index 1e8591fb7..000000000 --- a/src/Transport.h +++ /dev/null @@ -1,61 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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_TRANSPORT -#define INCLUDED_TRANSPORT - -#include -#include -#include - -class Transport { -public: - Transport (const Uri&); - virtual ~Transport (); - - static Transport* getTransport(const Uri&); - - virtual void send (const std::string&) = 0; - virtual void recv (std::string) = 0; - - void expand_braces(const std::string& path, const std::string& sourceortarget, - std::vector& paths); - - static bool is_directory(const std::string&); - static bool is_filelist(const std::string&); - -protected: - std::string _executable; - std::vector _arguments; - - Uri _uri; - - int execute(); -}; - -#endif - diff --git a/src/TransportCurl.cpp b/src/TransportCurl.cpp deleted file mode 100644 index be6c4fcba..000000000 --- a/src/TransportCurl.cpp +++ /dev/null @@ -1,136 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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 -#include -#include -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -TransportCurl::TransportCurl(const Uri& uri) : Transport(uri) -{ - _executable = "curl"; -} - -//////////////////////////////////////////////////////////////////////////////// -void TransportCurl::send(const std::string& source) -{ - std::vector sourcelist; - std::vector::const_iterator source_iter; - - if (_uri._host == "") - throw std::string (STRING_TRANSPORT_CURL_URI); - - if (_uri._user != "") - { - _arguments.push_back("--user"); - _arguments.push_back(_uri._user); - } - - if (is_filelist (source)) { - expand_braces (source, _uri._data, sourcelist); - // Is there more than one source? - // Then path has to end with a '/' - if (sourcelist.size () > 1 && !_uri.is_directory ()) - throw format (STRING_TRANSPORT_URI_NODIR, _uri); - - for (source_iter = sourcelist.begin (); source_iter != sourcelist.end (); ++source_iter) { - _arguments.push_back ("-T"); - _arguments.push_back ("\"" + escape (*source_iter, ' ') + "\""); - } - } - else - { - _arguments.push_back ("-T"); - _arguments.push_back ("\"" + escape (source, ' ') + "\""); - } - - // cmd line is: curl -T source protocol://host:port/path - if (_uri._port != "") - { - _arguments.push_back (_uri._protocol + "://" + _uri._host + ":" + _uri._port + "/" + _uri._path); - } - else - { - _arguments.push_back (_uri._protocol + "://" + _uri._host + "/" + _uri._path); - } - - if (execute ()) - throw std::string (STRING_TRANSPORT_CURL_FAIL); -} - -//////////////////////////////////////////////////////////////////////////////// -void TransportCurl::recv(std::string target) -{ - if (_uri._host == "") - throw std::string (STRING_TRANSPORT_CURL_URI); - - if (_uri._user != "") - { - _arguments.push_back("--user"); - _arguments.push_back(_uri._user); - } - - std::vector targetargs; - - if (is_filelist(_uri._path)) - { - - std::vector paths; - expand_braces (_uri._path, target, paths); - - std::vector ::iterator file; - for (file = paths.begin (); file != paths.end (); ++file) { - targetargs.push_back ("-o"); - targetargs.push_back (*file); - } - } - else - { - targetargs.push_back ("-o"); - targetargs.push_back (target); - } - - // cmd line is: curl protocol://host:port/path/to/source/file -o path/to/target/file - if (_uri._port != "") - { - _arguments.push_back (_uri._protocol + "://" + _uri._host + ":" + _uri._port + "/" + _uri._path); - } - else - { - _arguments.push_back (_uri._protocol + "://" + _uri._host + "/" + _uri._path); - } - - _arguments.insert (_arguments.end (), targetargs.begin (), targetargs.end ()); - - if (execute ()) - throw std::string (STRING_TRANSPORT_CURL_FAIL); -} - -//////////////////////////////////////////////////////////////////////////////// -// vim: ts=2 sw=2 et diff --git a/src/TransportCurl.h b/src/TransportCurl.h deleted file mode 100644 index 538e99180..000000000 --- a/src/TransportCurl.h +++ /dev/null @@ -1,44 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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_TRANSPORTCURL -#define INCLUDED_TRANSPORTCURL - -#include -#include - -class TransportCurl : public Transport { -public: - TransportCurl (const Uri&); - - virtual void send (const std::string&); - virtual void recv (std::string); -}; - -#endif - - diff --git a/src/TransportRSYNC.cpp b/src/TransportRSYNC.cpp deleted file mode 100644 index ba82bb617..000000000 --- a/src/TransportRSYNC.cpp +++ /dev/null @@ -1,129 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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 -#include -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -TransportRSYNC::TransportRSYNC(const Uri& uri) : Transport(uri) -{ - _executable = "rsync"; -} - -//////////////////////////////////////////////////////////////////////////////// -void TransportRSYNC::send(const std::string& source) -{ - std::vector sourcelist; - std::vector::const_iterator source_iter; - - if (_uri._host == "") - throw std::string (STRING_TRANSPORT_RSYNC_URI); - - // cmd line is: rsync [--port=PORT] source [user@]host::path - if (_uri._port != "") - { - _arguments.push_back ("--port=" + _uri._port); - } - - if (is_filelist (source)) - { - expand_braces (source, _uri._data, sourcelist); - // Is there more than one file to transfer? - // Then path has to end with a '/' - if (sourcelist.size () > 1 && !_uri.is_directory ()) - throw format (STRING_TRANSPORT_URI_NODIR, _uri); - - for (source_iter = sourcelist.begin (); source_iter != sourcelist.end (); ++source_iter) { - _arguments.push_back (*source_iter); - } - } - else - { - _arguments.push_back (source); - } - - if (_uri._user != "") - { - _arguments.push_back (_uri._user + "@" + _uri._host + "::" + _uri._path); - } - else - { - _arguments.push_back (_uri._host + "::" + _uri._path); - } - - if (execute ()) - throw std::string (STRING_TRANSPORT_RSYNC_FAIL); -} - -//////////////////////////////////////////////////////////////////////////////// -void TransportRSYNC::recv(std::string target) -{ - std::vector paths; - std::vector::const_iterator paths_iter; - - if (_uri._host == "") - throw std::string (STRING_TRANSPORT_RSYNC_URI); - - // cmd line is: rsync [--port=PORT] [user@]host::path target - if (_uri._port != "") - _arguments.push_back ("--port=" + _uri._port); - - if (is_filelist(_uri._path)) { - - // Rsync servers do not to {} expansion, so we have to do it on the client. - expand_braces (_uri._path, target, paths); - - // Is there more than one file to transfer? - // Then target has to end with a '/' - if (paths.size () > 1 && ! is_directory (target)) - throw format (STRING_TRANSPORT_URI_NODIR, target); - - for (paths_iter = paths.begin (); paths_iter != paths.end (); ++paths_iter) { - if (_uri._user != "") - { - _arguments.push_back (_uri._user + "@" + _uri._host + "::" + *paths_iter); - } - else - { - _arguments.push_back (_uri._host + "::" + *paths_iter); - } - } - } - else - { - _arguments.push_back (_uri._host + "::" + _uri._path); - } - - _arguments.push_back (target); - - if (execute ()) - throw std::string (STRING_TRANSPORT_RSYNC_FAIL); -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/TransportRSYNC.h b/src/TransportRSYNC.h deleted file mode 100644 index 724910888..000000000 --- a/src/TransportRSYNC.h +++ /dev/null @@ -1,44 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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_TRANSPORTRSYNC -#define INCLUDED_TRANSPORTRSYNC - -#include -#include - -class TransportRSYNC : public Transport { -public: - TransportRSYNC (const Uri&); - - virtual void send (const std::string&); - virtual void recv (std::string); - -}; - -#endif - diff --git a/src/TransportSSH.cpp b/src/TransportSSH.cpp deleted file mode 100644 index e857a0da1..000000000 --- a/src/TransportSSH.cpp +++ /dev/null @@ -1,121 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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 -#include -#include -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -TransportSSH::TransportSSH(const Uri& uri) : Transport(uri) -{ - _executable = "scp"; -} - -//////////////////////////////////////////////////////////////////////////////// -void TransportSSH::send(const std::string& source) -{ - std::vector sourcelist; - std::vector::const_iterator source_iter; - - if (_uri._host == "") - throw std::string (STRING_TRANSPORT_SSH_URI); - - // cmd line is: scp [-p port] [user@]host:path - if (_uri._port != "") - { - _arguments.push_back ("-P"); - _arguments.push_back (_uri._port); - } - - if (is_filelist (source)) - { - expand_braces (source, _uri._data, sourcelist); - // Is there more than one source? - // Then path has to end with a '/' - if (sourcelist.size () > 1 && !_uri.is_directory ()) - throw format (STRING_TRANSPORT_URI_NODIR, _uri); - - for (source_iter = sourcelist.begin (); source_iter != sourcelist.end (); ++source_iter) { - _arguments.push_back (*source_iter); - } - } - else - { - _arguments.push_back (source); - } - - if (_uri._user != "") - { - _arguments.push_back (_uri._user + "@" + _uri._host + ":" + escape (_uri._path, ' ')); - } - else - { - _arguments.push_back (_uri._host + ":" + escape (_uri._path, ' ')); - } - - if (execute ()) - throw std::string (STRING_TRANSPORT_SSH_FAIL); -} - -//////////////////////////////////////////////////////////////////////////////// -void TransportSSH::recv(std::string target) -{ - if (_uri._host == "") - throw std::string (STRING_TRANSPORT_SSH_URI); - - // Is there more than one file to transfer? - // Then target has to end with a '/' - if (is_filelist(_uri._path) && !is_directory(target)) - throw format (STRING_TRANSPORT_URI_NODIR, target); - - // cmd line is: scp [-p port] [user@]host:path - if (_uri._port != "") - { - _arguments.push_back ("-P"); - _arguments.push_back (_uri._port); - } - - // We do not do {} expansion of the URI, as ssh servers do that for us. - - if (_uri._user != "") - { - _arguments.push_back (_uri._user + "@" + _uri._host + ":" + escape (_uri._path, ' ')); - } - else - { - _arguments.push_back (_uri._host + ":" + escape (_uri._path, ' ')); - } - - _arguments.push_back (target); - - if (execute ()) - throw std::string (STRING_TRANSPORT_SSH_FAIL); -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/TransportSSH.h b/src/TransportSSH.h deleted file mode 100644 index 275a27052..000000000 --- a/src/TransportSSH.h +++ /dev/null @@ -1,44 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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_TRANSPORTSSH -#define INCLUDED_TRANSPORTSSH - -#include -#include - -class TransportSSH : public Transport { -public: - TransportSSH (const Uri&); - - virtual void send (const std::string&); - virtual void recv (std::string); - -}; - -#endif - diff --git a/src/TransportShell.cpp b/src/TransportShell.cpp deleted file mode 100644 index 3a4b0e0d6..000000000 --- a/src/TransportShell.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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 -#include -#include -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -TransportShell::TransportShell(const Uri& uri) : Transport(uri) -{ - _executable = "cp"; -} - -//////////////////////////////////////////////////////////////////////////////// -void TransportShell::send(const std::string& source) -{ - std::vector sourcelist; - std::vector::const_iterator source_iter; - - if (_uri._path == "") - throw std::string (STRING_TRANSPORT_SHELL_NOPATH); - - if (is_filelist(source)) - { - expand_braces (source, _uri._path, sourcelist); - // Is there more than one file to transfer? - // Then path has to end with a '/' - if (sourcelist.size() > 1 && !_uri.is_directory()) - throw format (STRING_TRANSPORT_URI_NODIR, _uri._path); - for (source_iter = sourcelist.begin (); source_iter != sourcelist.end (); ++source_iter) - _arguments.push_back (*source_iter); - } - else - { - _arguments.push_back (source); - } - _arguments.push_back (_uri._path); - - if (execute ()) - throw std::string (STRING_TRANSPORT_SHELL_FAIL); -} - -//////////////////////////////////////////////////////////////////////////////// -void TransportShell::recv(std::string target) -{ - std::vector paths; - std::vector::const_iterator paths_iter; - - if (_uri._path == "") - throw std::string (STRING_TRANSPORT_SHELL_NOPATH); - - if (is_filelist(_uri._path)) - { - expand_braces (_uri._path, target, paths); - - // Is there more than one file to transfer? - // Then target has to end with a '/' - if (paths.size() > 1 && !is_directory(target)) - throw format (STRING_TRANSPORT_URI_NODIR, target); - - for (paths_iter = paths.begin (); paths_iter != paths.end (); ++paths_iter) - _arguments.push_back (*paths_iter); - } - else - { - _arguments.push_back (_uri._path); - } - - _arguments.push_back (target); - - if (execute ()) - throw std::string (STRING_TRANSPORT_SHELL_FAIL); -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/TransportShell.h b/src/TransportShell.h deleted file mode 100644 index 8ff0d2a34..000000000 --- a/src/TransportShell.h +++ /dev/null @@ -1,44 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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_TRANSPORTSHELL -#define INCLUDED_TRANSPORTSHELL - -#include -#include - -class TransportShell : public Transport { -public: - TransportShell (const Uri&); - - virtual void send (const std::string&); - virtual void recv (std::string); - -}; - -#endif - diff --git a/src/Uri.cpp b/src/Uri.cpp deleted file mode 100644 index 5522fc4f4..000000000 --- a/src/Uri.cpp +++ /dev/null @@ -1,324 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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 -#include -#include -#include -#include - -extern Context context; - -//////////////////////////////////////////////////////////////////////////////// -Uri::Uri () -{ - _parsed = false; -} - -//////////////////////////////////////////////////////////////////////////////// -Uri::Uri (const Uri& other) -{ - if (this != &other) - { - _data = other._data; - _host = other._host; - _path = other._path; - _user = other._user; - _port = other._port; - _protocol = other._protocol; - _parsed = other._parsed; - } -} - -//////////////////////////////////////////////////////////////////////////////// -Uri::Uri (const std::string& in, const std::string& configPrefix) -{ - _data = in; - _parsed = false; - if (configPrefix != "") - expand(configPrefix); -} - -//////////////////////////////////////////////////////////////////////////////// -Uri::~Uri () -{ -} - -//////////////////////////////////////////////////////////////////////////////// -Uri& Uri::operator= (const Uri& other) -{ - if (this != &other) - { - this->_data = other._data; - this->_host = other._host; - this->_path = other._path; - this->_user = other._user; - this->_port = other._port; - this->_protocol = other._protocol; - this->_parsed = other._parsed; - } - - return *this; -} - -//////////////////////////////////////////////////////////////////////////////// -Uri::operator std::string () const -{ - return _data; -} - -//////////////////////////////////////////////////////////////////////////////// -std::string Uri::name () const -{ - if (_path.length ()) - { - std::string::size_type slash = _path.rfind ('/'); - if (slash != std::string::npos) - return _path.substr (slash + 1, std::string::npos); - } - - return _path; -} - -//////////////////////////////////////////////////////////////////////////////// -std::string Uri::parent () const -{ - if (_path.length ()) - { - std::string::size_type slash = _path.rfind ('/'); - if (slash != std::string::npos) - return _path.substr (0, slash+1); - } - - return ""; -} - -//////////////////////////////////////////////////////////////////////////////// -std::string Uri::extension () const -{ - if (_path.length ()) - { - std::string::size_type dot = _path.rfind ('.'); - if (dot != std::string::npos) - return _path.substr (dot + 1, std::string::npos); - } - - return ""; -} - -//////////////////////////////////////////////////////////////////////////////// -bool Uri::is_directory () const -{ - if (is_local ()) { - return Path (this->_data).is_directory (); - } else - return (_path == ".") - || (_path == "") - || (_path[_path.length()-1] == '/'); -} - -//////////////////////////////////////////////////////////////////////////////// -bool Uri::is_local () const -{ - if (_parsed) - return (_protocol == ""); - else - return ( (_data.find("://") == std::string::npos) - && (_data.find(":") == std::string::npos) ); -} - -//////////////////////////////////////////////////////////////////////////////// -bool Uri::append (const std::string& path) -{ - if (is_directory ()) - { - this->_path += path; - return true; - } - else - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -bool Uri::expand (const std::string& configPrefix ) -{ - std::string tmp; - if (_data.length ()) - { - // try to replace argument with uri from config - tmp = context.config.get (configPrefix + "." + _data + ".uri"); - } - else - { - // get default target from config - tmp = context.config.get (configPrefix + ".default.uri"); - } - - if (tmp != "") - { - _data = tmp; - return true; - } - - return false; -} - -//////////////////////////////////////////////////////////////////////////////// -std::string Uri::ToString () -{ - if (!_parsed) - return std::string (); - - if (is_local ()) - return _data; - - // No password to obscure, return the original. - if (_protocol == "sh+cp") - return _data; - - std::string result; - result = _protocol + "://"; - - if (_user.length () > 0) { - // obscure password in _user - std::string::size_type pos = _user.find (":"); - if (pos != std::string::npos) { - std::string::size_type len = _user.length () - pos - 1; - result += _user.replace (pos+1, len, len, '*') + "@"; - } - else - result += _user + "@"; - } - - result += _host; - - if (_port.length () > 0) - result += + ":" + _port; - - result += "/" + _path; - - return result; -} - -//////////////////////////////////////////////////////////////////////////////// -void Uri::parse () -{ - if (_parsed) - return; - - if (is_local ()) - { - _path = _data; - _parsed = true; - return; - } - - std::string::size_type pos; - std::string _data = this->_data; - std::string pathDelimiter = "/"; - - _user = ""; - _port = ""; - - // skip ^.*:// - if ((pos = _data.find ("://")) != std::string::npos) - { - _protocol = _data.substr(0, pos); - _data = _data.substr (pos+3); - // standard syntax: protocol://[user@]host.xz[:port]/path/to/undo.data - pathDelimiter = "/"; - } - else - { - _protocol = "ssh"; - // scp-like syntax: [user@]host.xz:path/to/undo.data - pathDelimiter = ":"; - } - - if (_protocol == "sh+cp") - { - _path = _data; - _parsed = true; - return; - } - - // user delimited by single quotes? - if ( _data[0] == '\'' - && (pos = _data.find("'", 1)) != std::string::npos ) - { - if (_data[pos+1] == '@') - { - // end of user name - _user = _data.substr (1, pos-1); - _data = _data.substr (pos+2); - } - else - { - throw std::string (format (STRING_URI_QUOTES, _data)); - } - } - else - { - // find user name - if ((pos = _data.find ("@")) != std::string::npos) - { - _user = _data.substr (0, pos); - _data = _data.substr (pos+1); - } - } - - // get host, port and path - if ((pos = _data.find (pathDelimiter)) != std::string::npos) - { - _host = _data.substr (0, pos); - _path = _data.substr (pos+1); - } - else - { - throw std::string (format (STRING_URI_BAD_FORMAT, _data)); - } - - // path is absolute for ssh:// syntax - if ( (_protocol == "ssh") && (pathDelimiter == "/") && (_path[0] != '~') ) - { - _path = "/" + _path; - } - - // port specified? - // remark: this find() will never be != npos for scp-like syntax - // because we found pathDelimiter, which is ":", before - if ((pos = _host.find (":")) != std::string::npos) - { - _port = _host.substr (pos+1); - _host = _host.substr (0,pos); - } - - _parsed = true; -} - -//////////////////////////////////////////////////////////////////////////////// -// vim: et ts=2 sw=2 diff --git a/src/Uri.h b/src/Uri.h deleted file mode 100644 index 63ad92cff..000000000 --- a/src/Uri.h +++ /dev/null @@ -1,71 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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_URI -#define INCLUDED_URI - -#include -#include - -// supports the following syntaxes: -// protocol://[user@]host.tld[:port]/path -// [user@]host:path -// path/to/local/file.ext -// alias (e.g. merge.alias.uri) -class Uri -{ -public: - Uri (); - Uri (const Uri&); - Uri (const std::string&, const std::string& configPrefix=""); - virtual ~Uri (); - - Uri& operator= (const Uri&); - operator std::string () const; - - std::string name () const; - std::string parent () const; - std::string extension () const; - std::string ToString(); - bool is_directory () const; - bool is_local () const; - bool append (const std::string&); - bool expand (const std::string&); - void parse (); - -public: - std::string _data; - std::string _path; - std::string _host; - std::string _port; - std::string _user; - std::string _protocol; - bool _parsed; -}; - -#endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CMakeLists.txt b/src/commands/CMakeLists.txt index 781330642..d9bec2e3a 100644 --- a/src/commands/CMakeLists.txt +++ b/src/commands/CMakeLists.txt @@ -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 diff --git a/src/commands/CmdDiagnostics.cpp b/src/commands/CmdDiagnostics.cpp index 0168df525..294447f99 100644 --- a/src/commands/CmdDiagnostics.cpp +++ b/src/commands/CmdDiagnostics.cpp @@ -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 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"; { diff --git a/src/commands/CmdImport.cpp b/src/commands/CmdImport.cpp index 4ed54bbcc..374e6d8c3 100644 --- a/src/commands/CmdImport.cpp +++ b/src/commands/CmdImport.cpp @@ -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 #include #include -#include #include #include #include @@ -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 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 lines; File::read (file, lines); diff --git a/src/commands/CmdMerge.cpp b/src/commands/CmdMerge.cpp deleted file mode 100644 index ad4b55313..000000000 --- a/src/commands/CmdMerge.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern Context context; - -//////////////////////////////////////////////////////////////////////////////// -CmdMerge::CmdMerge () -{ - _keyword = "merge"; - _usage = "task merge "; - _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 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 ::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; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CmdMerge.h b/src/commands/CmdMerge.h deleted file mode 100644 index a67730f1a..000000000 --- a/src/commands/CmdMerge.h +++ /dev/null @@ -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 -#include - -class CmdMerge : public Command -{ -public: - CmdMerge (); - int execute (std::string&); -}; - -#endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CmdPull.cpp b/src/commands/CmdPull.cpp deleted file mode 100644 index fb02844a1..000000000 --- a/src/commands/CmdPull.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include - -extern Context context; - -//////////////////////////////////////////////////////////////////////////////// -CmdPull::CmdPull () -{ - _keyword = "pull"; - _usage = "task pull "; - _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 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; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CmdPull.h b/src/commands/CmdPull.h deleted file mode 100644 index 3dfa0532a..000000000 --- a/src/commands/CmdPull.h +++ /dev/null @@ -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 -#include - -class CmdPull : public Command -{ -public: - CmdPull (); - int execute (std::string&); -}; - -#endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CmdPush.cpp b/src/commands/CmdPush.cpp deleted file mode 100644 index adf2f0649..000000000 --- a/src/commands/CmdPush.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include - -extern Context context; - -//////////////////////////////////////////////////////////////////////////////// -CmdPush::CmdPush () -{ - _keyword = "push"; - _usage = "task push "; - _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 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 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; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CmdPush.h b/src/commands/CmdPush.h deleted file mode 100644 index c5892d216..000000000 --- a/src/commands/CmdPush.h +++ /dev/null @@ -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 -#include - -class CmdPush : public Command -{ -public: - CmdPush (); - int execute (std::string&); -}; - -#endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/commands/CmdShow.cpp b/src/commands/CmdShow.cpp index 688b461ca..80b34fa79 100644 --- a/src/commands/CmdShow.cpp +++ b/src/commands/CmdShow.cpp @@ -36,7 +36,6 @@ #include #include #include -#include 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." && diff --git a/src/commands/CmdSync.cpp b/src/commands/CmdSync.cpp index 72dd848cd..eb26e76af 100644 --- a/src/commands/CmdSync.cpp +++ b/src/commands/CmdSync.cpp @@ -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 == "") diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index 8877f0e51..9fde7ce3a 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -70,12 +70,9 @@ //#include #include #include -#include #include #include #include -#include -#include #include #include #include @@ -146,12 +143,9 @@ void Command::factory (std::map & 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; diff --git a/src/en-US.h b/src/en-US.h index 5b9763ec6..5e74af37f 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -428,7 +428,6 @@ #define STRING_CMD_SYNC_BAD_CA "CA certificate not found." #define STRING_CMD_SYNC_CONNECT "Could not connect to {1} {2}" #define STRING_CMD_SYNC_HANDSHAKE "Handshake failed. {1}" -#define STRING_CMD_SYNC_NOMERGE "Task push/pull/merge is configured, deprecated, and does not work with 'sync'." #define STRING_CMD_SYNC_TRUST_CA "You should either provide a CA certificate or override verification, but not both." #define STRING_CMD_DIAG_USAGE "Platform, build and environment details" #define STRING_CMD_DIAG_PLATFORM "Platform" @@ -444,23 +443,11 @@ #define STRING_CMD_DIAG_ENABLED "Enabled" #define STRING_CMD_DIAG_DISABLED "Disabled" #define STRING_CMD_DIAG_CONFIG "Configuration" -#define STRING_CMD_DIAG_EXTERNAL "External Utilities" #define STRING_CMD_DIAG_TESTS "Tests" #define STRING_CMD_DIAG_UUID_SCAN "Scanned {1} tasks for duplicate UUIDs:" #define STRING_CMD_DIAG_UUID_DUP "Found duplicate {1}" #define STRING_CMD_DIAG_UUID_NO_DUP "No duplicates found" #define STRING_CMD_DIAG_NONE "-none-" -#define STRING_CMD_PUSH_USAGE "Pushes the local files to the URL" -#define STRING_CMD_PUSH_SAME "Cannot push files when the source and destination are the same." -#define STRING_CMD_PUSH_NONLOCAL "The uri '{1}' is not a local directory." -#define STRING_CMD_PUSH_TRANSFERRED "Local tasks transferred to {1}" -#define STRING_CMD_PUSH_NO_URI "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." -#define STRING_CMD_PULL_USAGE "Pulls remote files from the URL" -#define STRING_CMD_PULL_SAME "Cannot pull files when the source and destination are the same." -#define STRING_CMD_PULL_TRANSFERRED "Local tasks transferred from {1}" -#define STRING_CMD_PULL_NO_URI "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." -#define STRING_CMD_PULL_MISSING "At least one of the database files in '{1}' is not present." -#define STRING_CMD_PULL_NOT_DIR "The uri '{1}' is not a directory. Did you forget a trailing '/'?" #define STRING_CMD_HCOMMANDS_USAGE "Generates a list of all commands, for autocompletion purposes" #define STRING_CMD_ZSHCOMMANDS_USAGE "Generates a list of all commands, for zsh autocompletion purposes" #define STRING_CMD_ALIASES_USAGE "Generates a list of all aliases, for autocompletion purposes" @@ -512,10 +499,6 @@ #define STRING_CMD_TIMESHEET_USAGE "Weekly summary of completed and started tasks" #define STRING_CMD_TIMESHEET_STARTED "Started ({1} tasks)" #define STRING_CMD_TIMESHEET_DONE "Completed ({1} tasks)" -#define STRING_CMD_MERGE_USAGE "Merges the remote files with the local files" -#define STRING_CMD_MERGE_COMPLETE "Merge complete." -#define STRING_CMD_MERGE_CONFIRM "Would you like to push the merged changes to '{1}'?" -#define STRING_CMD_MERGE_NO_URI "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." #define STRING_CMD_BURN_USAGE_M "Shows a graphical burndown chart, by month" #define STRING_CMD_BURN_USAGE_W "Shows a graphical burndown chart, by week" #define STRING_CMD_BURN_USAGE_D "Shows a graphical burndown chart, by day" @@ -804,24 +787,10 @@ #define STRING_TASK_SAFETY_VALVE "This command has no filter, and will modify all tasks. Are you sure?" #define STRING_TASK_SAFETY_FAIL "Command prevented from running." -// Taskmod -#define STRING_TASKMOD_BAD_INIT "Taskmod::getUuid(): Task object not initialized." -#define STRING_TASKMOD_TIME "time " -#define STRING_TASKMOD_OLD "old " -#define STRING_TASKMOD_NEW "new " - // TDB2 #define STRING_TDB2_PARSE_ERROR " in {1} at line {2}" #define STRING_TDB2_UUID_NOT_UNIQUE "Cannot add task because the uuid '{1}' is not unique." -#define STRING_TDB2_UNDO_TIMESTAMP "There was a problem reading the timestamp from the undo.data file." -#define STRING_TDB2_UNREADABLE "Could not read '{1}'." -#define STRING_TDB2_UNWRITABLE "Could not write '{1}'." -#define STRING_TDB2_NO_CHANGES "There are no changes to merge." -#define STRING_TDB2_REMOTE_CHANGE "Found remote change to {1} \"{2}\"" -#define STRING_TDB2_LOCAL_CHANGE "Retaining local changes to {1} \"{2}\"" #define STRING_TDB2_MISSING "Missing {1} \"{2}\"" -#define STRING_TDB2_MERGING "Merging new remote task {1} \"{2}\"" -#define STRING_TDB2_UP_TO_DATE "Database is up-to-date, no merge required." #define STRING_TDB2_NO_UNDO "There are no recorded transactions to undo." #define STRING_TDB2_LAST_MOD "The last modification was made {1}" #define STRING_TDB2_UNDO_PRIOR "Prior Values" @@ -841,24 +810,6 @@ // A comma-separated list of commands is appended. #define STRING_TEXT_AMBIGUOUS "Ambiguous {1} '{2}' - could be either of " -// Transport -#define STRING_TRANSPORT_NORUN "Could not run '{1}'. Is it installed, and available in $PATH?" -#define STRING_TRANSPORT_NOFORK "Could not run '{1}': {2}. Are you out of system resources?" -#define STRING_TRANSPORT_URI_NODIR "The uri '{1}' does not appear to be a directory." -#define STRING_TRANSPORT_CURL_URI "When using the 'curl' protocol, the uri must contain a hostname." -#define STRING_TRANSPORT_CURL_WILDCD "When using the 'curl' protocol, wildcards are not supported." -#define STRING_TRANSPORT_CURL_FAIL "Curl failed, see output above." -#define STRING_TRANSPORT_RSYNC_URI "When using the 'rsync' protocol, the uri must contain a hostname." -#define STRING_TRANSPORT_RSYNC_FAIL "rsync failed, see output above." -#define STRING_TRANSPORT_SSH_URI "When using the 'ssh' protocol, the uri must contain a hostname." -#define STRING_TRANSPORT_SSH_FAIL "ssh failed, see output above." -#define STRING_TRANSPORT_SHELL_NOPATH "When using the 'sh+cp' protocol to copy multiple files, a path must be specified." -#define STRING_TRANSPORT_SHELL_FAIL "shell command failed, see output above." - -// Uri -#define STRING_URI_QUOTES "Could not parse uri '{1}', wrong usage of single quotes." -#define STRING_URI_BAD_FORMAT "The uri '{1}' is not in the expected format." - // utf8 #define STRING_UTF8_INVALID_CP_REP "Invalid codepoint representation." #define STRING_UTF8_INVALID_CP "Invalid Unicode codepoint." diff --git a/src/es-ES.h b/src/es-ES.h index 433288acd..6665f8ec3 100644 --- a/src/es-ES.h +++ b/src/es-ES.h @@ -439,7 +439,6 @@ #define STRING_CMD_SYNC_BAD_CA "Certificado CA no encontrado." #define STRING_CMD_SYNC_CONNECT "No se pudo conectar a {1} {2}" #define STRING_CMD_SYNC_HANDSHAKE "Handshake fallido. {1}" -#define STRING_CMD_SYNC_NOMERGE "Task push/pull/merge está configurado, en desuso, y no trabaja con 'sync'." #define STRING_CMD_SYNC_TRUST_CA "Debe proveer un certificado CA o la verificación de sobrescritura, pero no ambos." #define STRING_CMD_DIAG_USAGE "Detalles de plataforma, construcción y entorno" #define STRING_CMD_DIAG_PLATFORM "Plataforma" @@ -455,23 +454,11 @@ #define STRING_CMD_DIAG_ENABLED "Habilitado" #define STRING_CMD_DIAG_DISABLED "deshabilitado" #define STRING_CMD_DIAG_CONFIG "Configuración" -#define STRING_CMD_DIAG_EXTERNAL "Utilidades externas" #define STRING_CMD_DIAG_TESTS "Comprobaciones" #define STRING_CMD_DIAG_UUID_SCAN "Exploradas {1} tareas buscando UUIDs duplicados:" #define STRING_CMD_DIAG_UUID_DUP "Encontrado duplicado {1}" #define STRING_CMD_DIAG_UUID_NO_DUP "No se encontraron duplicados" #define STRING_CMD_DIAG_NONE "-ninguno-" -#define STRING_CMD_PUSH_USAGE "Envía los archivos locales al URL" -#define STRING_CMD_PUSH_SAME "No se puede enviar archivos cuando origen y destino son los mismos." -#define STRING_CMD_PUSH_NONLOCAL "El uri '{1}' no es un directorio local." -#define STRING_CMD_PUSH_TRANSFERRED "Tareas locales transferidas a {1}" -#define STRING_CMD_PUSH_NO_URI "No se especificó un uri pera el envío. Especifique el uri de un directorio .task remoto, o cree una entrada 'push.default.uri' en su archivo .taskrc ." -#define STRING_CMD_PULL_USAGE "Trae archivos remotos desde el URL" -#define STRING_CMD_PULL_SAME "No se puede traer archivos cuando origen y destino son los mismos." -#define STRING_CMD_PULL_TRANSFERRED "Tareas locales transferidas desde {1}" -#define STRING_CMD_PULL_NO_URI "No se especificó un uri desde el que traer. Especifique el uri de un directorio .task remoto, o cree una entrada 'pull.default.uri' en su archivo .taskrc ." -#define STRING_CMD_PULL_MISSING "Al menos uno de los archivos de base de datos en '{1}' no está presente." -#define STRING_CMD_PULL_NOT_DIR "El uri '{1}' no es un directorio. ¿Olvidó un '/' final?" #define STRING_CMD_HCOMMANDS_USAGE "Genera una lista de todos los comandos, con fines de auto-completado" #define STRING_CMD_ZSHCOMMANDS_USAGE "Genera una lista de todos los comandos, con fines de auto-completado zsh" #define STRING_CMD_ALIASES_USAGE "Genera una lista de todos los alias, con fines de auto-completado" @@ -526,10 +513,6 @@ #define STRING_CMD_TIMESHEET_USAGE "Resumen semanal de tareas completadas y comenzadas" #define STRING_CMD_TIMESHEET_STARTED "Comenzadas ({1} tareas)" #define STRING_CMD_TIMESHEET_DONE "Completadas ({1} tareas)" -#define STRING_CMD_MERGE_USAGE "Combina los archivos remotos con los locales" -#define STRING_CMD_MERGE_COMPLETE "Combinación completa." -#define STRING_CMD_MERGE_CONFIRM "¿Quiere propagar los cambios combinados a '{1}'?" -#define STRING_CMD_MERGE_NO_URI "No se especificó un uri para el combinado. Especifique el uri de un directorio .task remoto, o cree una entrada 'merge.default.uri' en su archivo .taskrc ." #define STRING_CMD_BURN_USAGE_M "Muestra un diagrama burndown, por meses" #define STRING_CMD_BURN_USAGE_W "Muestra un diagrama burndown, por semanas" #define STRING_CMD_BURN_USAGE_D "Muestra un diagrama burndown, por días" @@ -818,25 +801,11 @@ #define STRING_TASK_SAFETY_VALVE "Este comando no tiene filtro, y modificará todas las tareas. ¿Está seguro?" #define STRING_TASK_SAFETY_FAIL "Se impidió la ejecución del comando." -// Taskmod -#define STRING_TASKMOD_BAD_INIT "Taskmod::getUuid(): objeto Task no inicializado." -#define STRING_TASKMOD_TIME "tiempo " -#define STRING_TASKMOD_OLD "antiguo " -#define STRING_TASKMOD_NEW "nuevo " - // TDB2 #define STRING_TDB2_PARSE_ERROR " en {1} en la línea {2}" #define STRING_TDB2_UUID_NOT_UNIQUE "No se puede añadir la tarea porque el uuid '{1}' no es único." -#define STRING_TDB2_UNDO_TIMESTAMP "Hubo un problema al leer la marca de tiempo del archivo undo.data ." -#define STRING_TDB2_UNREADABLE "No se puede leer '{1}'." -#define STRING_TDB2_UNWRITABLE "No se puede escribir '{1}'." -#define STRING_TDB2_NO_CHANGES "No hay cambios para combinar." -#define STRING_TDB2_REMOTE_CHANGE "Encontrado cambio remoto en {1} \"{2}\"" -#define STRING_TDB2_LOCAL_CHANGE "Reteniendo cambios locales a {1} \"{2}\"" #define STRING_TDB2_MISSING "Falta {1} \"{2}\"" -#define STRING_TDB2_MERGING "Combinando tarea remota nueva {1} \"{2}\"" -#define STRING_TDB2_UP_TO_DATE "La base de datos está actualizada, no se requiere combinación." #define STRING_TDB2_NO_UNDO "No hay transacciones registradas para deshacer." #define STRING_TDB2_LAST_MOD "La última modificación fue hecha {1}" #define STRING_TDB2_UNDO_PRIOR "Valores Previos" @@ -857,25 +826,6 @@ // A comma-separated list of commands is appended. #define STRING_TEXT_AMBIGUOUS "Ambiguo {1} '{2}' - puede ser " -// Transport -#define STRING_TRANSPORT_NORUN "No se pudo lanzar '{1}'. ¿Está instalado y disponible en $PATH?" -#define STRING_TRANSPORT_NOFORK "No se pudo ejecutar '{1}': {2}. ¿Puede ser que su sistema esté sin recursos?" - -#define STRING_TRANSPORT_URI_NODIR "El uri '{1}' no parece ser un directorio." -#define STRING_TRANSPORT_CURL_URI "Cuando se usa el protocolo 'curl' el uri debe contener un nombre de máquina." -#define STRING_TRANSPORT_CURL_WILDCD "Cuando se usa el protocolo 'curl' no están soportados los comodines." -#define STRING_TRANSPORT_CURL_FAIL "Curl falló, consulte los mensajes precedentes." -#define STRING_TRANSPORT_RSYNC_URI "Cuando se usa el protocolo 'rsync' el uri debe contener un nombre de máquina." -#define STRING_TRANSPORT_RSYNC_FAIL "Rsync falló, consulte los mensajes precedentes." -#define STRING_TRANSPORT_SSH_URI "Cuando se usa el protocolo 'ssh' el uri debe contener un nombre de máquina." -#define STRING_TRANSPORT_SSH_FAIL "Ssh falló, consulte los mensajes precedentes." -#define STRING_TRANSPORT_SHELL_NOPATH "Cuando se utiliza el protocolo 'sh + cp' para copiar varios archivos se debe especificar un path." -#define STRING_TRANSPORT_SHELL_FAIL "Fallo de comando del entorno, consulte la salida anterior." - -// Uri -#define STRING_URI_QUOTES "No se pudo interpretar el uri '{1}', uso erróneo de comillas simples." -#define STRING_URI_BAD_FORMAT "El uri '{1}' no está en el formato esperado." - // utf8 #define STRING_UTF8_INVALID_CP_REP "Representación de codepoint no válida." #define STRING_UTF8_INVALID_CP "Codepoint Unicode no válido." diff --git a/src/fr-FR.h b/src/fr-FR.h index bb9db10bc..780c4bf7c 100644 --- a/src/fr-FR.h +++ b/src/fr-FR.h @@ -428,7 +428,6 @@ #define STRING_CMD_SYNC_BAD_CA "CA certificate not found." #define STRING_CMD_SYNC_CONNECT "Could not connect to {1} {2}" #define STRING_CMD_SYNC_HANDSHAKE "Handshake failed. {1}" -#define STRING_CMD_SYNC_NOMERGE "Task push/pull/merge is configured, deprecated, and does not work with 'sync'." #define STRING_CMD_SYNC_TRUST_CA "You should either provide a CA certificate or override verification, but not both." #define STRING_CMD_DIAG_USAGE "Platform, build and environment details" #define STRING_CMD_DIAG_PLATFORM "Platform" @@ -444,23 +443,11 @@ #define STRING_CMD_DIAG_ENABLED "Enabled" #define STRING_CMD_DIAG_DISABLED "Disabled" #define STRING_CMD_DIAG_CONFIG "Configuration" -#define STRING_CMD_DIAG_EXTERNAL "External Utilities" #define STRING_CMD_DIAG_TESTS "Tests" #define STRING_CMD_DIAG_UUID_SCAN "Scanned {1} tasks for duplicate UUIDs:" #define STRING_CMD_DIAG_UUID_DUP "Found duplicate {1}" #define STRING_CMD_DIAG_UUID_NO_DUP "No duplicates found" #define STRING_CMD_DIAG_NONE "-none-" -#define STRING_CMD_PUSH_USAGE "Pushes the local files to the URL" -#define STRING_CMD_PUSH_SAME "Cannot push files when the source and destination are the same." -#define STRING_CMD_PUSH_NONLOCAL "The uri '{1}' is not a local directory." -#define STRING_CMD_PUSH_TRANSFERRED "Local tasks transferred to {1}" -#define STRING_CMD_PUSH_NO_URI "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." -#define STRING_CMD_PULL_USAGE "Pulls remote files from the URL" -#define STRING_CMD_PULL_SAME "Cannot pull files when the source and destination are the same." -#define STRING_CMD_PULL_TRANSFERRED "Local tasks transferred from {1}" -#define STRING_CMD_PULL_NO_URI "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." -#define STRING_CMD_PULL_MISSING "At least one of the database files in '{1}' is not present." -#define STRING_CMD_PULL_NOT_DIR "The uri '{1}' is not a directory. Did you forget a trailing '/'?" #define STRING_CMD_HCOMMANDS_USAGE "Generates a list of all commands, for autocompletion purposes" #define STRING_CMD_ZSHCOMMANDS_USAGE "Generates a list of all commands, for zsh autocompletion purposes" #define STRING_CMD_ALIASES_USAGE "Generates a list of all aliases, for autocompletion purposes" @@ -512,10 +499,6 @@ #define STRING_CMD_TIMESHEET_USAGE "Weekly summary of completed and started tasks" #define STRING_CMD_TIMESHEET_STARTED "Started ({1} tasks)" #define STRING_CMD_TIMESHEET_DONE "Completed ({1} tasks)" -#define STRING_CMD_MERGE_USAGE "Merges the remote files with the local files" -#define STRING_CMD_MERGE_COMPLETE "Merge complete." -#define STRING_CMD_MERGE_CONFIRM "Would you like to push the merged changes to '{1}'?" -#define STRING_CMD_MERGE_NO_URI "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." #define STRING_CMD_BURN_USAGE_M "Shows a graphical burndown chart, by month" #define STRING_CMD_BURN_USAGE_W "Shows a graphical burndown chart, by week" #define STRING_CMD_BURN_USAGE_D "Shows a graphical burndown chart, by day" @@ -804,24 +787,10 @@ #define STRING_TASK_SAFETY_VALVE "This command has no filter, and will modify all tasks. Are you sure?" #define STRING_TASK_SAFETY_FAIL "Command prevented from running." -// Taskmod -#define STRING_TASKMOD_BAD_INIT "Taskmod::getUuid(): Task object not initialized." -#define STRING_TASKMOD_TIME "time " -#define STRING_TASKMOD_OLD "old " -#define STRING_TASKMOD_NEW "new " - // TDB2 #define STRING_TDB2_PARSE_ERROR " in {1} at line {2}" #define STRING_TDB2_UUID_NOT_UNIQUE "Cannot add task because the uuid '{1}' is not unique." -#define STRING_TDB2_UNDO_TIMESTAMP "There was a problem reading the timestamp from the undo.data file." -#define STRING_TDB2_UNREADABLE "Could not read '{1}'." -#define STRING_TDB2_UNWRITABLE "Could not write '{1}'." -#define STRING_TDB2_NO_CHANGES "There are no changes to merge." -#define STRING_TDB2_REMOTE_CHANGE "Found remote change to {1} \"{2}\"" -#define STRING_TDB2_LOCAL_CHANGE "Retaining local changes to {1} \"{2}\"" #define STRING_TDB2_MISSING "Missing {1} \"{2}\"" -#define STRING_TDB2_MERGING "Merging new remote task {1} \"{2}\"" -#define STRING_TDB2_UP_TO_DATE "Database is up-to-date, no merge required." #define STRING_TDB2_NO_UNDO "There are no recorded transactions to undo." #define STRING_TDB2_LAST_MOD "The last modification was made {1}" #define STRING_TDB2_UNDO_PRIOR "Prior Values" @@ -841,24 +810,6 @@ // A comma-separated list of commands is appended. #define STRING_TEXT_AMBIGUOUS "Ambiguous {1} '{2}' - could be either of " -// Transport -#define STRING_TRANSPORT_NORUN "Could not run '{1}'. Is it installed, and available in $PATH?" -#define STRING_TRANSPORT_NOFORK "Could not run '{1}': {2}. Are you out of system resources?" -#define STRING_TRANSPORT_URI_NODIR "The uri '{1}' does not appear to be a directory." -#define STRING_TRANSPORT_CURL_URI "When using the 'curl' protocol, the uri must contain a hostname." -#define STRING_TRANSPORT_CURL_WILDCD "When using the 'curl' protocol, wildcards are not supported." -#define STRING_TRANSPORT_CURL_FAIL "Curl failed, see output above." -#define STRING_TRANSPORT_RSYNC_URI "When using the 'rsync' protocol, the uri must contain a hostname." -#define STRING_TRANSPORT_RSYNC_FAIL "rsync failed, see output above." -#define STRING_TRANSPORT_SSH_URI "When using the 'ssh' protocol, the uri must contain a hostname." -#define STRING_TRANSPORT_SSH_FAIL "ssh failed, see output above." -#define STRING_TRANSPORT_SHELL_NOPATH "When using the 'sh+cp' protocol to copy multiple files, a path must be specified." -#define STRING_TRANSPORT_SHELL_FAIL "shell command failed, see output above." - -// Uri -#define STRING_URI_QUOTES "Could not parse uri '{1}', wrong usage of single quotes." -#define STRING_URI_BAD_FORMAT "The uri '{1}' is not in the expected format." - // utf8 #define STRING_UTF8_INVALID_CP_REP "Invalid codepoint representation." #define STRING_UTF8_INVALID_CP "Invalid Unicode codepoint." diff --git a/src/it-IT.h b/src/it-IT.h index f16e8b123..710a2fdf5 100644 --- a/src/it-IT.h +++ b/src/it-IT.h @@ -429,7 +429,6 @@ #define STRING_CMD_SYNC_BAD_CA "CA certificate not found." #define STRING_CMD_SYNC_CONNECT "Could not connect to {1} {2}" #define STRING_CMD_SYNC_HANDSHAKE "Handshake failed. {1}" -#define STRING_CMD_SYNC_NOMERGE "Task push/pull/merge is configured, deprecated, and does not work with 'sync'." #define STRING_CMD_SYNC_TRUST_CA "You should either provide a CA certificate or override verification, but not both." #define STRING_CMD_DIAG_USAGE "Dettagli su piattaforma, build e ambiente" #define STRING_CMD_DIAG_PLATFORM "Piattaforma" @@ -445,23 +444,11 @@ #define STRING_CMD_DIAG_ENABLED "Abilitato" #define STRING_CMD_DIAG_DISABLED "Disabilitato" #define STRING_CMD_DIAG_CONFIG "Configurazione" -#define STRING_CMD_DIAG_EXTERNAL "Utility esterne" #define STRING_CMD_DIAG_TESTS "Test" #define STRING_CMD_DIAG_UUID_SCAN "Valutati {1} task per duplicazione UUID:" #define STRING_CMD_DIAG_UUID_DUP "Trovato duplicato {1}" #define STRING_CMD_DIAG_UUID_NO_DUP "Nessun duplicato trovato" #define STRING_CMD_DIAG_NONE "-nessuno-" -#define STRING_CMD_PUSH_USAGE "Carica i file locali all'URL" -#define STRING_CMD_PUSH_SAME "Impossibile caricare i file se sorgente e destinazione coincidono." -#define STRING_CMD_PUSH_NONLOCAL "L'uri '{1}' non è una directory locale." -#define STRING_CMD_PUSH_TRANSFERRED "Task locali trasferiti su {1}" -#define STRING_CMD_PUSH_NO_URI "Nessun uri è stato specificato per il caricamento. Specificare o l'uri di una directory .task remota, oppure creare la voce 'push.default.uri' nel file .taskrc." -#define STRING_CMD_PULL_USAGE "Scaricati file dall'URL" -#define STRING_CMD_PULL_SAME "Impossibile scaricare i file se sorgente e destinazione coincidono." -#define STRING_CMD_PULL_TRANSFERRED "Task locali trasferiti da {1}" -#define STRING_CMD_PULL_NO_URI "Nessun uri è stato specificato per lo scaricamento. Specificare o l'uri di una directory .task remota, oppure creare la voce 'pull.default.uri' nel file .taskrc." -#define STRING_CMD_PULL_MISSING "Almeno uno dei file di database in '{1}' non è presente." -#define STRING_CMD_PULL_NOT_DIR "L'uri '{1}' non è una directory. Dimenticato il carattere '/'?" #define STRING_CMD_HCOMMANDS_USAGE "Genera la lista di tutti i comandi, per autocompletamento" #define STRING_CMD_ZSHCOMMANDS_USAGE "Genera la lista di tutti i comandi, per autocompletamento in zsh" #define STRING_CMD_ALIASES_USAGE "Genera la lista di tutti gli alias, per autocompletamento" @@ -513,10 +500,6 @@ #define STRING_CMD_TIMESHEET_USAGE "Sommario settimanale dei task completati e avviati" #define STRING_CMD_TIMESHEET_STARTED "Avviati ({1} task)" #define STRING_CMD_TIMESHEET_DONE "Completati ({1} task)" -#define STRING_CMD_MERGE_USAGE "Unisce i file remoti con i file locali" -#define STRING_CMD_MERGE_COMPLETE "Unione completata." -#define STRING_CMD_MERGE_CONFIRM "Caricare le modifiche effettuate in seguito all'unione su '{1}'?" -#define STRING_CMD_MERGE_NO_URI "Nessun uri è stato specificato per l'unione. Specificare o l'uri di una directory .task remota, oppure creare la voce 'merge.default.uri' nel file .taskrc." #define STRING_CMD_BURN_USAGE_M "Mostra un grafico del lavoro da svolgere, per mese" #define STRING_CMD_BURN_USAGE_W "Mostra un grafico del lavoro da svolgere, per settimana" #define STRING_CMD_BURN_USAGE_D "Mostra un grafico del lavoro da svolgere, per giorno" @@ -540,6 +523,7 @@ #define STRING_CMD_CAL_LABEL_HOL "Festività" #define STRING_CMD_CAL_SUN_MON "La variabile di configurazione 'weekstart' può solo contenere i valori 'Domenica' or 'Lunedì'." #define STRING_CMD_EDIT_USAGE "Esegue un editor per la modifica diretta di un task" +#define STRING_CMD_CALC_USAGE "Calculator" // Config #define STRING_CONFIG_OVERNEST "File di configurazione annidato più di 10 livelli - deve trattarsi di un errore." @@ -804,24 +788,10 @@ #define STRING_TASK_SAFETY_VALVE "Questo comando non ha filtro, e modificherà tutti i task. Sicuro?" #define STRING_TASK_SAFETY_FAIL "Prevenuta l'esecuzione del comando." -// Taskmod -#define STRING_TASKMOD_BAD_INIT "Taskmod::getUuid(): oggetto Task non inizializzato." -#define STRING_TASKMOD_TIME "tempo " -#define STRING_TASKMOD_OLD "vecchio " -#define STRING_TASKMOD_NEW "nuovo " - // TDB2 #define STRING_TDB2_PARSE_ERROR " in {1} alla linea {2}" #define STRING_TDB2_UUID_NOT_UNIQUE "Impossibile aggiungere il task in quanto l'uuid '{1}' non è unico." -#define STRING_TDB2_UNDO_TIMESTAMP "Problema di lettura del timestamp dal file undo.data." -#define STRING_TDB2_UNREADABLE "Impossibile leggere '{1}'." -#define STRING_TDB2_UNWRITABLE "Impossibile scrivere '{1}'." -#define STRING_TDB2_NO_CHANGES "Nessuna modifica da unire." -#define STRING_TDB2_REMOTE_CHANGE "Trovata modifica remota a {1} \"{2}\"" -#define STRING_TDB2_LOCAL_CHANGE "Mantenute le modifiche locali a {1} \"{2}\"" #define STRING_TDB2_MISSING "Mancante {1} \"{2}\"" -#define STRING_TDB2_MERGING "Unione di nuovi task remoti {1} \"{2}\"" -#define STRING_TDB2_UP_TO_DATE "Il database è aggiornato, unione non necessaria." #define STRING_TDB2_NO_UNDO "Nessuna transazione memorizzata da ripristinare." #define STRING_TDB2_LAST_MOD "L'ultima modifica è stat effettuata {1}" #define STRING_TDB2_UNDO_PRIOR "Valori precedenti" @@ -841,24 +811,6 @@ // A comma-separated list of commands is appended. #define STRING_TEXT_AMBIGUOUS "Ambiguo {1} '{2}' - può essere uno di " -// Transport -#define STRING_TRANSPORT_NORUN "Impossibile eseguire '{1}'. E` installato e disponibile in $PATH?" -#define STRING_TRANSPORT_NOFORK "Impossibile eseguire '{1}': {2}. Risorse di sistema esaurite?" -#define STRING_TRANSPORT_URI_NODIR "L'uri '{1}' non appare essere una directory." -#define STRING_TRANSPORT_CURL_URI "Usando il protocollo 'curl', l'uri deve contenere il nome di un host." -#define STRING_TRANSPORT_CURL_WILDCD "Usando il protocollo 'curl', i caratteri jolly non sono supportati." -#define STRING_TRANSPORT_CURL_FAIL "Curl ha fallito, vedi l'output precedente." -#define STRING_TRANSPORT_RSYNC_URI "Usando il protocollo 'rsync', l'uri deve contenere un nome di host." -#define STRING_TRANSPORT_RSYNC_FAIL "rsync ha fallito, vedi l'output precedente." -#define STRING_TRANSPORT_SSH_URI "Usando il protocollo 'ssh', l'uri deve contenere un nome di host." -#define STRING_TRANSPORT_SSH_FAIL "ssh ha fallito, vedi l'output precedente." -#define STRING_TRANSPORT_SHELL_NOPATH "Usando il protocollo 'sh+cp' per la copia di più file, un percorso deve essere specificato." -#define STRING_TRANSPORT_SHELL_FAIL "Comando di shell ha fallito, vedi l'output precedente." - -// Uri -#define STRING_URI_QUOTES "Impossibile parsare l'uri '{1}', uso errato del singolo apice." -#define STRING_URI_BAD_FORMAT "L'uri '{1}' non è nel formato atteso." - // utf8 #define STRING_UTF8_INVALID_CP_REP "Rappresentazione non valida del codepoint." #define STRING_UTF8_INVALID_CP "Codepoint Unicode non valido." diff --git a/src/legacy.cpp b/src/legacy.cpp index bfc77e865..da2a3ff0f 100644 --- a/src/legacy.cpp +++ b/src/legacy.cpp @@ -149,12 +149,6 @@ std::string legacyCheckForDeprecatedVariables () it->first.substr (it->first.length () - 12) == ".annotations") deprecated.push_back (it->first); - // {push,pull,merge}.uri Deprecated in 2.3.0 - if ((it->first.substr (0, 5) == "push." || - it->first.substr (0, 5) == "pull." || - it->first.substr (0, 6) == "merge.") && (it->first.find (".uri") != std::string::npos)) - deprecated.push_back (it->first); - if (it->first == "next" || it->first == "annotations" || it->first == "export.ical.class") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 507466820..57d3a1a27 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,8 +8,8 @@ include_directories (${CMAKE_SOURCE_DIR} set (test_SRCS autocomplete.t color.t config.t date.t directory.t dom.t old_duration.t file.t i18n.t json.t list.t msg.t nibbler.t path.t - rx.t t.t t2.t t3.t taskmod.t tdb2.t text.t tree.t uri.t utf8.t util.t - view.t width.t json_test iso8601d.t iso8601p.t duration.t lexer.t + rx.t t.t t2.t t3.t tdb2.t text.t tree.t utf8.t util.t view.t + width.t json_test iso8601d.t iso8601p.t duration.t lexer.t variant_add.t variant_and.t variant_cast.t variant_divide.t variant_equal.t variant_exp.t variant_gt.t variant_gte.t variant_inequal.t variant_lt.t variant_lte.t variant_match.t diff --git a/test/bug.1104.t b/test/bug.1104.t deleted file mode 100755 index 02bc7b2a5..000000000 --- a/test/bug.1104.t +++ /dev/null @@ -1,200 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## 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 -## -################################################################################ - -use strict; -use warnings; -use File::Copy; -use File::Path; -use Test::More tests => 33; - -# Ensure environment has no influence. -delete $ENV{'TASKDATA'}; -delete $ENV{'TASKRC'}; - -mkdir("1", 0755); -mkdir("2", 0755); -mkdir("3", 0755); -mkdir("dropbox", 0755); - -ok (-e "1", 'Created directory 1/'); -ok (-e "2", 'Created directory 2/'); -ok (-e "3", 'Created directory 3/'); -ok (-e "dropbox", 'Created directory dropbox/'); - -# Create the rc file. -if (open my $fh, '>', '1.rc') -{ - print $fh "data.location=1/\n"; - print $fh "confirmation=no\n"; - print $fh "merge.autopush=yes\n"; - print $fh "merge.default.uri=./dropbox/\n"; - print $fh "push.default.uri=./dropbox/\n"; - print $fh "pull.default.uri=./dropbox/\n"; - - close $fh; - ok (-r '1.rc', 'Created 1.rc'); -} - -# Create the rc file. -if (open my $fh, '>', '2.rc') -{ - print $fh "data.location=2/\n"; - print $fh "confirmation=no\n"; - print $fh "merge.autopush=yes\n"; - print $fh "merge.default.uri=./dropbox/\n"; - print $fh "push.default.uri=./dropbox/\n"; - print $fh "pull.default.uri=./dropbox/\n"; - - close $fh; - ok (-r '2.rc', 'Created 2.rc'); -} - -# Create the rc file. -if (open my $fh, '>', '3.rc') -{ - print $fh "data.location=3/\n"; - print $fh "confirmation=no\n"; - print $fh "merge.autopush=yes\n"; - print $fh "merge.default.uri=./dropbox/\n"; - print $fh "push.default.uri=./dropbox/\n"; - print $fh "pull.default.uri=./dropbox/\n"; - - close $fh; - ok (-r '3.rc', 'Created 3.rc'); -} - -# Once-only push from 1 --> dropbox -my $output = qx{../src/task rc:1.rc add one 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:1.rc add two 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:1.rc add three 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:1.rc push 2>&1}; -ok ($? == 0, 'Exit status check'); - -# Merges to 2 and 3 -$output = qx{../src/task rc:2.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:3.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); - -# Make a different change in both locations -$output = qx{../src/task rc:1.rc add four 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:1.rc four done 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:2.rc one done 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:3.rc three delete 2>&1}; -ok ($? == 0, 'Exit status check'); - -# Merges 1 and 2 -$output = qx{../src/task rc:1.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:2.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); - -# see if undo.data is corrupt -$output = qx{cat 2/undo.data}; -unlike ($output, qr/time 0/, "undo.data corrupt"); - -# merge again in order to stimulate duplications -$output = qx{../src/task rc:1.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:1.rc diag 2>&1}; -unlike ($output, qr/Found duplicate/, "Found duplicate"); - -# Merges 3 -$output = qx{../src/task rc:3.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); -unlike ($output, qr/Retaining/, "Must not retain changes"); - -# Merges 1 -$output = qx{../src/task rc:1.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); -unlike ($output, qr/Retaining/, "Must not retain changes"); - -# Merges 1 -$output = qx{../src/task rc:2.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); -unlike ($output, qr/Retaining/, "Must not retain changes"); - -# now all three instances must be in sync -$output = qx{diff 1/undo.data dropbox/undo.data}; -ok ($? == 0, 'Resource 1 up-to-date check'); - -$output = qx{diff 2/undo.data dropbox/undo.data}; -ok ($? == 0, 'Resource 2 up-to-date check'); - -$output = qx{diff 3/undo.data dropbox/undo.data}; -ok ($? == 0, 'Resource 3 up-to-date check'); - -## Merges 3 -#$output = qx{../src/task rc:3.rc merge 2>&1}; -#ok ($? == 0, 'Exit status check'); -#unlike ($output, qr/Retaining/, "Must not retain changes"); -# -## Merges 1 -#$output = qx{../src/task rc:1.rc merge 2>&1}; -#ok ($? == 0, 'Exit status check'); -#unlike ($output, qr/Retaining/, "Must not retain changes"); -# -## Merges 1 -#$output = qx{../src/task rc:2.rc merge 2>&1}; -#ok ($? == 0, 'Exit status check'); -#unlike ($output, qr/Retaining/, "Must not retain changes"); - -# Cleanup. -unlink qw(1.rc 1/pending.data 1/completed.data 1/undo.data 1/backlog.data 2/pending.data 2/completed.data 2/undo.data 2.rc 2/backlog.data dropbox/completed.data dropbox/pending.data dropbox/undo.data 3/pending.data 3/undo.data 3/completed.data 3/backlog.data 3.rc); -ok (! -r '1/pending.data' && - ! -r '1/completed.data' && - ! -r '1/undo.data' && - ! -r '1/backlog.data' && - ! -r '1.rc' && - ! -r '2/pending.data' && - ! -r '2/completed.data' && - ! -r '2/undo.data' && - ! -r '2/backlog.data' && - ! -r '2.rc' && - ! -r '3/pending.data' && - ! -r '3/completed.data' && - ! -r '3/undo.data' && - ! -r '3/backlog.data' && - ! -r '3.rc' && - ! -r 'dropbox/pending.data' && - ! -r 'dropbox/completed.data' && - ! -r 'dropbox/undo.data' , 'Cleanup'); - -rmtree (['1', '2', '3', 'dropbox'], 0, 1); -ok (! -e '1' && - ! -e '2' && - ! -e '3' && - ! -e 'dropbox', 'Removed directories'); - -exit 0; diff --git a/test/bug.1117.t b/test/bug.1117.t deleted file mode 100755 index d674ed958..000000000 --- a/test/bug.1117.t +++ /dev/null @@ -1,117 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## 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 -## -################################################################################ - -use strict; -use warnings; -use File::Copy; -use File::Path; -use Test::More tests => 13; - -# Ensure environment has no influence. -delete $ENV{'TASKDATA'}; -delete $ENV{'TASKRC'}; - -mkdir("1", 0755); -mkdir("2", 0755); -mkdir("merge", 0755); - -ok (-e "1", 'Created directory 1/'); -ok (-e "2", 'Created directory 2/'); -ok (-e "merge", 'Created directory merge/'); - -# Create the rc file. -if (open my $fh, '>', '1.rc') -{ - print $fh "data.location=1/\n"; - print $fh "confirmation=no\n"; - print $fh "merge.autopush=yes\n"; - print $fh "merge.default.uri=./merge/\n"; - print $fh "push.default.uri=./merge/\n"; - - close $fh; - ok (-r '1.rc', 'Created 1.rc'); -} - -# Create the rc file. -if (open my $fh, '>', '2.rc') -{ - print $fh "data.location=2/\n"; - print $fh "confirmation=no\n"; - print $fh "merge.autopush=yes\n"; - print $fh "merge.default.uri=./merge/\n"; - print $fh "push.default.uri=./merge/\n"; - - close $fh; - ok (-r '2.rc', 'Created 2.rc'); -} - -# add and push on 1 -my $output = qx{../src/task rc:1.rc add foo1 2>&1}; -ok ($? == 0, 'Exit status check'); -$output = qx{../src/task rc:1.rc push}; -ok ($? == 0, 'Exit status check'); - -# add and merge on 2 -$output = qx{../src/task rc:2.rc add foo2 2>&1}; -ok ($? == 0, 'Exit status check'); - -$output = qx{../src/task rc:2.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); - -# merge 1 -$output = qx{../src/task rc:1.rc merge 2>&1}; -ok ($? == 0, 'Exit status check'); - -# undo.data files must not differ -$output = qx{diff 1/undo.data 2/undo.data}; -ok ($? == 0, 'undo.data diff result'); - -# Cleanup. -unlink qw(1.rc 1/pending.data 1/completed.data 1/undo.data 1/backlog.data 1/synch.key 2/pending.data 2/completed.data 2/undo.data 2.rc 2/backlog.data 2/synch.key merge/completed.data merge/pending.data merge/undo.data); -ok (! -r '1/pending.data' && - ! -r '1/completed.data' && - ! -r '1/undo.data' && - ! -r '1/backlog.data' && - ! -r '1/synch.key' && - ! -r '1.rc' && - ! -r '2/pending.data' && - ! -r '2/completed.data' && - ! -r '2/undo.data' && - ! -r '2/backlog.data' && - ! -r '2/synch.key' && - ! -r '2.rc' && - ! -r 'merge/pending.data' && - ! -r 'merge/completed.data' && - ! -r 'merge/undo.data' , 'Cleanup'); - -rmtree (['1', '2', 'merge'], 0, 1); -ok (! -e '1' && - ! -e '2' && - ! -e 'merge', 'Removed directories'); - -exit 0; diff --git a/test/bug.1192.t b/test/bug.1192.t deleted file mode 100755 index 443c3c84e..000000000 --- a/test/bug.1192.t +++ /dev/null @@ -1,72 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## 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 -## -################################################################################ - -use strict; -use warnings; -use Test::More tests => 4; - -# Ensure environment has no influence. -delete $ENV{'TASKDATA'}; -delete $ENV{'TASKRC'}; - -# Create the rc file. -if (open my $fh, '>', 'bug.rc') -{ - print $fh "data.location=.\n", - "confirmation=off\n"; - close $fh; - mkdir("localcopy", 0755); - ok (-r 'bug.rc', 'Created bug.rc'); -} - -# Bug 1192 - Push fails with POSIX shell that does not do brace expansion. - -# Test push. -qx{../src/task rc:bug.rc add foo 2>&1}; -# completed.data doesn't get created until required. -qx{touch completed.data 2>&1}; -my $output = qx{../src/task rc:bug.rc push sh+cp://localcopy/ 2>&1}; -#unlike ($output, qr/_user/ms, '_user in there'); -unlike ($output, qr/No such file or directory/ms, 'Local push to sh+cp://path/'); - -# Test pull. -$output = qx{../src/task rc:bug.rc pull sh+cp://localcopy/ 2>&1}; -unlike ($output, qr/No such file or directory/ms, 'Local pull from sh+cp://path/'); - -## Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc); -qx(rm -rf localcopy/); -ok (! -d 'localcopy' && - ! -r 'pending.data' && - ! -r 'completed.data' && - ! -r 'undo.data' && - ! -r 'backlog.data' && - ! -r 'synch.key' && - ! -r 'bug.rc', 'Cleanup'); - -exit 0; diff --git a/test/bug.580.t b/test/bug.580.t deleted file mode 100755 index 5a56adb80..000000000 --- a/test/bug.580.t +++ /dev/null @@ -1,107 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## 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 -## -################################################################################ - -use strict; -use warnings; -use Test::More tests => 11; -use File::Copy; - -# Ensure environment has no influence. -delete $ENV{'TASKDATA'}; -delete $ENV{'TASKRC'}; - -use constant false => 0; -use constant true => 1; - -# Create data locations -mkdir("local", 0755); -ok(-e 'local', "Created directory local"); -mkdir("remote", 0755); -ok(-e 'remote', "Created directory remote"); - -# Create the rc files. -if (open my $fh, '>', 'local.rc') -{ - print $fh "data.location=./local\n", - "confirmation=no\n", - "merge.default.uri=remote/\n", - "merge.autopush=yes\n"; - close $fh; - ok (-r 'local.rc', 'Created local.rc'); -} - -if (open my $fh, '>', 'remote.rc') -{ - print $fh "data.location=./remote\n", - "confirmation=no\n", - "merge.autopush=no\n"; - close $fh; - ok (-r 'remote.rc', 'Created remote.rc'); -} - -# add a remote task -qx{../src/task rc:remote.rc add remote task 2>&1}; - -# add a local task -qx{../src/task rc:local.rc add local task 2>&1}; - -# merge and autopush -qx{../src/task rc:local.rc merge 2>&1}; - -my $output = qx{../src/task rc:remote.rc ls 2>&1}; -like ($output, qr/local task/, "autopush failed"); - -# Cleanup. -unlink qw(local/pending.data local/completed.data local/undo.data local/undo.save local/backlog.data local.rc); -ok (! -r 'local/pending.data' && - ! -r 'local/completed.data' && - ! -r 'local/undo.data' && - ! -r 'local/undo.save' && - ! -r 'local/backlog.data' && - ! -r 'local.rc', 'Cleanup'); - -unlink qw(remote/pending.data remote/completed.data remote/undo.data remote/backlog.data remote.rc); -ok (! -r 'remote/pending.data' && - ! -r 'remote/completed.data' && - ! -r 'remote/undo.data' && - ! -r 'remote/backlog.data' && - ! -r 'remote.rc', 'Cleanup'); - -rmdir("remote/extensions"); -ok (!-e "remote/extensions", "Removed dir remote/extensions"); - -rmdir("remote"); -ok (!-e "remote", "Removed dir remote"); - -rmdir("local/extensions"); -ok (!-e "local/extensions", "Removed dir local/extensions"); - -rmdir("local"); -ok (!-e "local", "Removed dir local"); - -exit 0; diff --git a/test/taskmod.t.cpp b/test/taskmod.t.cpp deleted file mode 100644 index 338bda033..000000000 --- a/test/taskmod.t.cpp +++ /dev/null @@ -1,143 +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 -#include -#include -#include -#include -#include -#include -#include -#include - -Context context; - -//////////////////////////////////////////////////////////////////////////////// -int main (int argc, char** argv) -{ - UnitTest t (16); - - // Ensure environment has no influence. - unsetenv ("TASKDATA"); - unsetenv ("TASKRC"); - - bool good = true; - - // base timestamp - unsigned long timestamp = (unsigned long)time(NULL); - timestamp -= timestamp % 100; - - // create some tasks - Task tasks[3]; - - // base task - tasks[0] = Task("[description:\"Desc1\" uuid:\"df95dac3-5f2b-af88-5416-03a3163d00fd\"]"); - // first modification - tasks[1] = tasks[0]; - tasks[1].addTag("tag1"); - // second modification - tasks[2] = tasks[1]; - tasks[2].setStatus(Task::completed); - - // create taskmods - Taskmod mods[4]; - mods[0] = Taskmod(); - mods[0].setTimestamp(timestamp); - mods[0].setBefore(tasks[0]); - mods[0].setAfter(tasks[1]); - - mods[1] = Taskmod(); - mods[1].setTimestamp(timestamp + 2); - mods[1].setBefore(tasks[1]); - mods[1].setAfter(tasks[2]); - - // getUuid() not - Taskmod empty = Taskmod(); - good = true; - try { - empty.getUuid(); - } catch (const std::string& e) { t.diag(e); good = false; } - t.notok (good, "Taskmod::getUuid() not"); - - // issetAfter() not - Taskmod newMod = Taskmod(); - t.notok(newMod.issetAfter(), "Taskmod::issetAfter() not"); - - // getUuid() - newMod.setAfter(tasks[1]); - try { - std::string uuid = newMod.getUuid(); - t.is(uuid, "df95dac3-5f2b-af88-5416-03a3163d00fd", "Taskmod::getUuid()"); - } catch (const std::string& e) { - t.diag(e); - t.fail("Taskmod::getUuid()"); - } - - // isValid() not - t.notok(newMod.isValid(), "Taskmod::isValid() not") ; - - // issetBefore() not - t.notok(newMod.issetBefore(), "Taskmod::issetBefore() not"); - - // isValid() - newMod.setTimestamp(timestamp+1); - t.ok(newMod.isValid(), "Taskmod::isValid()"); - - // isNew() - t.ok(newMod.isNew(), "Taskmod::isNew()"); - - // issetBefore() - newMod.setBefore(tasks[0]); - t.ok(newMod.issetBefore(), "Taskmod::issetBefore()"); - - // isNew() not - t.notok(newMod.isNew(), "Taskmod::isNew() not"); - - // < - t.ok(mods[0] < newMod, "Taskmod::operator<"); - t.notok(newMod < mods[0], "Taskmod::operator< not"); - - // > - t.ok(mods[1] > mods[0], "Taskmod::operator>"); - t.notok(mods[0] > mods[1], "Taskmod::operator> not"); - - // != - t.ok(mods[0] != mods[1], "Taskmod::operator!=" ); - - // copy constructor - Taskmod clone1 = Taskmod(mods[0]); - t.ok(mods[0] == clone1, "Taskmod::Taskmod(const Taskmod&)"); - - // = - Taskmod clone2 = mods[0]; - t.ok(mods[0] == clone2, "Taskmod::operator="); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/test/uri.t.cpp b/test/uri.t.cpp deleted file mode 100644 index 6d994a1e0..000000000 --- a/test/uri.t.cpp +++ /dev/null @@ -1,142 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// taskwarrior - a command line task list manager. -// -// Copyright 2010 - 2014, Johannes Schlatow. -// -// 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 -#include -#include -#include -#include -#include -#include - -Context context; - -//////////////////////////////////////////////////////////////////////////////// -int main (int argc, char** argv) -{ - UnitTest t (54); - - // Ensure environment has no influence. - unsetenv ("TASKDATA"); - unsetenv ("TASKRC"); - - Uri uri1 ("asfd://user@host/folder/"); - uri1.parse (); - t.is (uri1._user, "user", "Uri::parse() : asdf://user@host/folder/"); - t.is (uri1._host, "host", "Uri::parse() : asdf://user@host/folder/"); - t.is (uri1._port, "", "Uri::parse() : asdf://user@host/folder/"); - t.is (uri1._path, "folder/", "Uri::parse() : asdf://user@host/folder/"); - t.is (uri1._protocol, "asfd", "Uri::parse() : asdf://user@host/folder/"); - t.ok (uri1.append ("file.test"), "Uri::append() to path"); - t.is (uri1._path, "folder/file.test", "Uri::append() ok"); - - Uri uri2 ("user@host:folder/file.test"); - uri2.parse (); - t.is (uri2._user, "user", "Uri::parse() : user@host:folder/file.test"); - t.is (uri2._host, "host", "Uri::parse() : user@host:folder/file.test"); - t.is (uri2._port, "", "Uri::parse() : user@host/folder/file.test"); - t.is (uri2._path, "folder/file.test", "Uri::parse() : user@host/folder/file.test"); - t.is (uri2._protocol, "ssh", "Uri::parse() : user@host/folder/file.test"); - t.notok (uri2.append ("test.dat"), "Uri::append() to file"); - - Uri uri3 ("rsync://hostname.abc.de:1234//abs/path"); - uri3.parse (); - t.is (uri3._user, "", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path"); - t.is (uri3._host, "hostname.abc.de", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path"); - t.is (uri3._port, "1234", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path"); - t.is (uri3._path, "/abs/path", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path"); - t.is (uri3._protocol, "rsync", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path"); - - Uri uri4 ("hostname:"); - uri4.parse (); - t.is (uri4._user, "", "Uri::parse() : hostname:"); - t.is (uri4._host, "hostname", "Uri::parse() : hostname:"); - t.is (uri4._port, "", "Uri::parse() : hostname:"); - t.is (uri4._path, "", "Uri::parse() : hostname:"); - t.is (uri4._protocol, "ssh", "Uri::parse() : hostname:"); - t.notok (uri4.is_local (), "Uri::is_local() : hostname:"); - t.ok (uri4.append ("file.test"), "Uri::append() : hostname:"); - t.is (uri4._path, "file.test","Uri::append() : ok"); - - context.config.set ("merge.default.uri", "../folder/"); - context.config.set ("push.test.uri", "/home/user/.task/"); - - Uri uri5 ("", "merge"); - t.ok (uri5.is_local (), "Uri::is_local() : ../server/"); - uri5.parse (); - t.is (uri5._path, "../folder/", "Uri::expand() default"); - - Uri uri6 ("test", "push"); - t.ok (uri6.is_local(), "Uri::is_local() : /home/user/.task/"); - uri6.parse (); - t.is (uri6._path, "/home/user/.task/", "Uri::expand() test"); - - Uri uri7 ("ftp://'user@name'@host:321/path/to/x"); - uri7.parse (); - t.is (uri7._user, "user@name", "Uri::parse() : ftp://'user@name'@host:321/path/to/x"); - t.is (uri7._host, "host", "Uri::parse() : ftp://'user@name'@host:321/path/to/x"); - t.is (uri7._port, "321", "Uri::parse() : ftp://'user@name'@host:321/path/to/x"); - t.is (uri7._path, "path/to/x", "Uri::parse() : ftp://'user@name'@host:321/path/to/x"); - t.is (uri7._protocol, "ftp", "Uri::parse() : ftp://'user@name'@host:321/path/to/x"); - - Uri uri8 ("http://'us/er@n:ame'@host/path/to/x"); - uri8.parse (); - t.is (uri8._user, "us/er@n:ame", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x"); - t.is (uri8._host, "host", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x"); - t.is (uri8._port, "", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x"); - t.is (uri8._path, "path/to/x", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x"); - t.is (uri8._protocol, "http", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x"); - - Uri uri9 ("'user@name'@host:path/to/x"); - uri9.parse (); - t.is (uri9._user, "user@name", "Uri::parse() : 'user@name'@host:path/to/x"); - t.is (uri9._host, "host", "Uri::parse() : 'user@name'@host:path/to/x"); - t.is (uri9._port, "", "Uri::parse() : 'user@name'@host:path/to/x"); - t.is (uri9._path, "path/to/x", "Uri::parse() : 'user@name'@host:path/to/x"); - - // bug #668 - Uri uri10 ("user.name@host.com:undo.data"); - uri10.parse (); - t.is (uri10._user, "user.name", "Uri::parse() : user.name@host.com:undo.data"); - t.is (uri10._host, "host.com", "Uri::parse() : user.name@host.com:undo.data"); - t.is (uri10._port, "", "Uri::parse() : user.name@host.com:undo.data"); - t.is (uri10._path, "undo.data", "Uri::parse() : user.name@host.com:undo.data"); - t.is (uri10._protocol, "ssh", "Uri::parse() : user.name@host.com:undo.data"); - - Uri uri11 ("ssh://user.name@host.com/undo.data"); - uri11.parse (); - t.is (uri11._user, "user.name", "Uri::parse() : ssh://user.name@host.com/undo.data"); - t.is (uri11._host, "host.com", "Uri::parse() : ssh://user.name@host.com/undo.data"); - t.is (uri11._port, "", "Uri::parse() : ssh://user.name@host.com/undo.data"); - t.is (uri11._path, "/undo.data", "Uri::parse() : ssh://user.name@host.com/undo.data"); - t.is (uri11._protocol, "ssh", "Uri::parse() : ssh://user.name@host.com/undo.data"); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// vim: et ts=2 sw=2