mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
TD-104: Unrecognized taskwarrior file format
- Thanks to Jeremy John Reeder, Reg.
This commit is contained in:
parent
6ceca1d424
commit
29a7837fda
4 changed files with 43 additions and 9 deletions
1
AUTHORS
1
AUTHORS
|
@ -286,3 +286,4 @@ suggestions:
|
|||
Simon Michael
|
||||
Robin Green
|
||||
pawprint
|
||||
Reg
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
2.5.1 () -
|
||||
|
||||
- TD-104 Unrecognized taskwarrior file format
|
||||
(thanks to Jeremy John Reeder, Reg).
|
||||
- TW-38 Dates in the far future give bad estimates in burndown
|
||||
(thanks to Ben Boeckel).
|
||||
- TW-188 short help text
|
||||
|
|
|
@ -99,7 +99,7 @@ std::string Config::_defaults =
|
|||
"xterm.title=no # Sets xterm title for some commands\n"
|
||||
"expressions=infix # Prefer infix over postfix expressions\n"
|
||||
"json.array=on # Enclose JSON output in [ ]\n"
|
||||
"json.depends.array=on # Encode dependencies as a JSON array\n"
|
||||
"json.depends.array=off # Encode dependencies as a JSON array\n"
|
||||
"abbreviation.minimum=2 # Shortest allowed abbreviation\n"
|
||||
"\n"
|
||||
"# Dates\n"
|
||||
|
|
47
src/Task.cpp
47
src/Task.cpp
|
@ -661,26 +661,42 @@ void Task::parseJSON (const json::object* root_obj)
|
|||
addTag (tag->_data);
|
||||
}
|
||||
}
|
||||
// This is a temporary measure to allow Mirakel sync, and will be removed
|
||||
// in a future release.
|
||||
// This is a temporary measure to accomodate a malformed JSON message from
|
||||
// Mirakel sync.
|
||||
//
|
||||
// 2016-02-21 Mirakel dropped sync support in late 2015. This can be
|
||||
// removed in a later release.
|
||||
else if (i.first == "tags" && i.second->type() == json::j_string)
|
||||
{
|
||||
json::string* tag = (json::string*)i.second;
|
||||
addTag (tag->_data);
|
||||
}
|
||||
|
||||
// Dependencies can be exported as a single comma-separated string, or as
|
||||
// an array of strings.
|
||||
// Dependencies can be exported as an array of strings.
|
||||
// 2016-02-21: This will be the only option in future releases.
|
||||
// See other 2016-02-21 comments for details.
|
||||
else if (i.first == "depends" && i.second->type() == json::j_array)
|
||||
{
|
||||
json::array* tags = (json::array*)i.second;
|
||||
for (auto& t : tags->_data)
|
||||
json::array* deps = (json::array*)i.second;
|
||||
for (auto& t : deps->_data)
|
||||
{
|
||||
json::string* tag = (json::string*)t;
|
||||
addDependency (tag->_data);
|
||||
json::string* dep = (json::string*)t;
|
||||
addDependency (dep->_data);
|
||||
}
|
||||
}
|
||||
|
||||
// Dependencies can be exported as a single comma-separated string.
|
||||
// 2016-02-21: Deprecated - see other 2016-02-21 comments for details.
|
||||
else if (i.first == "depends" && i.second->type() == json::j_string)
|
||||
{
|
||||
json::string* deps = (json::string*)i.second;
|
||||
std::vector <std::string> uuids;
|
||||
split (uuids, deps->_data, ',');
|
||||
|
||||
for (const auto& uuid : uuids)
|
||||
addDependency (uuid);
|
||||
}
|
||||
|
||||
// Strings are decoded.
|
||||
else if (type == "string")
|
||||
set (i.first, json::decode (unquoteText (i.second->dump ())));
|
||||
|
@ -892,6 +908,21 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
|
|||
// Dependencies are an array by default.
|
||||
else if (i.first == "depends"
|
||||
#ifdef PRODUCT_TASKWARRIOR
|
||||
// 2016-02-20: Taskwarrior 2.5.0 introduced the 'json.depends.array' setting
|
||||
// which defaulted to 'on', and emitted this JSON for
|
||||
// dependencies:
|
||||
//
|
||||
// With json.depends.array=on "depends":["<uuid>","<uuid>"]
|
||||
// With json.depends.array=off "depends":"<uuid>,<uuid>"
|
||||
//
|
||||
// Taskwarrior 2.5.1 defaults this to 'off', because Taskserver
|
||||
// 1.0.0 and 1.1.0 both expect that. Taskserver 1.2.0 will
|
||||
// accept both forms, but emit the 'off' variant.
|
||||
//
|
||||
// When Taskwarrior 2.5.0 is no longer the dominant version,
|
||||
// and Taskserver 1.2.0 is released, the default for
|
||||
// 'json.depends.array' can revert to 'on'.
|
||||
|
||||
&& context.config.getBoolean ("json.depends.array")
|
||||
#endif
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue