Commit graph

2598 commits

Author SHA1 Message Date
Tobias Predel
81ca04fc8c
Declare in corresponding header files and dissolve main.h (#3796)
* Declare in corresponding header files and dissolve main.h

Apply include-what-you-use

* Remove further unncessary includes

* Incorporate review comment

* Do not declare static functions and variables in header

* Adapt test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-03-01 14:47:42 -05:00
Dustin J. Mitchell
a701f8fc7d
Open Replica read-only when possible (#3776)
* Open Replica read-only when possible

Specifically, when either
 - the command is read-only; or
 - the command requires GC (including recurrence updates) but GC is disabled by config

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-14 10:25:19 +01:00
Dustin J. Mitchell
fdb7e5e020
Test for unusual task data (#3770)
* Test for unusual task data

A task might have any combination of keys and values, but Taskwarrior
often assumes that only valid values can occur, and crashes otherwise.
This is highly inconvenient, as it's often impossible to do anything
with the invalid task -- Taskwarrior just fails without modifying it.

So, this is the beginning of some testing for such invalid tasks, with
the goal of making Taskwarrior due something reasonable. In general, an
invalid attribute value is treated as if it was not set. This is not
exhaustive, and there are likely still bugs of this sort, but as we find
them we can fix and add regression tests to this script.

This introduces a new test-only binary that creates a "bare" task using
TaskChampion, avoiding Taskwarrior's efforts to not create "unusual"
tasks.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-05 08:20:35 -05:00
Dustin J. Mitchell
aeeec16984
Handle 'until' and 'recur' simiar to handling of 'gc' (#3753)
This centralizes updates to recurrence and 'until' in Command, instead
of doing so in each individual command implementation.

This is preparatory to opening the TaskChampion replica in read-only
mode.
2025-01-18 02:20:41 -05:00
Dustin J. Mitchell
dcbe916286
Make test hooks executable (#3728) 2024-12-17 19:08:48 -05:00
Dustin J. Mitchell
cc505e4881
Support importing Taskwarrior v2.x data files (#3724)
This should ease the pain of upgrading from v2.x to v3.x.
2024-12-17 01:24:45 +00:00
Dustin J. Mitchell
4797c4e17e
Check Datetime addition when performing recurrence (#3708) 2024-11-29 09:12:20 -05:00
Felix Schurk
68c63372c1
change fedora39 to fedora41 runner (#3698)
* change fedora39 to fedora41 runner

* update github workflow runner file
2024-11-25 05:54:43 +01:00
Dustin J. Mitchell
a2f9b92d6c
Better undo output (and remove undo.style config) (#3672) 2024-11-07 14:56:34 -05:00
Dustin J. Mitchell
c9967c20e2
Restore support for task info journal (#3671)
This support was removed before Taskwarrior-3.x, and is now restored,
including the original tests removed in
ddd367232e
2024-11-06 07:39:39 -05:00
Dustin J. Mitchell
96c72f3e06
Issue warnings instead of errors for 'weird' tasks (#3646)
* Issue warnings instead of errors for 'weird' tasks

* Support more comprehensive checks when adding a task
2024-10-22 15:15:51 -04:00
Gagan Nagaraj
d75ef7f197
Check if end date is being set to a pending task (#3622)
check if end date is being set to a pending task

-throw error if end date is being set to a pending task
- add test for the bug
2024-09-13 12:16:20 -04:00
Dustin J. Mitchell
c719cce4f1
Run all C++ tests from a single executable (#3582) 2024-08-12 00:20:17 +00:00
Dustin J. Mitchell
4ff63a7960
Use TaskChampion 0.7.0, now via cxx instead of hand-rolled FFI (#3588)
TC 0.7.0 introduces a new `TaskData` type that maps to Taskwarrior's
`Task` type more cleanly. It also introduces the idea of gathering lists
of operations and "committing" them to a replica.

A consequence of this change is that TaskChampion no longer
automatically maintains dependency information, so Taskwarrior must do
so, with its `TDB2::dependency_sync` method. This method does a very
similar thing to what TaskChampion had been doing, so this is a shift of
responsibility but not a major performance difference.

Cxx is .. not great. It is missing a lot of useful things that make a
general-purpose bridge impractical:

 - no support for trait objects
 - no support for `Option<T>` (https://github.com/dtolnay/cxx/issues/87)
 - no support for `Vec<Box<..>>`

As a result, some creativity is required in writing the bridge, for
example returning a `Vec<OptionTaskData>` from `all_task_data` to allow
individual `TaskData` values to be "taken" from the vector.

That said, Cxx is the current state-of-the-art, and does a good job of
ensuring memory safety, at the cost of some slightly awkward APIs.

Subsequent work can remove the "TDB2" layer and allow commands and other
parts of Taskwarrior to interface directly with the `Replica`.
2024-08-11 02:06:00 +00:00
Dustin J. Mitchell
49e09a9783
Remove accidentally-included sqlite3 file (#3589) 2024-08-08 03:11:56 +00:00
Dustin J. Mitchell
17889a3f25
Actually run shell tests (#3583)
Two of these used EXPFAIL which, because nothing is interpreting the TAP
output, does not work. So, that functionality is removed, and the
expected-to-fail bits are commented out or removed.

There was a conditional on the filename in `bash_tap.sh` which caused it
to not actually do anything and just run the test as a simple shell
script. That, too, has been removed.
2024-08-07 00:44:12 +00:00
Felix Schurk
93356b39c3 add initial bulk run from pre-commit over all files 2024-07-29 22:34:51 +02:00
Felix Schurk
954d3f5058 add blank line between cmake.h header include to prevent sorting
* add required comment in the line below cmake.h include header
2024-07-29 22:33:17 +02:00
Adrian Sadłocha
bb72ea6169
Remove encoding declaration in Python files (#3568)
As per
https://docs.python.org/3.11/reference/lexical_analysis.html#encoding-declarations,
the default encoding of Python files is UTF-8. In fact, it's been the
default encoding since Python 3.0 (released in 2008).
2024-07-26 23:36:23 -04:00
Adrian Sadłocha
9c49863795
Make task news nag configurable and deterministic (#3567)
This patch fixes #3497.
2024-07-26 20:30:54 -04:00
Adrian Sadłocha
7ea4baed77
Warn if an import contains multiple occurrences of the same UUID (#3560) 2024-07-19 22:27:16 -04:00
Dustin J. Mitchell
7d79b9e516
Rename 'expiration.on-sync' to 'purge.on-sync' (#3556)
Taskwarrior uses "expire" to refer to deletion of tasks past their
"until" date, so let's use `purge` to link this semantically to the
`task purge` command.
2024-07-14 15:45:26 -04:00
Dustin J. Mitchell
1304d6361c
Restore 'task purge' functionality (#3540)
Co-authored-by: ryneeverett <ryneeverett@gmail.com>
2024-07-14 15:59:00 +00:00
Dustin J. Mitchell
d4649dd210
Revert "Do not create recurring tasks before today (#3542)" (#3555)
This reverts commit 6d3519419e.
2024-07-13 19:12:49 -04:00
Dustin J. Mitchell
213b9d3aee
Add support for task expiration (#3546) 2024-07-09 16:39:39 -04:00
Will R S Hansen
2bd609afe3
Export tasks in a deterministic order (#3549)
fix issue #3527
2024-07-09 03:22:14 +00:00
koleesch
847c482c25
Remove duplicate check from task diag (#3545) 2024-07-07 13:19:54 -04:00
Dustin J. Mitchell
6d3519419e
Do not create recurring tasks before today (#3542)
Tasks can be due "today", as `task add foo due:today ..` is a common
form. However, recurrences before that are just not created.

This avoids a lengthy "hang" when recurrences are updated on an old task
database, as many tasks in the past are created.
2024-07-07 08:51:09 -04:00
Sebastian Carlos
b70d8ef574
Remove locking config (#3519)
This flag is no longer needed. It was used to control file locking on the *.data files.

Co-authored-by: Sebastian Carlos <sebastiancarlos@gmail.com>
2024-06-28 18:12:10 -04:00
Felix Schurk
5ab51271b0
increase timout to 10s and run on ubuntu-latest (#3523)
As identified in #3512 it seams as the problem was the internal timeout.
Closes #3507.
2024-06-28 18:11:53 -04:00
Dustin J. Mitchell
9cd1b96e1f
Remove support for the F4 format (#3494)
This was only still used in tests.
2024-06-26 07:33:46 +02:00
Felix Schurk
e0e6ea7170
remove test certificates and link in python code (#3506)
With taskwarrior > 3.0 these are no longer required and thus can be
removed.
2024-06-22 19:52:43 -04:00
Dustin J. Mitchell
8a807af2ef
Add test that on-add returning 1 does not add task (#3457)
This test existed, but didn't notice that the task was actually added.
The bug itself was fixed in #3443.
2024-05-15 08:11:45 -04:00
Dustin J. Mitchell
aebbfaff98
Be resilient to different numbers of local changes (#3449)
With an explanation in the comments
2024-05-14 22:03:16 -04:00
Maarten Aertsen
fb16dbf7cf
Test modification of a task by an on-add hook (test case for #3416) (#3443)
* Add test case to cover https://github.com/GothenburgBitFactory/taskwarrior/issues/3416

* Add (builtin) on-add-modify test hook and use it

* TDB2::add() move hook invocation before save (#3416)
2024-05-14 21:47:43 -04:00
Felix Schurk
82e0d53cdf
add ctest as test driver (#3446) 2024-05-10 01:20:54 +00:00
Felix Schurk
2361521449
remove stress_test file (#3447)
Close #3422
2024-05-08 21:33:17 -04:00
Dustin J. Mitchell
8aa4758993
add targets for individual tests (#3431) 2024-05-03 10:06:29 -04:00
Dustin J. Mitchell
28a46880a2
Treat a nonzero exit status as a failure (#3430)
And fix the test cases that have been failing ,undetected
2024-05-03 13:58:09 +00:00
Christian Clauss
50cfbe8b63
Fix Python SyntaxError in tests/version.test.py (#3424)
% `ruff check`
```
error: Failed to parse test/version.test.py:92:54: Expected a statement
Error: test/version.test.py:92:54: E999 SyntaxError: Expected a statement
```
2024-05-03 00:30:02 +00:00
Christian Clauss
b7551cbba6
Fix SyntaxWarning invalid escape sequence in Python code (#3433) 2024-05-03 00:22:33 +00:00
Dustin J. Mitchell
94b3e301d1
Remove taskchampion source from this repo (#3427)
* move taskchampion-lib to src/tc/lib, remove the rest
* update references to taskchampion
* Use a top-level Cargo.toml so everything is consistent
* apply comments from ryneeverett
2024-05-02 02:45:11 +00:00
mattsmida
ef9613e2d6
Renaming test files according to their language (#3407) 2024-05-01 14:28:07 -04:00
Felix Schurk
d093ce3d84
Fix test script paths (#3387)
* fix path to task executable in pyton tests

The current approach would copy the current files into the `build/test`
directory. Updating the paths according to the custom user setup.

By the copy I appended `.py` to have a clear visible distingtion which
ones are the python tests.

As soon as a source file in the normal directory is changed, it is
copied over and the corresponding file is updated.

From now on the python tests would need to get run in the according
build directory.

* reflect the current build instruction in PR template

* update paths and globing in run_all

* add line break for every cpp test

* remove .gitignore in test folder

As now all the auxillary files such as `all.log` as well as the
executables are present in the `build` directory there is no longer a
need to ignore them.

* update paths in python test scripts and enable deactivated

* remove .py extension when copy to build

Further remove glob pattern for `*.t.py` tests.

* remove accidentally added template.t from test files
2024-04-28 15:38:14 -04:00
Felix Schurk
eaef05ee95
Update fedora 38 docker container to fedora 40 (#3396) 2024-04-24 08:31:36 -04:00
Dustin J. Mitchell
0a491f36ad
Store all modified tasks for use by on-exit hook (#3352)
The on-exit hook gets all modified tasks as input, but this was omitted
in the previous release. This adds a test for the desired behavior, and
updates TDB2 to correctly store the required information.
2024-04-15 21:14:25 -04:00
Felix Schurk
5a56cff88b
prefix regex strings to be treated as raw strings (#3322)
Source for documentation
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals.
Closes #3316.
2024-03-31 09:08:56 -04:00
Dustin J. Mitchell
aaff97d878
Use opensuse tumbleweed (#3282) 2024-03-04 17:42:27 +00:00
Dustin J. Mitchell
18a8bd2997
Use corrosion instead of CMakeRust (#3273)
* Use corrosion instead of CMakeRust
* use OpenSUSE tumbleweed (latest) to get newer CMake
2024-03-02 16:21:34 -05:00
Felix Schurk
8dd29e0a8a
Change to out-of source build, Update build instructions (#3271)
* update build instructions

Usage of "modern" CMake syntax and using specific out of source build.
Further add example on how to build in parallel, build a specific target
and how to change the compiler.

This closes #3236.
2024-02-25 12:27:52 -05:00