Commits

ZyX_I committed cdfee56

Renamed “AuH url file” to “AuH url html”
Added “annotate”, “filehist”, “changeset” url types (untested)

Comments (0)

Files changed (3)

     Possible options:
     Option    Description ~
     rev       Revision that is to be refered.
-              Default: see |:AuAnnotate| (for url=file and url=raw),
-                       tip (for url=bundle),
-                       not applicable (for url=clone, url=push and url=cslog).
-    file      File that is to be refered (only for url=file or raw)
+              Default: see |:AuAnnotate| (for url=html,raw,annotate,filehist),
+                       tip (for url=bundle,changeset),
+                       not applicable (for url=log,clone,push).
+    file      File that is to be refered
+              (only for url=html,raw,annotate,filehist)
               Default: see |:AuAnnotate|.
-    url       URL type. Accepted types (default: file):
-                  Type    Description ~
-                  file    URL of the file, HTML formatted
-                  raw     URL of the file, raw bundle
-                  clone   URL of the repository, read-only
-                  push    URL of the repository, read-write
-                  bundle  URL of the repository snapshot
-                  log     URL of the commit log
+    url       URL type. Accepted types (default: html):
+                  Type      Description ~
+                  html      URL of the file, HTML formatted
+                  raw       URL of the file, raw bundle
+                  annotate  URL of the file, annotated
+                  filehist  URL of the file history
+                  bundle    URL of the repository snapshot
+                  changeset URL of the changeset (usually, diff)
+                  log       URL of the commit log
+                  clone     URL of the repository, read-only
+                  push      URL of the repository, read-write
     line      Determines whether URL fragment refering to given line should be 
-              added to the URL. Only for url=file.
+              added to the URL. Only for url=file and url=annotate.
               Default: not added. If given line is 0 then current line number 
               will be used unless `rev' or `file' options are given or refered 
               file is not the current one.
             \substitute(s:tracfunc['@FWC'][0],
             \'\V+ type ""', '+ (path)', ''))
 "▶1 hypfunc
+" TODO diff ?
 function s:hypfunc.function(opts)
     let opts=copy(a:opts)
-    let utype=get(opts, 'url', 'file')
-    if utype is# 'file' || utype is# 'raw'
+    let utype=get(opts, 'url', 'html')
+    if utype is# 'html' || utype is# 'annotate' || utype is# 'raw'
+                \       || utype is# 'filehist'
         let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf(a:opts, 'nocurf', 0)
         call s:_r.cmdutils.checkrepo(repo)
         let file=s:F.urlescape(file)
             let rev=repo.work_hex
         endif
         let cs=repo.functions.getcs(repo, rev)
+        let gitbranch=s:F.urlescape(substitute(get(cs.bookmarks, 0, 'master'),
+                    \                          '\m^origin/', '', ''))
     else
         let repo=s:_r.repo.get(a:opts.repo)
         call s:_r.cmdutils.checkrepo(repo)
