\melodic \relative c { ... }
From then on, the pitch of a note will be the closest to the last one, assuming that large intervals are a lot more rare than small ones. Thus, you can enter a scale without using octavation quotes:
c d e f g a b c
the last c being an octave higher than the first. If you have to enter an interval that is greater than a fourth, you must specify whether the pitch goes up, using post-quotes:
c c' % octave up c g' % fourth up
or down, using pre-quotes:
c c, % octave down c f, % fourth down
To convert a piece of music from the old absolute-octave notation to relative octaves, lilypond provides the -Q, --find-fourths feature to locate all big intervals in your music (sorry, fully automated convert is too complex).
First, edit the .ly file, add "\relative c" to all melodic chunks:
foo = \melodic \relative c { ... }
and remove all "\octave " commands. See the example file input/test/find-fourths.ly.
Use lily to find the fourths
lilypond -Q find-fourths.ly 2>&1 | tee fourths ... find-fourths.ly:3:18: warning: Interval greater than fourth, relative: g': c d c f c g c b, c g, c f, c c'' c find-fourths.ly:3:20: warning: Interval greater than fourth, relative: c,: c d c f c g c b, c g, c f, c c'' c
Then, load a copy of the original mudela file in your favourite editor, and let it parse the 'error file' intervals. First you remove all octavation quotes. Then, jumping from warning to warning, you enter quotes as suggested by LilyPond.