comparison __init__.py @ 209:d06572495c5e

Better error message when we encounter an unknown SSL cert.
author Augie Fackler <durin42@gmail.com>
date Fri, 13 Mar 2009 13:41:18 -0500
parents 91db8fc049b0
children 2165461d2dd8
comparison
equal deleted inserted replaced
208:de3807ceea5c 209:d06572495c5e
14 14
15 import os 15 import os
16 16
17 from mercurial import commands 17 from mercurial import commands
18 from mercurial import hg 18 from mercurial import hg
19 from mercurial import util as mutil
20
21 from svn import core
19 22
20 import svncommand 23 import svncommand
21 import fetch_command 24 import fetch_command
22 import tag_repo 25 import tag_repo
23 import util 26 import util
29 repo.__class__ = tag_repo.generate_repo_class(ui, repo) 32 repo.__class__ = tag_repo.generate_repo_class(ui, repo)
30 33
31 34
32 def svn(ui, repo, subcommand, *args, **opts): 35 def svn(ui, repo, subcommand, *args, **opts):
33 '''see detailed help for list of subcommands''' 36 '''see detailed help for list of subcommands'''
37 try:
38 return svncommand.svncmd(ui, repo, subcommand, *args, **opts)
39 except core.SubversionException, e:
40 if e.apr_err == 230001:
41 raise mutil.Abort('It appears svn does not trust the ssl cert for this site.\n'
42 'Please try running svn ls on that url first.')
43 raise
34 44
35 return svncommand.svncmd(ui, repo, subcommand, *args, **opts)
36 45
37 def svn_fetch(ui, svn_url, hg_repo_path=None, **opts): 46 def svn_fetch(ui, svn_url, hg_repo_path=None, **opts):
38 '''clone Subversion repository to a local Mercurial repository. 47 '''clone Subversion repository to a local Mercurial repository.
39 48
40 If no destination directory name is specified, it defaults to the 49 If no destination directory name is specified, it defaults to the
46 if not hg_repo_path: 55 if not hg_repo_path:
47 hg_repo_path = hg.defaultdest(svn_url) + "-hg" 56 hg_repo_path = hg.defaultdest(svn_url) + "-hg"
48 ui.status("Assuming destination %s\n" % hg_repo_path) 57 ui.status("Assuming destination %s\n" % hg_repo_path)
49 should_update = not os.path.exists(hg_repo_path) 58 should_update = not os.path.exists(hg_repo_path)
50 svn_url = util.normalize_url(svn_url) 59 svn_url = util.normalize_url(svn_url)
51 res = fetch_command.fetch_revisions(ui, svn_url, hg_repo_path, **opts) 60 try:
61 res = fetch_command.fetch_revisions(ui, svn_url, hg_repo_path, **opts)
62 except core.SubversionException, e:
63 if e.apr_err == 230001:
64 raise mutil.Abort('It appears svn does not trust the ssl cert for this site.\n'
65 'Please try running svn ls on that url first.')
66 raise
52 if (res is None or res == 0) and should_update: 67 if (res is None or res == 0) and should_update:
53 repo = hg.repository(ui, hg_repo_path) 68 repo = hg.repository(ui, hg_repo_path)
54 commands.update(ui, repo, repo['tip'].node()) 69 commands.update(ui, repo, repo['tip'].node())
55 return res 70 return res
56 71