Commits

ZyX_I committed 52a8630

@%aurum/drivers/mercurial: Improved support for old mercurial versions

Comments (0)

Files changed (2)

autoload/aurum/drivers/mercurial.vim

             \ 'norev' : 'No revision %s in repository %s',
             \ 'nofile': 'File %s is not present in revision %s '.
             \           'from repository %s',
-            \  'csuns': 'Unable to get changeset from repository %s: '.
-            \           'operation not supported',
             \'statuns': 'Unable to get working directory status '.
             \           'of repository %s: operation not supported',
             \ 'comuns': 'Unable to commit to repository %s: '.

python/aurum/aumercurial.py

 from mercurial import hg, ui, commands, match
-from mercurial.repo import error
+try:
+    from mercurial.repo import error
+except ImportError:
+    from mercurial import error
 import vim
 import os
 import json
 import re
 import sys
 
+if hasattr(error, 'RepoLookupError'):
+    RepoLookupError=error.RepoLookupError
+else:
+    RepoLookupError=error.RepoError
+
 def outermethod(func):
     """
         Decorator used to make functions omit showing python traceback in case vim_throw was used.
 
 def g_cs(repo, rev):
     try:
-        if not hasattr(repo, '__getitem__'):
-            vim.command('call s:_f.throw("csuns", '+nonutf_dumps(repo.path)+')')
-            raise AurumError()
         return repo[rev]
-    except error.RepoLookupError:
+    except RepoLookupError:
         vim_throw('norev', rev, repo.path)
 
 def g_fctx(cs, filepath):