djl/vcprompt — pull request #32 by fingolfin (2012-11-01 15:35:31+00:00)
Title: Refactor string substitutions code, fix %a for non-git VCS

Changed @vcs methods: Instead of letting each perform substitution of %b, %s,
etc. on its own, they now return a hash with various values (such as branch,
revision, hash, ...). Then vcprompt() performs the actual substitutions.

This has multiple advantages: default values get automatically handled
uniformly (e.g. revision defaults to hash and vice versa), and adding new
substitutions is easier and less bug prone (e.g. previously
%a was only substituted by the git formatter, making it only usable
inside a git specific format string; this can't happen
anymore). Finally, all substitutions are now applied in a single spot, which
simplifies debugging.

Also, %s and %n are now replaced centrally, too, removing some more duplicated
code.