From 7babc9c5b1da856776b2b2071eb0a5da560cf8f9 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 21 Mar 2015 22:29:00 +0100 Subject: [PATCH 1/5] Command: Let zero bulk denote infinite value --- src/commands/Command.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index 74619ad38..4aa4ee12c 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -323,8 +323,8 @@ bool Command::permission ( } // 1 < Quantity < bulk modifications have optional confirmation, in the (y/n/a/q) - // style. - if (quantity < bulk && (!_needs_confirm || !confirmation)) + // style. Bulk = 0 denotes infinite bulk. + if ((bulk == 0 || quantity < bulk) && (!_needs_confirm || !confirmation)) return true; if (context.verbose ("blank") && !_first_iteration) From c306d458e00171b64db62178c72bda8d39c2bd45 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sun, 22 Mar 2015 15:17:36 +0100 Subject: [PATCH 2/5] Doc: Document bulk=0 in taskrc manpage --- doc/man/taskrc.5.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index b9bf7329b..7f238b8f8 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -314,7 +314,7 @@ Controls padding between columns of the report output. Default is "1". Is a number, defaulting to 3. When this number or greater of tasks are modified in a single command, confirmation will be required, regardless of the value of .B confirmation -variable. +variable. The special value bulk=0 is treated as an infinity. This is useful for preventing large-scale unintended changes. From 052a5c607a997892d5f64256eb373a23d40ac472 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 22 Mar 2015 11:43:00 -0400 Subject: [PATCH 3/5] Documentation: 'rc.bulk=0' notes. - Added ChangeLog and NEWS entries for the rc.bulk=0 change, where zero is considered infinity. --- ChangeLog | 2 ++ NEWS | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5e2df7d6a..7bcb7f29e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ - TW-1578 Bash tab completion problems on first run (thanks to Renato Alves and Ptolemarch). +- Setting 'bulk' to zero is interpreted as infinity, which means there is no + amount of changes that is considered dangerous (thanks to Tomas Babej). ------ current release --------------------------- diff --git a/NEWS b/NEWS index 11c774722..e5776dda2 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,8 @@ New commands in taskwarrior 2.4.3 New configuration options in taskwarrior 2.4.3 - - + - Setting 'bulk' to zero is interpreted as infinity, which means there is no + amount of changes that is considered dangerous. Newly deprecated features in taskwarrior 2.4.3 From 4f75652ccb3e32a5cd6e3bfaa75c52b40f1e33cf Mon Sep 17 00:00:00 2001 From: Wilhelm Schuermann Date: Mon, 23 Mar 2015 15:55:47 +0100 Subject: [PATCH 4/5] TW-1580: "modified" attribute not updated - Make all local modifications update the "modified" attribute. - As per design, the user cannot overwrite this attribute; neither can hooks. --- ChangeLog | 1 + src/TDB2.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7bcb7f29e..058915883 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - TW-1578 Bash tab completion problems on first run (thanks to Renato Alves and Ptolemarch). +- TW-1580 "modified" attribute no longer updated (thanks to David Patrick). - Setting 'bulk' to zero is interpreted as infinity, which means there is no amount of changes that is considered dangerous (thanks to Tomas Babej). diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 579090b77..ab56a9683 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -598,7 +598,7 @@ void TDB2::update ( const std::string& uuid, Task& task, const bool add_to_backlog, - const bool addition) + const bool addition /* = false */) { // Validate to add metadata. task.validate (false); @@ -607,6 +607,13 @@ void TDB2::update ( Task original; if (not addition && get (task.get ("uuid"), original)) { + if (add_to_backlog) + { + // All locally modified tasks are timestamped, implicitly overwriting any + // changes the user or hooks tried to apply to the "modified" attribute. + task.setAsNow ("modified"); + } + // Update the task, wherever it is. if (!pending.modify_task (task)) completed.modify_task (task); From 55db1239bd90b8f0c51b56f8c29aca335224bcf8 Mon Sep 17 00:00:00 2001 From: Wilhelm Schuermann Date: Mon, 23 Mar 2015 16:28:53 +0100 Subject: [PATCH 5/5] Info: Hide "modified" attribute changes - The info report shows modifications already. "modified" attribute updates are implied by other attributes being changed, so there is no need to clutter the report with them. --- src/feedback.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/feedback.cpp b/src/feedback.cpp index 5e5bbd92f..3ece2778f 100644 --- a/src/feedback.cpp +++ b/src/feedback.cpp @@ -252,6 +252,7 @@ std::string taskInfoDifferences ( for (name = beforeAtts.begin (); name != beforeAtts.end (); ++name) if (*name != "uuid" && + *name != "modified" && before.get (*name) != after.get (*name) && before.get (*name) != "" && after.get (*name) != "") {