I'm trying to use hledger rewrite to rewrite postings which match certain tags combinations. I would like to run hledger rewrite several times without adding additional rewrites.
To this end, I thought I can add the tag "rewritten" to the rewritten posting and ignore them in the query of the rewrite rule. But in my environment this is not working as I would expect it to.
Given the following sample.ledger file:
2018/4/1 * test
; details:beer
a 2
b
2018/4/1 * another test
; details:food
a 20
b
and the following sample.rewrite file
= a tag:details=beer not:tag:rewritten
a *-1 ; rewritten:
c *1
The hledger rewrite -f sample.journal -f sample.rewrite| hledger print -f - gives:
2018/04/01 * test
; details:beer
a 2
b
a -2 ; rewritten:
c 2
2018/04/01 * another test
; details:food
a 20
b
However, hledger rewrite -f sample.journal -f sample.rewrite|hledger print -f -|hledger rewrite -f - -f sample.rewrite gives
2018/04/01 * test
; details:beer
a 2
b
a -2 ; rewritten:
c 2
a -2 ; rewritten:
c 2
2018/04/01 * another test
; details:food
a 20
b
I would have expected that the posting with details:beer and tag:rewritten would not match a second time.
Am I missing something here?
PS: Thanks to all involved in the development of hledger from a happy user.