(bug 54686) re-enable support for svn repo revision detection (from compat)

* re-enable old code still there
* add support for git sha hash (cf. change 85523)
* try to avoid to excessive use of try...except structures
* hash is primary identifier thus swapped with revision number
* revision number for git prefixed with "g" for svn with "s"
* some PEP8

Change-Id: Ia5b6c30715b1ef4e103701e159987fe9b506660d
Merge "(bug 54686) re-enable support for svn repo revision detection (from compat)"