I understand why you call this "next", but the way its used is confusing.

This is the newer revision of the file. But we are walking backwards, so it was the last thing examined.

I think I would have still named it "lastRevision" and "lastText" since from the perspective of the loop below it was the last thing examined... even though its actually the more recent revision. At least to me, I find code like this easier to read when everything speaks normally about the loop (e.g. last iteration of the loop) and I only need to remember that the loop itself is going through the graph in a particular direction (backwards).