git uses 'git-upload-pack' in params[:service] for read actions without login (anonymous). To make it work for hg we need to replace this parameter value in the condition with 'hg' which is what hg sends in those cases.
To match the rest of the file and the purpose 'git_command' was replaced with 'hg_command'
I also insured that this only change the behavior on public repositories and their read actions (clone, pull).
--HG-- branch : heptapod