Merge branch '1.9.3' of tasktools.org:task into 1.9.3

This commit is contained in:
Paul Beckingham 2010-08-07 11:53:51 -04:00
commit 3302a30145
7 changed files with 38 additions and 5 deletions

View file

@ -153,6 +153,24 @@ modifying the:
configuration variable. Check out DropBox at http://www.dropbox.com.
.TP
.B Q: I don't like dropbox. Is there another way to synchronize my tasks?
Of course. Especially if you want to modify tasks offline on both machines and
synchronize them later on. For this purpose task provides a 'merge' command which
is able to insert the modifications you made to one of your task databases into a
second database.
Here is a basic example of the procedure:
$ rsync myremotehost:.task/undo.data /tmp/undo_remote.data
$ task merge /tmp/undo_remote.data
$ rsync ${HOME}/.task/*.data myremotehost:.task/
First you need to get the undo.data file from the remote system with a network
protocol of your choice or a removable medium as well. When task finished the merge
command you should copy all the local .data files to the remote system. This way you
ensure that both systems are fully synchronized.
.TP
.B Q: The undo.data file gets very large - do I need it?
You need it if you want the undo capability. But if it gets large, you can
@ -286,6 +304,7 @@ non-exact match:
This will remove the second annotation - the first non-exact match.
.SH "CREDITS & COPYRIGHTS"
task was written by P. Beckingham <paul@beckingham.net>.
.br

View file

@ -142,6 +142,11 @@ Redirect the output to a file, if you wish to save it, or pipe it to another com
Exports all tasks in YAML 1.1 format.
Redirect the output to a file, if you wish to save it, or pipe it to another command.
.TP
.B merge path/to/remote/undo.data
Merges two task databases by comparing the modifications that are stored in the
undo.data files. The location of the second undo.data file must be passed on as argument.
.TP
.B color [sample | legend]
Displays all possible colors, a named sample, or a legend containing all

View file

@ -117,6 +117,14 @@ _task()
COMPREPLY=( $(compgen -W "${config}" -- ${cur}) )
return 0
;;
*)
case "${prev}" in
merge)
COMPREPLY=( $(compgen -o "default" -- ${cur}) )
return 0
;;
esac
;;
esac
;;
esac

View file

@ -134,7 +134,6 @@ void Cmd::load ()
commands.push_back ("_ids");
commands.push_back ("_config");
commands.push_back ("_version");
commands.push_back ("_merge");
commands.push_back ("_urgency");
commands.push_back ("export.csv");
commands.push_back ("export.ical");
@ -174,6 +173,7 @@ void Cmd::load ()
commands.push_back (context.stringtable.get (CMD_TIMESHEET, "timesheet"));
commands.push_back (context.stringtable.get (CMD_UNDO, "undo"));
commands.push_back (context.stringtable.get (CMD_VERSION, "version"));
commands.push_back (context.stringtable.get (CMD_MERGE, "merge"));
// Now load the custom reports.
std::vector <std::string> all;
@ -264,7 +264,7 @@ bool Cmd::isReadOnlyCommand ()
// Commands that directly modify the data files.
bool Cmd::isWriteCommand ()
{
if (command == "_merge" ||
if (command == context.stringtable.get (CMD_MERGE, "merge") ||
command == context.stringtable.get (CMD_ADD, "add") ||
command == context.stringtable.get (CMD_APPEND, "append") ||
command == context.stringtable.get (CMD_ANNOTATE, "annotate") ||

View file

@ -241,7 +241,7 @@ int Context::dispatch (std::string &out)
else if (cmd.command == "shell") { handleShell ( ); }
#endif
else if (cmd.command == "undo") { handleUndo ( ); }
else if (cmd.command == "_merge") { tdb.gc ();
else if (cmd.command == "merge") { tdb.gc ();
handleMerge (out); }
else if (cmd.command == "_projects") { rc = handleCompletionProjects (out); }
else if (cmd.command == "_tags") { rc = handleCompletionTags (out); }

View file

@ -98,6 +98,7 @@
#define CMD_SHELL 229
#define CMD_CONFIG 230
#define CMD_SHOW 231
#define CMD_MERGE 232
// 3xx Attributes
#define ATT_PROJECT 300

View file

@ -134,7 +134,7 @@ sleep(1);
qx{../task rc:remote.rc 4 +gym}; # right_newer
# merge remote into local
my $output_l = qx{../task rc:local.rc _merge remote/undo.data};
my $output_l = qx{../task rc:local.rc merge remote/undo.data};
#check output
like ($output_l, qr/Running redo/, "local-merge finished");
@ -142,7 +142,7 @@ unlike ($output_l, qr/Missing/, "local-merge: no missing entry");
unlike ($output_l, qr/Not adding duplicate/, "local-merge: no duplicates");
# merge local into remote
my $output_r = qx{../task rc:remote.rc _merge local/undo.data};
my $output_r = qx{../task rc:remote.rc merge local/undo.data};
# check output
like ($output_r, qr/Running redo/, "remote-merge finished");