The intent here is to make similar the implementations of
getIntervalsById and getTracked, since they are both gathering a
collection of intervals from the database, but they are just using a
different criteria for which ones to pull.
This also eliminates the use of std::deque.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
Eliminates extra noise in the debug output. I.e. from #422 the original
report contained:
>> 2021-05.data: Deleted inc 20210511T161243Z # "TRACKER-6145"
>> 2021-05.data: Added inc 20210511T161243Z # "TRACKER-6145"
Which isn't doing anything.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This fixes an error where the latest interval, a non-synthetic interval,
is added to the synthetic array (and marked synthetic) if flatten() is
otherwise not able to convert it to a group of synthetic intervals.
When modify was attempting to edit this interval, it would fail since
synthetic intervals should not be written to the database unless the
database is being flattened and timewarrior believed the interval to be
modified was synthetic.
Closes#422
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
The Interval::dump() method will show if intervals are synthetic or not,
which can be useful when trying to determine why a comparison is
failing.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
The JSON library in libshared has functions to esacpe JSON's special
characters, but they are not used by default.
Closes#416
Related to #261
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This replaces the generation of man pages on project setup
by a on-demand generation via asciidoctor.
An exception are the man pages for the commands `day`, `month`, and `week`
which are simply redirects to the man page `timew-chart.1`. Those are now
static files in the Timewarrior repository.
A CMake find module to detect asciidoctor was added.
If asciidoctor is found, the targets `doc`, `man1`, and `man7` are created.
Those targets are also added to the default build target.
If asciidoctor is not available, the target `doc` is available, but it only
emits a message to install asciidoctor first.
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.
According to our test images all supported distributions have CMake > 3
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
It was possible for `summary` command, when used with the :all hint, to
skip over any intervals that start later than the first interval in the
database.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
- This is meant as a temporary fix until Timewarrior can handle intervals regardless of start time
- Closes#364
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
There are several instances where the "total" reported in the interval
summary is confusing because the summarize function would walk backward
and add all intervals with the same set of tags.
Closes#248 and #308
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
- Compute the set difference between the latest interval's tag set and the given tag set
- If no tags given, the difference is set to `{}`
- In case of an empty difference, close the current open interval, apply exclusions and update the database
- In case of a non-empty difference, just add a new open interval and let the overlap resolution do the job...
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
- The given set of tags must be a subset of the latest interval's tag set (this includes the empty case)
- If not a subset, throw an error and show the first non-matching tag
- This also prevents the stop command from doing any work on the database
- Closes#280
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
- Use default range starting at `now`
- Add check for no datetime given (rare case of e.g. `timew stop :all`)
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
I had a broken symbolic link in my extensions directory. When I ran
`timew diag` it would simply print on the screen:
```
stat error 2: No such file or directory
```
After this change, there is more context information about the source of
the error:
```
timew 1.3.0
Platform: Linux
Compiler:
Version: 7.5.0
Caps: +stdc +stdc_hosted +LP64 +c8 +i32 +l64 +vp64 +time_t64
Compliance: C++11
Build Features
Built: Aug 14 2020 05:57:06
Commit: 6fe15d26
CMake: 3.10.2
Build type: Debug
Configuration
TIMEWARRIORDB: -
Cfg: /home/sruffell/.timewarrior/timewarrior.cfg (-rw- 0 bytes)
Database: /home/sruffell/.timewarrior (drwx 4096 bytes)
$EDITOR: vim
Color theme: Built-in default
00 01 02 03 04 05 06 07 08 09 10 11 12
Extensions
Location: /home/sruffell/.timewarrior/extensions (drwx 4096 bytes)
/home/sruffell/.timewarrior/extensions/tsheet (stat error 2: No such file or directory)
```
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This is particularly bad when called from the Database::modifyInterval
call, since the delete may fail, but then the addInterval will proceed.
Closes#319
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
If calling undo on an operation the removes many entries from the
datafiles, there would be many 0 length size files remaining in the data
directory. Now they will be removed if they are empty so they will not
longer need to be checked when parsing the database.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
Allows the user to specify a maximum number of entries to store in the
undo file. By default the behavior is unchanged, and the file will grow
unbounded without user intervention.
journal.size = 0 will disable storing any entries, journal.size < 0
indicates that the size of the journal should be unlimited (the
default), otherwise it indicates the number of entries to store.
Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>