|
From: | Graham King |
Subject: | Git version control (was: Re: Hello / a 1st question) |
Date: | Thu, 10 Aug 2017 22:11:16 +0100 |
So, here's a bonus, to be inserted immediately below the \version line of your score:On Thu, Aug 10, 2017 at 06:40:10PM +0000, Vlad Kudelin wrote: > Lilypond just makes it natural to put everything under > version control! [...] [...] I use git, which allows me to experiment with different branches (different ways of scoring a passage) quickly and easily, and without risk of losing previous versions should I decide to revert.
\version "2.19.40"
% from snippet 197 (more to see at http://lsr.di.unimi.it/LSR/Search ):
#(define comml (object->string (command-line)))
#(define loc (+ (string-rindex comml #\space ) 2))
#(define commllen (- (string-length comml) 2))
#(define filen (substring comml loc commllen)) % filename
#(define modt (stat:mtime (stat filen))) % Last modified
#(define modts (strftime "%d %b %Y %H:%M:%S" (localtime modt))) % Command line
% gitrev (from http://lilypondblog.org/2014/01/why-use-version-control-for-engraving-scores/#more-2151 )
#(use-modules (ice-9 popen))
#(use-modules (ice-9 rdelim))
% NOTE: This function only reads the first line of the command!
#(define (strsystem_internal cmd)
(let* ((port (open-input-pipe cmd))
(str (read-line port)))
(close-pipe port)
str))
#(define-markup-command (strsystem layout props cmd) (markup?)
(interpret-markup layout props
(strsystem_internal cmd)))
gitrev = \markup { \strsystem "/opt/local/bin/git rev-parse --short HEAD" }
\header {
tagline = \markup{ \center-column{
\concat {"Music engraving by Lilypond "
$(lilypond-version) "-www.lilypond.org"
}
\line { "Version control for this edition: gitrev " \gitrev " " \modts }
}}
}
[Prev in Thread] | Current Thread | [Next in Thread] |