drop patches (applied upstream)
Jochen Sprickerhof
2 years ago
0 | From: Chad Phillips <chad@apartmentlines.com> | |
1 | Date: Wed, 2 Oct 2019 19:43:55 -0700 | |
2 | Subject: Fix #192: add disallowed reports with error message | |
3 | ||
4 | TaskWarrior 2.5.2 includes a new 'timesheet' report that does not allow | |
5 | configuration of anything but the report filter. This report is so | |
6 | non-standard that it doesn't make any sense to try and display it in the | |
7 | standard VIT report format. | |
8 | ||
9 | Therefore, a new disallowed_reports list is kept, which removes these | |
10 | reports from the valid list of generated reports, and throws an error | |
11 | message with instructions on how to run the report as a shell command, | |
12 | eg. ':!w task timesheet | |
13 | --- | |
14 | vit/application.py | 2 ++ | |
15 | vit/config_parser.py | 5 +++++ | |
16 | 2 files changed, 7 insertions(+) | |
17 | ||
18 | diff --git a/vit/application.py b/vit/application.py | |
19 | index 7650171..8f659c3 100644 | |
20 | --- a/vit/application.py | |
21 | +++ b/vit/application.py | |
22 | @@ -396,6 +396,8 @@ class Application(): | |
23 | self.update_report(command) | |
24 | if 'uuid' in metadata: | |
25 | metadata.pop('uuid') | |
26 | + elif command in self.task_config.disallowed_reports: | |
27 | + self.activate_message_bar("Report '%s' is non-standard, use ':!w task %s'" % (command, command), 'error') | |
28 | else: | |
29 | # Matches 's/foo/bar/' and s%/foo/bar/, allowing for separators | |
30 | # to be any non-word character. | |
31 | diff --git a/vit/config_parser.py b/vit/config_parser.py | |
32 | index 37b03f1..ad802ee 100644 | |
33 | --- a/vit/config_parser.py | |
34 | +++ b/vit/config_parser.py | |
35 | @@ -193,6 +193,9 @@ class TaskParser(object): | |
36 | self.projects = [] | |
37 | self.contexts = {} | |
38 | self.reports = {} | |
39 | + self.disallowed_reports = [ | |
40 | + 'timesheet', | |
41 | + ] | |
42 | self.command = Command(self.config) | |
43 | self.get_task_config() | |
44 | self.get_projects() | |
45 | @@ -309,6 +312,8 @@ class TaskParser(object): | |
46 | reports = {} | |
47 | subtree = self.subtree('report.') | |
48 | for report, attrs in list(subtree.items()): | |
49 | + if report in self.disallowed_reports: | |
50 | + continue | |
51 | reports[report] = { | |
52 | 'name': report, | |
53 | 'subproject_indentable': False, |