openlilylib / snippets

A place to store useful pieces of LilyPond code - custom functions, engravers, hacks, templates, examples etc.
Other
119 stars 39 forks source link

[git-commands] Adding file specific revision numbers #145

Closed Dekker1 closed 7 years ago

Dekker1 commented 8 years ago

First off thanks for the great work, this repository has been saving me quite a lot of time.

So my problem: I wanted to use the gitRevisionNumber command from the git-commands snippets to add a version number to my sheet music. However, I manage various pieces of sheet music in one repository. This means that the revision numbers will be the same for all different pieces of sheet music, which is incorrect, but to be expected, as the git command executed is: git log --oneline | wc -l. For git however it isn't a problem to make it file specific, we can use log --oneline -- /path/to/file | wc -l. I was planning on making a pull request, but I can't seem to find a way in the lilypond documentation to determine the calling file location. Which results in my question: would it be possible to create such a gitFileRevision? Or should I just use a preprocessing script?

uliska commented 8 years ago

Assuming you're on a devel version you can get that through (car (ly:input-file-line-char-column (*location*)))

If you come up with a pull request (which I'd look forward to) we can see to making it work with 2.18 as well.

uliska commented 8 years ago

Ah, or if you don't mind adding a dependency to the "new" openLilyLib you can use

\include "openlilylib"
\thisFile

(\thisFile returning a string)

Dekker1 commented 8 years ago

Thanks for the quick response, I'll have a look once I have some free time.

uliska commented 7 years ago

Closed through #146