ZyX_I avatar ZyX_I committed d39be22

Improved codebasehq and various hgweb-based resources support

Comments (0)

Files changed (1)

plugin/aurum/drivers/mercurial.vim

 "  http://mercurial.tuxfamily.org/mercurialroot/slitaz/tazlito/
 let s:ghpath='substitute(path, "\\v^[:/]|\\.git$", "", "g")'
 let s:gcproj='matchstr(domain, "\\v^[^.]+")'
+let s:cbbase='"https://".%s.".".domain."/projects/".%s."/repositories/".%s'
+let s:cbssh=printf(s:cbbase, 'matchstr(path, "\\v^[^/]+", 1)',
+            \                'matchstr(path, ''\v[^/]+%(\/[^/]+\/?$)'')',
+            \                'matchstr(path[:-4], "\\v[^/]+$")')
+let s:cbhttps=printf(s:cbbase, 'matchstr(domain, "\\v^[^.]+")',
+            \                  'matchstr(path, "\\v^[^/]+")',
+            \                  'matchstr(path[:-4], "\\v[^/]+$")')
+unlet s:cbbase
 let s:hypsites=[
 \['domain is? "bitbucket.org"',
 \ {     'html': '"https://".domain.path."/src/".cs.hex."/".file',      'hline': '"cl-".line',
 \   'filehist': '"http://trac-".domain.path."/log/".file."?rev=".cs.hex',
 \  'changeset': '"http://trac-".domain.path."/changeset/".cs.hex',
 \        'log': '"http://trac-".domain.path."/log"',
-\      'clone': '"http://".domain.path',
-\ }],
+\      'clone': '"http://".domain.path',}],
 \['domain is? "codebasehq.com" && path[-3:] is? ".hg"',
-\ {  'html': '"https://".matchstr(path, "\\v^[^/]+", 1).".".'.
-\                     'domain."/projects/".matchstr(path, "\\v[^/]+(\/[^/]+$)@=").'.
-\                                     '"/repositories/".matchstr(path[:-4], "\\v[^/]+$").'.
-\                                     '"/blob/".cs.hex."/".file',
-\    'hline': '"L".line'}],
+\ {     'html': s:cbssh.'."/blob/".cs.hex."/".file', 'hline': '"L".line',
+\        'raw': s:cbssh.'."/raw/".cs.hex."/".file',
+\   'annotate': s:cbssh.'."/blame/".cs.hex."/".file',
+\   'filehist': s:cbssh.'."/commits/".cs.hex."/".file',
+\     'bundle': s:cbssh.'."/archive/zip/".cs.hex',
+\  'changeset': s:cbssh.'."/commit/".cs.hex',
+\        'log': s:cbssh.'."/commits/tip"',
+\      'clone': '"https://".matchstr(path, "\\v^[^/]+", 1).".".domain.matchstr(path, ''\v[^/]+\/[^/]+$'')',
+\       'push': '"ssh://hg@".domain.path',}],
 \['domain =~? "\\Vcodebasehq.com\\$" && path[-3:] is? ".hg"',
-\ {  'html': '"https://".domain."/projects/".matchstr(path, "\\v^[^/]+", 1).'.
-\                                       '"/repositories/".matchstr(path[:-4], "\\v[^/]+$").'.
-\                                       '"/blob/".cs.hex."/".file',
-\    'hline': '"L".line'}],
+\ {     'html': s:cbhttps.'."/blob/".cs.hex."/".file', 'hline': '"L".line',
+\        'raw': s:cbhttps.'."/raw/".cs.hex."/".file',
+\   'annotate': s:cbhttps.'."/blame/".cs.hex."/".file',
+\   'filehist': s:cbhttps.'."/commits/".cs.hex."/".file',
+\     'bundle': s:cbhttps.'."/archive/zip/".cs.hex',
+\  'changeset': s:cbhttps.'."/commit/".cs.hex',
+\        'log': s:cbhttps.'."/commits/tip"',
+\      'clone': '"https://".domain.path',
+\       'push': '"ssh://hg@".matchstr(domain, ''\v\.@<=.*$'')."/".matchstr(domain, "\\v^[^.]+").path',}],
 \['domain =~? "\\V\\^hg\\d\\+.codeplex.com\\$"',
 \ {  'html': '"http://".path[1:].".codeplex.com/SourceControl/changeset/view/".'.
 \                                              'cs.hex[:11].'.
 \                                 '"?rev=".cs.rev',}],
 \[ 'domain =~? ''\v^%(mercurial\.%(intuxication|tuxfamily)|hg\.mozdev|hg\.savannah\.%(non)?gnu)\.org$'' || '.
 \ '(domain is? "anonscm.debian.org" && path[:2] is? "/hg")',
-\ {  'html': '"http://".domain.path."/file/".cs.hex."/".file',  'hline': '"l".line',
-\     'raw': '"http://".domain.path."/raw-file/".cs.hex."/".file',
-\     'log': '"http://".domain.path."/graph"',
-\   'clone': '"http://".domain.path',}],
+\ {     'html': '"http://".domain.path."/file/".cs.hex."/".file',     'hline': '"l".line',
+\        'raw': '"http://".domain.path."/raw-file/".cs.hex."/".file',
+\   'annotate': '"http://".domain.path."/annotate/".cs.hex."/".file', 'aline': '"l".line',
+\   'filehist': '"http://".domain.path."/log/".cs.hex."/".file',
+\  'changeset': '"http://".domain.path."/rev/".cs.hex',
+\        'log': '"http://".domain.path."/graph"',
+\      'clone': '"http://".domain.path',}],
 \['domain is? "sharesource.org" && path[:2] is? "/hg"',
 \ {  'html': '"https://".domain.path."/file/".cs.hex."/".file', 'hline': '"l".line'}],
 \]
+unlet s:ghpath s:gcproj s:cbssh s:cbhttps
 "▶1 removechangesets :: repo, start_rev_num → + repo
 function s:F.removechangesets(repo, start)
     let changesets=a:repo.changesets
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.