Mercurial > hgsubversion
comparison svnwrap/svn_swig_wrapper.py @ 63:2e30b59a9c19
Added some coverage pragmas to stop it from trying to cover things we can't test.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Thu, 06 Nov 2008 09:47:42 -0600 |
parents | 430af23bef4a |
children | a31968146f3c |
comparison
equal
deleted
inserted
replaced
62:cc5ebdb1e8d4 | 63:2e30b59a9c19 |
---|---|
9 from svn import client | 9 from svn import client |
10 from svn import core | 10 from svn import core |
11 from svn import delta | 11 from svn import delta |
12 from svn import ra | 12 from svn import ra |
13 | 13 |
14 if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO) < (1, 5, 0): | 14 if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO) < (1, 5, 0): #pragma: no cover |
15 raise ImportError, 'You must have Subversion 1.5.0 or newer and matching SWIG bindings.' | 15 raise ImportError, 'You must have Subversion 1.5.0 or newer and matching SWIG bindings.' |
16 | 16 |
17 svn_config = core.svn_config_get_config(None) | 17 svn_config = core.svn_config_get_config(None) |
18 class RaCallbacks(ra.Callbacks): | 18 class RaCallbacks(ra.Callbacks): |
19 def open_tmp_file(self, pool): | 19 def open_tmp_file(self, pool): #pragma: no cover |
20 (fd, fn) = tempfile.mkstemp() | 20 (fd, fn) = tempfile.mkstemp() |
21 os.close(fd) | 21 os.close(fd) |
22 return fn | 22 return fn |
23 | 23 |
24 def get_client_string(self, pool): | 24 def get_client_string(self, pool): |
25 return 'hgsubversion' | 25 return 'hgsubversion' |
26 | 26 |
27 | 27 |
28 def user_pass_prompt(realm, default_username, ms, pool): | 28 def user_pass_prompt(realm, default_username, ms, pool): #pragma: no cover |
29 creds = core.svn_auth_cred_simple_t() | 29 creds = core.svn_auth_cred_simple_t() |
30 creds.may_save = ms | 30 creds.may_save = ms |
31 if default_username: | 31 if default_username: |
32 sys.stderr.write('Auth realm: %s\n' % (realm,)) | 32 sys.stderr.write('Auth realm: %s\n' % (realm,)) |
33 creds.username = default_username | 33 creds.username = default_username |
49 client.get_ssl_client_cert_file_provider(), | 49 client.get_ssl_client_cert_file_provider(), |
50 client.get_ssl_client_cert_pw_file_provider(), | 50 client.get_ssl_client_cert_pw_file_provider(), |
51 client.get_ssl_server_trust_file_provider(), | 51 client.get_ssl_server_trust_file_provider(), |
52 ] | 52 ] |
53 # Platform-dependant authentication methods | 53 # Platform-dependant authentication methods |
54 if hasattr(client, 'get_windows_simple_provider'): | 54 if hasattr(client, 'get_windows_simple_provider'): #pragma: no cover |
55 try: | 55 try: |
56 providers.append(client.get_windows_simple_provider()) | 56 providers.append(client.get_windows_simple_provider()) |
57 except: | 57 except: |
58 pass | 58 pass |
59 if hasattr(client, 'get_keychain_simple_provider'): | 59 if hasattr(client, 'get_keychain_simple_provider'): #pragma: no cover |
60 try: | 60 try: |
61 providers.append(client.get_keychain_simple_provider()) | 61 providers.append(client.get_keychain_simple_provider()) |
62 except: | 62 except: |
63 pass | 63 pass |
64 providers.extend([client.get_simple_prompt_provider(user_pass_prompt, 2), | 64 providers.extend([client.get_simple_prompt_provider(user_pass_prompt, 2), |
295 if action == 'modify': | 295 if action == 'modify': |
296 baton = editor.open_file(path, parent, base_revision, pool) | 296 baton = editor.open_file(path, parent, base_revision, pool) |
297 elif action == 'add': | 297 elif action == 'add': |
298 try: | 298 try: |
299 baton = editor.add_file(path, parent, None, -1, pool) | 299 baton = editor.add_file(path, parent, None, -1, pool) |
300 except (core.SubversionException, TypeError), e: | 300 except (core.SubversionException, TypeError), e: #pragma: no cover |
301 print e.message | 301 print e.message |
302 raise | 302 raise |
303 elif action == 'delete': | 303 elif action == 'delete': |
304 baton = editor.delete_entry(path, base_revision, parent, pool) | 304 baton = editor.delete_entry(path, base_revision, parent, pool) |
305 compute_delta = False | 305 compute_delta = False |
332 self.init_ra_and_client() | 332 self.init_ra_and_client() |
333 e_ptr, e_baton = delta.make_editor(editor) | 333 e_ptr, e_baton = delta.make_editor(editor) |
334 try: | 334 try: |
335 ra.replay(self.ra, revision, oldest_rev_i_have, True, e_ptr, | 335 ra.replay(self.ra, revision, oldest_rev_i_have, True, e_ptr, |
336 e_baton, self.pool) | 336 e_baton, self.pool) |
337 except core.SubversionException, e: | 337 except core.SubversionException, e: #pragma: no cover |
338 # can I depend on this number being constant? | 338 # can I depend on this number being constant? |
339 if (e.message == "Server doesn't support the replay command" | 339 if (e.message == "Server doesn't support the replay command" |
340 or e.apr_err == 170003 | 340 or e.apr_err == 170003 |
341 or e.message == 'The requested report is unknown.' | 341 or e.message == 'The requested report is unknown.' |
342 or e.apr_err == 200007): | 342 or e.apr_err == 200007): |