| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
| |
Notes were already being escaped. The filename, the transaction code,
the payee,, postings' account names, and postings' cost expressions
were not. Everything else the lisp report prints appears to be a
number or a constant-valued non-string token for Lisp.
|
|
|
|
|
| |
An amount may have a (single) leading minus sign, but none after that.
Bug #2001 (and #1809).
|
|
|
|
| |
Also fix end-of-command boundary checks for keywords "at", "to", etc.
|
|
|
|
|
|
|
| |
Windows uses UTF-16 for command line arguments, so use boost::nowide
to convert to UTF-8.
Fixes #1986
|
| |
|
|
|
|
| |
Fixes #1905
|
|
|
|
|
| |
Payees declared on posting's metadata are now validated with `--check-payees`
option. Also, their aliases are now considered on reports as well.
|
| |
|
|
|
|
|
| |
This changes the error reported when a transaction with no amount is
imported.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 501fbc08ae5493db77bb34f4c4fbe1f3a3bc14e3 changed the behavior
of this function to not return the "equal" result (==0) from the
recursive call. Previously, the function returned the result of the
recursive call unconditionally.
The current behavior causes an assertion error for certain
postings. The regression test added in this commit shows such a
posting.
I found through Travis CI that the old behavior was incomplete and
caused unstable orderings, so reverting to the old behavior doesn't
work. Instead, this change adds a fallback: If the recursive call that
compares the prices numerically returns "equal", then compare the
prices with their original commodity as a tie breaker.
This commit does not change any existing ordering, it only adds
deterministic ordering in a case that currently triggers an assertion
error.
This fixes issue #1998.
|
|
|
|
| |
also add unit tests
|
|
|
|
|
|
|
|
|
|
|
| |
Ledger is treating balance assignments that have a 0 diff as having
a null posting, leading to the posting being auto-balanced and
therefore causing incorrect values to be returned for the transaction.
I fixed this by just making the posting equal to amt - amt (0 in the
right commodity).
Fixes #1942
|
|
|
|
|
|
|
|
|
|
| |
Commit 557ab32 ("Expose a new utility function for balances:
sorted_amounts") split out some code into a separate function.
Unfortunately, in the process an "if" statement was dropped,
leading to amounts being shown that shouldn't be shown because
they are smaller than the display precision.
Fixes #1969
|
| |
|
|
|
|
|
| |
`$XDG_CONFIG_HOME/ledger/ledgerrc` and `$HOME/.config/ledger/ledgerrc`
are tried first when looking for an init file.
|
| |
|
|
|
|
|
|
|
|
| |
Before this commit, doing something like 'include data/*.dat' would
produce undesired behaviour because the matches for 'data/*.dat' would
not be sorted correctly.
See https://github.com/ledger/ledger/issues/1659 for details.
|
|
|
|
|
|
|
|
|
|
| |
Currently, collapsing is only done when both --depth and --collapse are
present. This is very unintuitive and I have even stumbled over this
myself while implenting the feature.
Change --depth to behave just like --collapse in all cases (except that
--depth has a parameter associated. --collapse defaults to 0 to retain
its old behavior).
|
|
|
|
|
|
| |
The temps will not have correct depth information attached which means
a display predicate involving `depth` will most likely lead to wrong
results.
|
|
|
|
|
|
|
|
|
|
| |
Because the only_predicate and display_predicate are applied to the
original posts, not the collapsed ones, they sometimes yield wrong
results leading to entire transactions getting dropped erroneously.
As this code is only relevant to depth == 0 collapsing (that is, the old
behavior), only follow the displayed_count == 1 code-path when the depth
is 0.
|
|
|
|
|
|
|
| |
When an account already has less depth than collapse_depth, a segfault
was caused by attempting to move up the account parents until parent is
NULL. Fix this by exiting early if the depth is already less than
collapse_depth.
|
|
|
|
| |
Use the value from --depth as the collapse_depth for --collapse.
|
|
|
|
|
| |
Replace the hardcoded depth of 3 with a class attribute that can later
be set from a commandline argument.
|
| |
|
|
|
|
|
|
|
| |
The code looked for "less" if $PAGER is not set, but it didn't
actually use $PAGER when it it defined.
Fixes #1674
|
| |
|
| |
|
|
|
|
|
|
| |
This reverts commit a6a58af28f30ee81f86604b56740d98af8b75c38.
Fixes #1907
|
|
|
|
|
|
| |
This reverts commit 9ad0dcc85a3ec59a1dd23f36964d083cf59bd7a9.
Fixes #1895
|
| |
|
| |
|
|
|
|
| |
This reverts commit 49b07a1c19489547b859d61fbc5c240aff224dda.
|
| |
|
|
|
|
|
|
|
|
| |
The directive `apply account` and similar directives (fixed, year...)
require an argument. Ensure that an argument is given.
Fixes #553
Fixes #1854
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- commodity_price(NAME, DATE)
- set_commodity_price(NAME, DATE)
Using these two I am able to compute rate of return over a period of
transactions, taking additional deposits and withdrawals into account, using
the following automated transactions:
P 2019-12-31 12:00:00 ROI $1.00
2020-01-01 Start of record
(ROI) 0 ROI
= expr date >= [2020/01/01] && account =~ /Broker:Cash$/ and any(account =~ /Assets:Checking/)
(ROI) (1 ROI * (amount / commodity_price(1 ROI, date)))
= expr date >= [2020/01/01] && account =~ /:Capital:/
(ROI) (set_commodity_price(1 ROI, date, ((commodity_price(1 ROI, date) * account("ROI").amount) - amount) / account("ROI").amount) || 0 ROI)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without these changes, whether an account's balance is virtual
or real is not considered when asserting it's balance. This lead
to situations where the user must consider their virtual postings
when attemping to assert the real balance of the account. See
test/regress/543_a.test for that testcase, taken from the original
issue. This commit also includes other, fringe, situations that I
noticed while working on the fix. It essentially just adds a separate
attribute to the account class(?) that hold's the account's "real"
balance, which is only updated when the user attempts an assertion on a
real account. The virtual account's balance is updated the way it always
was.
|
|
|
|
| |
Fixes #1877
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ledger supports precompiling headers as a build speed optimization.
This is provided via a custom add_pch_rule macro. Similar functionality
is now built-in to CMake starting with the 3.16 release in November
2019. Let's use this when available to fix #1774 and start towards not
needing to maintain our own implementation.
I originally considered removing the macro fallback but in my tests it
saves enough build time that I think it is worth keeping for now.
Fixes #1774
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unbuffer python's stdio to avoid output getting stuck in buffer when
stdout is not a TTY. Normally buffers are flushed by `Py_Finalize` but
Boost has a long-standing issue preventing the proper shutdown of the
interpreter with `Py_Finalize` when embedded [1].
This applies the same fix as 139beba but to any ledger usage rather than
only the test suite. I removed `PYTHONUNBUFFERED=1` from tests as there
is no expectation that users should need to have this set for ledger to
function.
For example without this fix piping ledger into cat usually loses any
output (unless the output is large enough to cause the buffer to flush):
$ ./ledger -f "test/baseline/feat-value_py3.test" reg
<class 'bool'> True
[...]
$ ./ledger -f "test/baseline/feat-value_py3.test" reg | cat
$
Interestingly `--verify` causes `python_interpreter_t` to be destroyed
-- it doesn't appear to be otherwise -- which does call `Py_Finalize`.
As expected this fixes the issue but can also crash due to the boost
issue mentioned above:
$ ./ledger -f "test/baseline/feat-value_py3.test" --verify reg
<class 'bool'> True
[...]
Segmentation fault (core dumped)
$ ./ledger -f "test/baseline/feat-value_py3.test" --verify reg | cat
<class 'bool'> True
[...]
$
1. https://www.boost.org/doc/libs/1_62_0/libs/python/doc/html/tutorial/tutorial/embedding.html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With python3 the `python` ledger command wound up loading the ledger
module shared library rather than using the builtin module as intended.
This resulted in duplicated initialization and crashing on cleanup. It
was also visible as duplicate converter warnings when importing ledger:
$ ./ledger --no-pager python
Python 3.7.5 (default, Nov 20 2019, 09:21:52)
[...]
>>> import ledger
/usr/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for boost::posix_time::ptime already registered; second conversion method ignored.
[...]
/usr/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for ledger::xact_t already registered; second conversion method ignored.
[...]
>>> ledger
<module 'ledger' from '/home/q/src/ledger/ledger.so'>
>>> exit()
Segmentation fault (core dumped)
After this change:
Python 3.7.5 (default, Nov 20 2019, 09:21:52)
[...]
>>> import ledger
>>> ledger
<module 'ledger' (built-in)>
>>> exit()
$
Switches to PyImport_AppendInittab from python::detail::init_module
because 1) that is what the boost docs and examples show and 2)
init_module appears to be undocumented and not intended for outside use.
Fixes #1867
|
|
|
|
|
|
|
|
|
|
| |
Ensure strings passed to Py_Main have a terminating null character by
including the extra character allocated for terminating null in the size
passed to mbstowcs.
Fix argv index so all arguments are not copied to argv[0]. Fixes
potential buffer overflow due to passing argv[0] as destination with
argv[i + 1] src and size to mbstowcs.
|
|
|
|
|
|
|
| |
This fixes #1833 for me. @jwiegley said it's reasonable change, and
nobody else took action so here it goes.
The patch is the same as proposed originally, modulo whitespace.
|
| |
|
|
|
|
|
| |
This joins together lots of the same underlying, averaging the reported price
and using the date of the oldest lot.
|