Merge branch '2.4.3' of ssh://git.tasktools.org/tm/task into 2.4.3

This commit is contained in:
Paul Beckingham
2015-03-28 08:28:56 -04:00
5 changed files with 24 additions and 4 deletions

View File

@@ -6,6 +6,8 @@
- TW-1581 Tasks with dependencies show wrong urgency values for the first
report run after a task in the dependency chain is completed/deleted (thanks
to Ulf Eliasson).
- TW-1583 Invalid ID displayed for first report after done/delete (thanks to
Ulf Eliasson).
- Setting 'bulk' to zero is interpreted as infinity, which means there is no
amount of changes that is considered dangerous (thanks to Tomas Babej).

View File

@@ -101,6 +101,7 @@ Context::Context ()
, dom ()
, determine_color_use (true)
, use_color (true)
, run_gc (true)
, verbosity_legacy (false)
, terminal_width (0)
, terminal_height (0)
@@ -478,7 +479,14 @@ int Context::dispatch (std::string &out)
// GC is invoked prior to running any command that displays task IDs, if
// possible.
if (c->displays_id () && !tdb2.read_only ())
{
run_gc = true;
tdb2.gc ();
}
else
{
run_gc = false;
}
/*
// Only read-only commands can be run when TDB2 is read-only.

View File

@@ -94,6 +94,8 @@ public:
bool determine_color_use;
bool use_color;
bool run_gc;
bool verbosity_legacy;
std::vector <std::string> verbosity;
std::vector <std::string> headers;

View File

@@ -316,9 +316,15 @@ void TF2::load_tasks ()
++line_number;
Task task (*i);
// Some tasks gets an ID.
// Some tasks get an ID.
if (_has_ids)
task.id = context.tdb2.next_id ();
{
Task::status status = task.getStatus ();
// Completed / deleted tasks in pending.data get an ID if GC is off.
if (!context.run_gc ||
(status != Task::completed && status != Task::deleted))
task.id = context.tdb2.next_id ();
}
_tasks.push_back (task);

View File

@@ -108,8 +108,10 @@ class TestExportCommand(TestCase):
def test_export_end(self):
self.t(('1', 'start'))
self.t.faketime("+5s")
self.t(('1', 'done'))
self.assertTimestamp(self.export(1)['end'])
# After a task is "done" or "deleted", it does not have an ID by which
# to filter it anymore. Add a tag to work around this.
self.t(('1', 'done', '+workaround'))
self.assertTimestamp(self.export('+workaround')['end'])
def test_export_due(self):
self.t(('1', 'modify', 'due:today'))