ZyX_I  committed 9b0ec2f

@aurum/drivers/mercurial: Added normal subversion revisions support to repo.hypsites

  • Participants
  • Parent commits af47ac9
  • Branches default

Comments (0)

Files changed (2)

File doc/aurum.txt

 |aurum-rf-grep|: For non-python driver filenames that look like 
     {smth}:{num>=0}:{num>0} are not supported and will lead to invalid 
+*aurum-rf-svnrev* exists and produces svn revision number out of repository 
+    object and mercurial revision specification.
 Python driver was not tested under windows (wine) at all.

File plugin/aurum/drivers/mercurial.vim

             \ 'grepfail': 'Failed to search through the repository %s: %s',
             \   'scfail': 'Failed to show [paths] section '.
             \             'for the repository %s: %s',
+            \  'svnfail': 'Failed to run “hg svn info” '.
+            \             'for the repository %s: %s',
             \ 'stat1mis': 'You must specify first revision as well',
+            \ 'nosvnrev': 'Failed to find revision in “hg svn info” output '.
+            \             'in the repository %s. Output:%s',
 let s:nullrev=repeat('0', 40)
 let s:_options={
             \                                           '(substitute(v:val, "\\v<hex>", s:gitrev, "g"))'')]')
 unlet s:gitrev
 let s:hypsites+=s:_r.hypsites.mercurial
-let s:svnrev='"HEAD"'
+let s:svnrev='repo.functions.svnrev(repo, hex)'
 let s:hypsites+=map(copy(s:_r.hypsites.svn), '[v:val[0], map(copy(v:val[1]), '.
             \                                               '''substitute(v:val, "\\v<hex>", s:svnrev, "g")'')]')
 unlet s:svnrev
     return cs
+"▶1 hg.svnrev :: repo, rev → svnrev
+function s:hg.svnrev(repo, rev)
+    let lines=s:F.hg(a:repo, 'svn', ['info'], {'rev': ''.a:rev}, 0, 'svn')
+    for line in lines
+        if line[:9] is# 'Revision: '
+            return +line[10:]
+        endif
+    endfor
+    call s:_f.throw('nosvnrev', a:repo.path, "\n".join(lines, "\n"))
 "▶1 Register driver
 call s:_f.regdriver('Mercurial', s:hg)