Merge branch '2.3.0' into 2.4.0

Conflicts:
	AUTHORS
	CMakeLists.txt
	NEWS
	src/A3.cpp
	src/CMakeLists.txt
	src/Config.cpp
	src/Duration.cpp
	src/Duration.h
	src/Nibbler.cpp
	src/Nibbler.h
	src/RX.cpp
	src/RX.h
	src/columns/ColDate.cpp
	src/columns/ColScheduled.cpp
	src/commands/Command.cpp
	src/legacy.cpp
	src/utf8.cpp
	src/utf8.h
	test/CMakeLists.txt
	test/bug.mergedeps.t.postponed
	test/duration.t.cpp
	test/merge.duplicates.t
	test/merge.simple_duplication.t
	test/merge.t
	test/nibbler.t.cpp
	test/roundtrip.t
	test/rx.t.cpp
	test/utf8.t.cpp
This commit is contained in:
Paul Beckingham 2014-01-07 19:10:03 -05:00
commit 98f740e9d1
550 changed files with 6129 additions and 2976 deletions

View file

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////
// taskwarrior - a command line task list manager.
//
// Copyright 2006-2013, 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
@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <vector>
#include <sstream>
#include <algorithm>
@ -133,6 +134,7 @@ int CmdShow::execute (std::string& output)
" dateformat.info"
" dateformat.report"
" debug"
" debug.tls"
" default.command"
" default.due"
" default.priority"
@ -164,14 +166,14 @@ int CmdShow::execute (std::string& output)
" list.all.tags"
" locale"
" locking"
" merge.autopush"
" merge.default.uri"
" merge.autopush" // Deprecated 2.3.0
" merge.default.uri" // Deprecated 2.3.0
" monthsperline"
" nag"
" patterns"
" print.empty.columns"
" pull.default.uri"
" push.default.uri"
" pull.default.uri" // Deprecated 2.3.0
" push.default.uri" // Deprecated 2.3.0
" recurrence.indicator"
" recurrence.limit"
" regex"
@ -185,7 +187,12 @@ int CmdShow::execute (std::string& output)
" shell.prompt"
" tag.indicator"
" taskd.server"
" taskd.ca"
" taskd.certificate"
" taskd.ciphers"
" taskd.credentials"
" taskd.key"
" taskd.trust"
" undo.style"
" urgency.active.coefficient"
" urgency.scheduled.coefficient"
@ -210,37 +217,35 @@ int CmdShow::execute (std::string& output)
// is redirected to a file, or stdout is not a tty.
recognized += "_forcecolor ";
std::vector <std::string> all;
context.config.all (all);
std::vector <std::string> unrecognized;
std::vector <std::string>::iterator i;
for (i = all.begin (); i != all.end (); ++i)
Config::const_iterator i;
for (i = context.config.begin (); i != context.config.end (); ++i)
{
// Disallow partial matches by tacking a leading and trailing space on each
// variable name.
std::string pattern = " " + *i + " ";
std::string pattern = " " + i->first + " ";
if (recognized.find (pattern) == std::string::npos)
{
// These are special configuration variables, because their name is
// dynamic.
if (i->substr (0, 14) != "color.keyword." &&
i->substr (0, 14) != "color.project." &&
i->substr (0, 10) != "color.tag." &&
i->substr (0, 10) != "color.uda." &&
i->substr (0, 8) != "holiday." &&
i->substr (0, 7) != "report." &&
i->substr (0, 6) != "alias." &&
i->substr (0, 5) != "hook." &&
i->substr (0, 5) != "push." &&
i->substr (0, 5) != "pull." &&
i->substr (0, 6) != "merge." &&
i->substr (0, 4) != "uda." &&
i->substr (0, 21) != "urgency.user.project." &&
i->substr (0, 17) != "urgency.user.tag." &&
i->substr (0, 12) != "urgency.uda.")
if (i->first.substr (0, 14) != "color.keyword." &&
i->first.substr (0, 14) != "color.project." &&
i->first.substr (0, 10) != "color.tag." &&
i->first.substr (0, 10) != "color.uda." &&
i->first.substr (0, 8) != "holiday." &&
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." &&
i->first.substr (0, 17) != "urgency.user.tag." &&
i->first.substr (0, 12) != "urgency.uda.")
{
unrecognized.push_back (*i);
unrecognized.push_back (i->first);
}
}
}
@ -250,9 +255,9 @@ int CmdShow::execute (std::string& output)
Config default_config;
default_config.setDefaults ();
for (i = all.begin (); i != all.end (); ++i)
if (context.config.get (*i) != default_config.get (*i))
default_values.push_back (*i);
for (i = context.config.begin (); i != context.config.end (); ++i)
if (i->second != default_config.get (i->first))
default_values.push_back (i->first);
// Create output view.
ViewText view;
@ -276,37 +281,27 @@ int CmdShow::execute (std::string& output)
section = "";
std::string::size_type loc;
for (i = all.begin (); i != all.end (); ++i)
for (i = context.config.begin (); i != context.config.end (); ++i)
{
loc = i->find (section, 0);
loc = i->first.find (section, 0);
if (loc != std::string::npos)
{
// Look for unrecognized.
Color color;
if (std::find (unrecognized.begin (), unrecognized.end (), *i) != unrecognized.end ())
if (std::find (unrecognized.begin (), unrecognized.end (), i->first) != unrecognized.end ())
{
issue_error = true;
color = error;
}
else if (std::find (default_values.begin (), default_values.end (), *i) != default_values.end ())
else if (std::find (default_values.begin (), default_values.end (), i->first) != default_values.end ())
{
issue_warning = true;
color = warning;
}
std::string value = context.config.get (*i);
// hide sensible information
if ( (i->substr (0, 5) == "push." ||
i->substr (0, 5) == "pull." ||
i->substr (0, 6) == "merge.") && (i->find (".uri") != std::string::npos) ) {
Uri uri (value);
uri.parse ();
value = uri.ToString ();
}
std::string value = i->second;
int row = view.addRow ();
view.set (row, 0, *i, color);
view.set (row, 0, i->first, color);
view.set (row, 1, value, color);
}
}
@ -331,6 +326,7 @@ int CmdShow::execute (std::string& output)
{
out << STRING_CMD_SHOW_UNREC << "\n";
std::vector <std::string>::iterator i;
for (i = unrecognized.begin (); i != unrecognized.end (); ++i)
out << " " << *i << "\n";
@ -376,7 +372,7 @@ int CmdShow::execute (std::string& output)
// Verify installation. This is mentioned in the documentation as the way
// to ensure everything is properly installed.
if (all.size () == 0)
if (context.config.size () == 0)
{
out << STRING_CMD_SHOW_EMPTY << "\n";
rc = 1;