summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* collapse_posts: Fix some postings getting lost when collapsingRahix2020-07-211-1/+1
| | | | | | | | | | 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.
* collapse_posts: Fix segfault when depth is too bigRahix2020-07-211-1/+1
| | | | | | | 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.
* collapse_posts: Use --depth as the collapse_depthRahix2020-07-211-2/+8
| | | | Use the value from --depth as the collapse_depth for --collapse.
* collapse_posts: Add a collapse_depth attributeRahix2020-07-212-6/+7
| | | | | Replace the hardcoded depth of 3 with a class attribute that can later be set from a commandline argument.
* first try for implementing --depth for registerjohannes@debussy2020-07-212-14/+32
|
* Use PAGER when environment variable is setMartin Michlmayr2020-06-181-10/+15
| | | | | | | The code looked for "less" if $PAGER is not set, but it didn't actually use $PAGER when it it defined. Fixes #1674
* Fix typos in commentsMartin Michlmayr2020-05-2110-11/+11
|
* Fix compilation warningMartin Michlmayr2020-05-181-1/+1
|
* Revert "Compare price annotations using their textual rendering"Martin Michlmayr2020-05-181-3/+1
| | | | | | This reverts commit a6a58af28f30ee81f86604b56740d98af8b75c38. Fixes #1907
* Revert "Change --invert to invert displayed amounts and totals, not amounts"Martin Michlmayr2020-05-181-2/+1
| | | | | | This reverts commit 9ad0dcc85a3ec59a1dd23f36964d083cf59bd7a9. Fixes #1895
* Fix some typosMartin Michlmayr2020-05-161-1/+1
|
* Fix: library path issueHenrik Pingel2020-05-131-0/+1
|
* Revert "Correction to the way parens are parsed in query expressions"John Wiegley2020-05-072-47/+9
| | | | This reverts commit 49b07a1c19489547b859d61fbc5c240aff224dda.
* Improve conditional for exclusive optionsMartin Michlmayr2020-05-071-1/+1
|
* Ensure that apply directives have an argumentMartin Michlmayr2020-04-271-0/+2
| | | | | | | | The directive `apply account` and similar directives (fixed, year...) require an argument. Ensure that an argument is given. Fixes #553 Fixes #1854
* Fix buffer overflow when evaluating pricing dateSarah Jamie Lewis2020-04-271-0/+4
|
* Increase the error display text limitJohn Wiegley2020-04-261-1/+1
|
* Add two (for the moment undocumented) functions:John Wiegley2020-04-232-0/+25
| | | | | | | | | | | | | | | | | | | | - 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)
* fix: Fix #543 by tracking an account's real balanceDaraul2020-04-054-7/+23
| | | | | | | | | | | | | | 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.
* Make explicit option a no-opCandyAngel2020-04-033-20/+3
| | | | Fixes #1877
* use built-in cmake precompiled header support when availableAndy Clayton2020-04-021-1/+11
| | | | | | | | | | | | | 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
* Look up annotated amounts within balances by their displayed nameJohn Wiegley2020-03-272-2/+35
|
* Compare price annotations using their textual renderingJohn Wiegley2020-03-271-1/+3
|
* Add an assertion to src/xact.ccJohn Wiegley2020-03-271-0/+2
|
* Simple whitespace fixJohn Wiegley2020-03-271-1/+1
|
* py3: ensure python output is not lostAndy Clayton2020-03-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* py3: fix builtin ledger module for python commandAndy Clayton2020-03-261-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fix python3 command (argv) wchar_t conversionAndy Clayton2020-03-261-4/+6
| | | | | | | | | | 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.
* Specify namespace of uintmax_takater2020-03-033-6/+6
| | | | | | | 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.
* fix #1850: segfault when using ledger printTobias Pankrath2020-01-081-1/+1
|
* Add --averaged-lot-pricesJohn Wiegley2019-12-064-0/+81
| | | | | This joins together lots of the same underlying, averaging the reported price and using the date of the oldest lot.
* Port to python3Dimitri John Ledkov2019-12-058-17/+63
|
* Modernize CMake using backported FindPython module.Dimitri John Ledkov2019-12-051-14/+5
|
* Format annotations using format that can be parsedOleg Bulatov2019-11-272-1/+3
| | | | | | | | | | | | | | | | | I expect an output of `ledger print` to be consumable by ledger. But on the next journal ``` 2019/11/25 * test Foo 1 AAPL {1.00 EUR} [2019/11/24] Bar ``` it prints [19-Nov-24], which it does not understand with default options. With this patch it prints [2019/11/24].
* Correction to the way parens are parsed in query expressionsJohn Wiegley2019-09-172-9/+47
|
* Remove know-ification of elements due to post stateCandyAngel2019-08-271-20/+0
|
* Switch from using utf8::is_bom to utf8::starts_with_bomJohn Wiegley2019-08-181-1/+3
| | | | Fixes #1816
* option: fix typo in error messageChristian Dietrich2019-08-011-1/+1
|
* Remove an unneeded commentJohn Wiegley2019-07-051-9/+0
|
* Change --invert to invert displayed amounts and totals, not amountsJohn Wiegley2019-07-051-1/+2
|
* Add support for '%F' date format specifierMichael Budde2019-04-021-7/+7
| | | | | | | | | '%F' is equivalent to '%Y-%m-%d'. Using the '%F' format without this change this would not give any hard errors but instead give dates with wrong years because the 'has_year' trait would not be correctly detected and thus parsed dates would get set to the current year. Fixes #1775
* Remove dead codeMichael Budde2019-04-021-9/+0
|
* Fix tag value parsingMichael Budde2019-03-301-1/+1
| | | | | | | | | | | | If a tag is more than 2 characters from the beginning of the comment the tag value offset will be wrong. #1702 gives an example where the tag line starts with `;;` and the tag value thus becomes `: Bar` because of this bug. The use `index` in the offset calulation seems to be a lucky coincidence that works in the common case: "; tag: value" Fixes #1702
* Reject postings with comment after flagMichael Budde2019-03-301-1/+1
| | | | Fixes #1753
* Explicitly sort when creating the equity reportJohn Wiegley2019-03-151-11/+11
|
* Greatly simplify balance_t::operator==John Wiegley2019-03-151-8/+1
|
* Switch amounts_map to std::unordered_mapJohn Wiegley2019-03-152-1/+2
|
* Remove the 'org' command, which was always a hack to begin withJohn Wiegley2019-03-155-305/+0
|
* Change compare_by_commodity to return an integerJohn Wiegley2019-03-154-80/+108
|
* Further improvements to commodity sortingJohn Wiegley2019-03-151-4/+6
|