Fix bug with nested RCS.

In case there is more than one RCS that can handle a given file, for
example a git repo, and inside it mercurial repo, and inside the file to
be commited, then choose the closest one to to the file (shortest
relative path).

Closes bug 2062