##// END OF EJS Templates
backends: implemented functions for fetching backend versions via remote calls....
marcink -
r101:62999e0d default
parent child Browse files
Show More
@@ -521,6 +521,9 b' class GitRemote(object):'
521 def discover_git_version(self):
521 def discover_git_version(self):
522 stdout, _ = self.run_git_command(
522 stdout, _ = self.run_git_command(
523 {}, ['--version'], _bare=True, _safe=True)
523 {}, ['--version'], _bare=True, _safe=True)
524 prefix = 'git version'
525 if stdout.startswith(prefix):
526 stdout = stdout[len(prefix):]
524 return stdout
527 return stdout
525
528
526 @reraise_safe_exceptions
529 @reraise_safe_exceptions
@@ -142,6 +142,11 b' class HgRemote(object):'
142 }
142 }
143
143
144 @reraise_safe_exceptions
144 @reraise_safe_exceptions
145 def discover_hg_version(self):
146 from mercurial import util
147 return util.version()
148
149 @reraise_safe_exceptions
145 def archive_repo(self, archive_path, mtime, file_info, kind):
150 def archive_repo(self, archive_path, mtime, file_info, kind):
146 if kind == "tgz":
151 if kind == "tgz":
147 archiver = archival.tarit(archive_path, mtime, "gz")
152 archiver = archival.tarit(archive_path, mtime, "gz")
@@ -32,6 +32,7 b' import svn.fs'
32 import svn.repos
32 import svn.repos
33
33
34 from vcsserver import svn_diff
34 from vcsserver import svn_diff
35 from vcsserver import exceptions
35 from vcsserver.base import RepoFactory
36 from vcsserver.base import RepoFactory
36
37
37
38
@@ -48,6 +49,30 b' svn_compatible_versions = set(['
48 ])
49 ])
49
50
50
51
52 def reraise_safe_exceptions(func):
53 """Decorator for converting svn exceptions to something neutral."""
54 def wrapper(*args, **kwargs):
55 try:
56 return func(*args, **kwargs)
57 except Exception as e:
58 if not hasattr(e, '_vcs_kind'):
59 log.exception("Unhandled exception in hg remote call")
60 raise_from_original(exceptions.UnhandledException)
61 raise
62 return wrapper
63
64
65 def raise_from_original(new_type):
66 """
67 Raise a new exception type with original args and traceback.
68 """
69 _, original, traceback = sys.exc_info()
70 try:
71 raise new_type(*original.args), None, traceback
72 finally:
73 del traceback
74
75
51 class SubversionFactory(RepoFactory):
76 class SubversionFactory(RepoFactory):
52
77
53 def _create_repo(self, wire, create, compatible_version):
78 def _create_repo(self, wire, create, compatible_version):
@@ -88,6 +113,15 b' class SvnRemote(object):'
88 # for subversion
113 # for subversion
89 self._hg_factory = hg_factory
114 self._hg_factory = hg_factory
90
115
116 @reraise_safe_exceptions
117 def discover_svn_version(self):
118 try:
119 import svn.core
120 svn_ver = svn.core.SVN_VERSION
121 except ImportError:
122 svn_ver = None
123 return svn_ver
124
91 def check_url(self, url, config_items):
125 def check_url(self, url, config_items):
92 # this can throw exception if not installed, but we detect this
126 # this can throw exception if not installed, but we detect this
93 from hgsubversion import svnrepo
127 from hgsubversion import svnrepo
General Comments 0
You need to be logged in to leave comments. Login now