-        if utype is# 'bundle'
+        if utype is# 'bundle' || utype is# 'changeset'
             let rev=get(a:opts, 'rev', 'tip')
             let cs=repo.functions.getcs(repo, rev)
             let gitbranch=s:F.urlescape(substitute(get(cs.bookmarks,0,'master'),
                 call s:_f.throw('uunsup', utype, repo.path, url)
             endif
             let r=eval(dict[utype])
-            if utype is# 'file' && has_key(opts, 'line')
-                if has_key(dict, 'line')
+            if (utype is# 'html' || utype is# 'annotate') &&
+                        \has_key(opts, 'line')
+                let lkey=utype[0].line
+                if has_key(dict, lkey)
                     if opts.line
                         let line=opts.line
                     elseif hasbuf
                         let line=line('.')
                     endif
                     if exists('line')
-                        let r.='#'.eval(dict.line)
+                        let r.='#'.eval(dict[lkey])
                     endif
                 else
                     call s:_f.warn('uunsup', 'line', repo.path, url)
             \                       ' ?file  type ""'.
             \                       ' ?line  range 0 inf'.
             \                       ' ?cmd   type ""'.
-            \                       ' ?url   in [file raw clone push bundle '.
-            \                                   'log] '.
+            \                       ' ?url   in [html raw annotate filehist'.
+            \                                  ' bundle changeset log clone'.
+            \                                  ' push] '.
             \                                  '~start'.
             \                       '}', 'filter']
 call add(s:hypcomp,

plugin/aurum/drivers/mercurial.vim

 "  http://hg.savannah.nongnu.org/hgweb/mechsys/
 "  https://sharesource.org/hg/alqua/
 "  http://mercurial.tuxfamily.org/mercurialroot/slitaz/tazlito/
+let s:ghpath='substitute(path, "\\v^[:/]|\\.git$", "", "g")'
+let s:gcproj='matchstr(domain, "\\v^[^.]+")'
 let s:hypsites=[
 \['domain is? "bitbucket.org"',
-\ {  'file': '"https://".domain.path."/src/".cs.hex."/".file',
-\     'raw': '"https://".domain.path."/raw/".cs.hex."/".file',
-\  'bundle': '"https://".domain.path."/get/".cs.hex.".tar.bz2"',
-\     'log': '"https://".domain.path."/changesets"',
-\    'line': '"cl-".line',
-\   'clone': '"https://".domain.path',
-\    'push': '"ssh://hg@".domain.path',}],
+\ {     'html': '"https://".domain.path."/src/".cs.hex."/".file',      'hline': '"cl-".line',
+\        'raw': '"https://".domain.path."/raw/".cs.hex."/".file',
+\   'annotate': '"https://".domain.path."/annotate/".cs.hex."/".file', 'aline': '"line-".line',
+\   'filehist': '"https://".domain.path."/history/".file',
+\     'bundle': '"https://".domain.path."/get/".cs.hex.".tar.bz2"',
+\  'changeset': '"https://".domain.path."/changeset/".cs.hex',
+\        'log': '"https://".domain.path."/changesets"',
+\      'clone': '"https://".domain.path',
+\       'push': '"ssh://hg@".domain.path',}],
 \['domain is? "github.com"',
-\ {  'file': '"https://".domain."/".substitute(path, "\\v^[:/]|\\.git$", "", "g")."/blob/".gitbranch."/".file',
-\     'raw': '"https://".domain."/".substitute(path, "\\v^[:/]|\\.git$", "", "g")."/raw/". gitbranch."/".file',
-\     'log': '"https://".domain."/".substitute(path, "\\v^[:/]|\\.git$", "", "g")."/commits"',
-\    'line': '"L".line',
-\   'clone': '"git://".domain."/".substitute(path, "\\v^[:/]|\\.git$", "", "g")',
-\    'push': '"git+ssh://git@".domain.":".substitute(path, "\\v^[:/]|\\.git$", "", "g")',}],
+\ {     'html': '"https://".domain."/".'.s:ghpath.'."/blob/".gitbranch."/".file',   'hline': '"L".line',
+\        'raw': '"https://".domain."/".'.s:ghpath.'."/raw/". gitbranch."/".file',
+\   'annotate': '"https://".domain."/".'.s:ghpath.'."/blame/". gitbranch."/".file', 'aline': '"LID".line',
+\   'filehist': '"https://".domain."/".'.s:ghpath.'."/commits/".gitbranch."/".file',
+\     'bundle': '"https://".domain."/".'.s:ghpath.'."/zipball/".gitbranch',
+\  'changeset': '"https://".domain."/".'.s:ghpath.'."/commit/".gitbranch',
+\        'log': '"https://".domain."/".'.s:ghpath.'."/commits"',
+\      'clone': '"git://".domain."/".'.s:ghpath,
+\       'push': '"git+ssh://git@".domain.":".'.s:ghpath,}],
 \['domain =~? "\\Vhg.sourceforge.net\\$"',
-\ {  'file': '"http://".domain."/hgweb".path[7:]."/file/".cs.hex."/".file',
-\     'raw': '"http://".domain."/hgweb".path[7:]."/raw-file/".cs.hex."/".file',
-\     'log': '"http://".domain."/hgweb".path[7:]."/log"',
-\    'line': '"l".line',
-\   'clone': '"http://".domain.":8000".path',
-\    'push': '"ssh://".user."@".domain.path',}],
+\ {     'html': '"http://".domain."/hgweb".path[7:]."/file/".cs.hex."/".file',     'hline': '"l".line',
+\        'raw': '"http://".domain."/hgweb".path[7:]."/raw-file/".cs.hex."/".file',
+\   'annotate': '"http://".domain."/hgweb".path[7:]."/annotate/".cs.hex."/".file', 'aline': '"l".line',
+\   'filehist': '"http://".domain."/hgweb".path[7:]."/log/".cs.hex."/".file',
+\  'changeset': '"http://".domain."/hgweb".path[7:]."/rev/".cs.hex',
+\        'log': '"http://".domain."/hgweb".path[7:]."/graph"',
+\      'clone': '"http://".domain.":8000".path',
+\       'push': '"ssh://".user."@".domain.path',}],
 \['domain =~? "\\Vgit.sourceforge.net\\$"',
-\ {  'file': '"http://".domain."/git/gitweb.cgi?p=".path[9:].";a=blob;hb=HEAD;f=".file',
-\     'raw': '"http://".domain."/git/gitweb.cgi?p=".path[9:].";a=blob_plain;hb=HEAD;f=".file',
-\     'log': '"http://".domain."/git/gitweb.cgi?p=".path[9:].";a=log"',
-\    'line': '"l".line',
-\   'clone': '"http://".domain.":8000".path',
-\    'push': '"ssh://".user."@".domain.path',}],
+\ {     'html': '"http://".domain."/git/gitweb.cgi?p=".path[9:].";a=blob;hb=".gitbranch.";f=".file', 'hline': '"l".line',
+\        'raw': '"http://".domain."/git/gitweb.cgi?p=".path[9:].";a=blob_plain;hb=".gitbranch.";f=".file',
+\   'filehist': '"http://".domain."/git/gitweb.cgi?p=".path[9:].";a=history;hb=".gitbranch.";f=".file',
+\  'changeset': '"http://".domain."/git/gitweb.cgi?p=".path[9:].";a=commitdiff;hb=".gitbranch',
+\        'log': '"http://".domain."/git/gitweb.cgi?p=".path[9:].";a=log"',
+\      'clone': '"http://".domain.":8000".path',
+\       'push': '"ssh://".user."@".domain.path',}],
 \['domain =~? "\\Vsvn.sourceforge.net\\$"',
-\ {  'file': '"http://".domain."/viewvc".path[8:]."/".file."?view=log"',
-\     'raw': '"http://".domain."/viewvc".path[8:]."/".file',
-\     'log': '"http://".domain."/viewvc".path[8:]."?view=log"',
-\   'clone': 'url',}],
+\ {     'html': '"http://".domain."/viewvc".path[8:]."/".file."?view=log"',
+\        'raw': '"http://".domain."/viewvc".path[8:]."/".file',
+\   'annotate': '"http://".domain."/viewvc".path[8:]."/".file."?annotate=HEAD"',
+\     'bundle': '"http://".domain."/viewvc".path[8:]."?view=tar"',
+\        'log': '"http://".domain."/viewvc".path[8:]."?view=log"',
+\      'clone': 'url',}],
 \['domain =~? "\\Vgooglecode.com\\$" && path[:2] is? "/hg"',
-\ {  'file': '"http://code.google.com/p/".matchstr(domain, "\\v^[^.]+")."/source/browse/".file."?r=".cs.hex',
-\     'log': '"http://code.google.com/p/".matchstr(domain, "\\v^[^.]+")."/source/list"',
-\     'raw': '"http://".domain."/hg-history/".cs.hex."/".file',
-\    'line': 'line',
-\   'clone': 'url',
-\    'push': 'url',}],
+\ {     'html': '"http://code.google.com/p/".'.s:gcproj.'."/source/browse/".file."?r=".cs.hex', 'hline': 'line',
+\        'raw': '"http://".domain."/hg-history/".cs.hex."/".file',
+\   'filehist': '"http://code.google.com/p/".'.s:gcproj.'."/source/list?path=/".file."&r=".cs.hex',
+\  'changeset': '"http://code.google.com/p/".'.s:gcproj.'."/source/detail?r=".cs.hex',
+\        'log': '"http://code.google.com/p/".'.s:gcproj.'."/source/list"',
+\      'clone': 'url',
+\       'push': 'url',}],
 \['domain =~? "\\Vgooglecode.com\\$" && path[:3] is? "/svn"',
-\ {  'file': '"http://code.google.com/p/".matchstr(domain, "\\v^[^.]+")."/source/browse".path[4:]."/".file',
-\     'raw': '"http://".domain.path."/".file',
-\     'log': '"http://code.google.com/p/".matchstr(domain, "\\v^[^.]+")."/source/list"',
-\    'line': 'line',
-\   'clone': 'url',}],
+\ {     'html': '"http://code.google.com/p/".'.s:gcproj.'."/source/browse".path[4:]."/".file', 'hline': 'line',
+\        'raw': '"http://".domain.path."/".file',
+\   'filehist': '"http://code.google.com/p/".'.s:gcproj.'."/source/list?path=/".file."&r=".cs.hex',
+\        'log': '"http://code.google.com/p/".'.s:gcproj.'."/source/list"',
+\      'clone': 'url',}],
 \['domain is? "code.google.com"',
-\ {  'file': '"http://code.google.com/".substitute(path, "/$", "", "")."/source/browse/".file."?r=".gitbranch',}],
-\['domain is? "anonscm.debian.org" && path[:2] is? "/hg"',
-\ {  'file': '"http://".domain.path."/".file'}],
+\ {     'html': '"http://code.google.com/".substitute(path, "/$", "", "")."/source/browse/".file."?r=".gitbranch',}],
 \['domain is? "hg.assembla.com"',
-\ {  'file': '"http://trac-".domain.path."/browser/".file."?rev=".cs.hex',
-\    'line': '"L".line',}],
+\ {     'html': '"http://trac-".domain.path."/browser/".file."?rev=".cs.hex',                'hline': '"L".line',
+\   'annotate': '"http://trac-".domain.path."/browser/".file."?annotate=blame&rev=".cs.hex', 'aline': '"L".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',
+\ }],
 \['domain is? "codebasehq.com" && path[-3:] is? ".hg"',
-\ {  'file': '"https://".matchstr(path, "\\v^[^/]+", 1).".".'.
+\ {  'html': '"https://".matchstr(path, "\\v^[^/]+", 1).".".'.
 \                     'domain."/projects/".matchstr(path, "\\v[^/]+(\/[^/]+$)@=").'.
 \                                     '"/repositories/".matchstr(path[:-4], "\\v[^/]+$").'.
 \                                     '"/blob/".cs.hex."/".file',
-\    'line': '"L".line'}],
+\    'hline': '"L".line'}],
 \['domain =~? "\\Vcodebasehq.com\\$" && path[-3:] is? ".hg"',
-\ {  'file': '"https://".domain."/projects/".matchstr(path, "\\v^[^/]+", 1).'.
+\ {  'html': '"https://".domain."/projects/".matchstr(path, "\\v^[^/]+", 1).'.
 \                                       '"/repositories/".matchstr(path[:-4], "\\v[^/]+$").'.
 \                                       '"/blob/".cs.hex."/".file',
-\    'line': '"L".line'}],
+\    'hline': '"L".line'}],
 \['domain =~? "\\V\\^hg\\d\\+.codeplex.com\\$"',
-\ {  'file': '"http://".path[1:].".codeplex.com/SourceControl/changeset/view/".'.
+\ {  'html': '"http://".path[1:].".codeplex.com/SourceControl/changeset/view/".'.
 \                                              'cs.hex[:11].'.
 \                                              '"#".substitute(file, "/", "%2f", "g")'}],
 \['domain =~? "\\Vkilnhg.com\\$"',
-\ {  'file': '"http://".domain.path."/File/".file."?rev=".cs.hex',
-\    'line': 'line'}],
+\ {  'html': '"http://".domain.path."/File/".file."?rev=".cs.hex',
+\    'hline': 'line'}],
 \['domain =~? "\\Vprojectkenai.com\\$" && path[:2] is? "/hg"',
-\ {  'file': '"http://projectkenai.com/projects/".matchstr(path, "\\v^[^~]+", 4).'.
+\ {  'html': '"http://projectkenai.com/projects/".matchstr(path, "\\v^[^~]+", 4).'.
 \                                   '"/sources/". matchstr(path, "\\v[^~]+$")."/content/".file.'.
 \                                 '"?rev=".cs.rev',}],
-\['domain is? "mercurial.intuxication.org"',
-\ {  'file': '"http://".domain.path."/file/".cs.hex."/".file',  'line': '"l".line'}],
-\['domain is? "hg.mozdev.org"',
-\ {  'file': '"http://".domain.path."/file/".cs.hex."/".file',  'line': '"l".line'}],
-\['domain =~? "\\v^hg\\.savannah\\.(non)?gnu\\.org$"',
-\ {  'file': '"http://".domain.path."/file/".cs.hex."/".file',  'line': '"l".line'}],
+\[ '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',}],
 \['domain is? "sharesource.org" && path[:2] is? "/hg"',
-\ {  'file': '"https://".domain.path."/file/".cs.hex."/".file', 'line': '"l".line'}],
-\['domain is? "mercurial.tuxfamily.org"',
-\ {  'file': '"http://".domain.path."/file/".cs.hex."/".file',  'line': '"l".line'}],
+\ {  'html': '"https://".domain.path."/file/".cs.hex."/".file', 'hline': '"l".line'}],
 \]
 "▶1 removechangesets :: repo, start_rev_num → + repo
 function s:F.removechangesets(repo, start)
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.