# HG changeset patch # User Augie Fackler # Date 1225986462 21600 # Node ID 2e30b59a9c19acc6685e76fa7387715a658690a8 # Parent cc5ebdb1e8d4c594d40c59aca605d1717682d9c2 Added some coverage pragmas to stop it from trying to cover things we can't test. diff --git a/fetch_command.py b/fetch_command.py --- a/fetch_command.py +++ b/fetch_command.py @@ -18,7 +18,7 @@ import svnwrap import util -def print_your_svn_is_old_message(ui): +def print_your_svn_is_old_message(ui): #pragma: no cover ui.status("In light of that, I'll fall back and do diffs, but it won't do " "as good a job. You should really upgrade your server.\n") @@ -34,7 +34,7 @@ def fetch_revisions(ui, svn_url, hg_repo skipto_rev=int(skipto_rev) have_replay = not stupid if have_replay and not callable(delta.svn_txdelta_apply(None, None, - None)[0]): + None)[0]): #pragma: no cover ui.status('You are using old Subversion SWIG bindings. Replay will not' ' work until you upgrade to 1.5.0 or newer. Falling back to' ' a slower method that may be buggier. Please upgrade, or' @@ -81,7 +81,7 @@ def fetch_revisions(ui, svn_url, hg_repo if have_replay: try: replay_convert_rev(hg_editor, svn, r) - except svnwrap.SubversionRepoCanNotReplay, e: + except svnwrap.SubversionRepoCanNotReplay, e: #pragma: no cover ui.status('%s\n' % e.message) print_your_svn_is_old_message(ui) have_replay = False @@ -95,7 +95,7 @@ def fetch_revisions(ui, svn_url, hg_repo fp.close() merc_util.rename(tmpfile, hg_editor.last_revision_handled_file) - except core.SubversionException, e: + except core.SubversionException, e: #pragma: no cover if hasattr(e, 'message') and ( 'Server sent unexpected return value (502 Bad Gateway)' ' in response to PROPFIND') in e.message: @@ -133,7 +133,7 @@ def replay_convert_rev(hg_editor, svn, r pl = svn.proplist(p2, r.revnum, recurse=True) cleanup_file_handles(svn, i) i += 1 - except core.SubversionException, e: + except core.SubversionException, e: #pragma: no cover pass props.update(pl) if p[-1] == '/': @@ -391,7 +391,7 @@ def stupid_svn_server_pull_rev(ui, svn, if e.apr_err == 170000 or (e.message.startswith("URL '") and e.message.endswith("' doesn't exist")): delete_all_files = True - else: + else: #pragma: no cover raise except BadPatchApply, e: diff --git a/svnwrap/svn_swig_wrapper.py b/svnwrap/svn_swig_wrapper.py --- a/svnwrap/svn_swig_wrapper.py +++ b/svnwrap/svn_swig_wrapper.py @@ -11,12 +11,12 @@ from svn import core from svn import delta from svn import ra -if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO) < (1, 5, 0): +if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO) < (1, 5, 0): #pragma: no cover raise ImportError, 'You must have Subversion 1.5.0 or newer and matching SWIG bindings.' svn_config = core.svn_config_get_config(None) class RaCallbacks(ra.Callbacks): - def open_tmp_file(self, pool): + def open_tmp_file(self, pool): #pragma: no cover (fd, fn) = tempfile.mkstemp() os.close(fd) return fn @@ -25,7 +25,7 @@ class RaCallbacks(ra.Callbacks): return 'hgsubversion' -def user_pass_prompt(realm, default_username, ms, pool): +def user_pass_prompt(realm, default_username, ms, pool): #pragma: no cover creds = core.svn_auth_cred_simple_t() creds.may_save = ms if default_username: @@ -51,12 +51,12 @@ def _create_auth_baton(pool): client.get_ssl_server_trust_file_provider(), ] # Platform-dependant authentication methods - if hasattr(client, 'get_windows_simple_provider'): + if hasattr(client, 'get_windows_simple_provider'): #pragma: no cover try: providers.append(client.get_windows_simple_provider()) except: pass - if hasattr(client, 'get_keychain_simple_provider'): + if hasattr(client, 'get_keychain_simple_provider'): #pragma: no cover try: providers.append(client.get_keychain_simple_provider()) except: @@ -297,7 +297,7 @@ class SubversionRepo(object): elif action == 'add': try: baton = editor.add_file(path, parent, None, -1, pool) - except (core.SubversionException, TypeError), e: + except (core.SubversionException, TypeError), e: #pragma: no cover print e.message raise elif action == 'delete': @@ -334,7 +334,7 @@ class SubversionRepo(object): try: ra.replay(self.ra, revision, oldest_rev_i_have, True, e_ptr, e_baton, self.pool) - except core.SubversionException, e: + except core.SubversionException, e: #pragma: no cover # can I depend on this number being constant? if (e.message == "Server doesn't support the replay command" or e.apr_err == 170003