|
I think the majority of the mappings could be catched with this transformation:
aproto://[auser@](ahost.xz[:aport]/[aprefix/])path/to/repo[.git] -> (bproto://bhost.xz[:bport]/[bprefix/][otherstuff])path/to/repo ie. Take the substring from a clone URL, starting from hostname, ending before the repository path - name this clonebase from now on. The rest of the clone URL is the repositorypath with a potentially trailing .git removed, together with the webbase you can form the repoUrl key for a specific "Git Browser" Instance.
Your idea of adding the target URL for a normal Browser, could be done in two ways: make the "Git Browser" Classes generate them from the repoUrl, or (taking Gitweb as example) add the query portion to the webbase and remove it when generating the repoUrl.
For the examples above, in a map that you can graphically configure in the global settings you`d have these entries:
ie. git://mark-pc1.markwaite.net/git/foo -> finds clonebase = mark-pc1.markwaite.net/git/, repositorypath = foo, webbase = http://mark-pc1.markwaite.net/gitweb/?p=, browser = [$class: 'GitWeb'] -> website = webbase + repositorypath = http://mark-pc1.markwaite.net/gitweb/?p=foo -> browserurl = http://mark-pc1.markwaite.net/gitweb-/?p=foo- -> browser = [$class: 'GitWeb', repoUrl: 'http://mark-pc1.markwaite.net/gitweb']
I think a really big portions of the are covered with this rather simple scheme. Of yourse you can always have totally unrelated clone URS and webpages, and existing installations should still use the values specified in the jobs. But it would be a nice way of having a configurable default.
-
the scp URLs [user@]host.xz:path/to/repo.git/ and raw file URLs /path/to/repo.git/ schould be internally converted to the "protocol URLS" for consistent clone URL syntax and simpler matching.
-
Matching a clonebase needs to take the longest match, so you could override a Server default for single repositories.
|