changeset 197:43d56e973c3c

Replace a few asserts with aborts.
author Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
date Thu, 12 Feb 2009 15:08:53 +0100
parents 77812f98e250
children df4611050286
files fetch_command.py hg_delta_editor.py
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/fetch_command.py
+++ b/fetch_command.py
@@ -63,6 +63,10 @@ def fetch_revisions(ui, svn_url, hg_repo
         initializing_repo = True
         start = skipto_rev
 
+    if initializing_repo and start > 0:
+        raise merc_util.Abort('Revision skipping at repository initialization '
+                              'remains unimplemented.')
+
     # start converting revisions
     for r in svn.revisions(start=start):
         valid = False
@@ -71,8 +75,6 @@ def fetch_revisions(ui, svn_url, hg_repo
             if hg_editor._is_path_valid(p):
                 valid = True
                 break
-        if initializing_repo and start > 0:
-            assert False, 'This feature not ready yet.'
         if valid:
             # got a 502? Try more than once!
             tries = 0
--- a/hg_delta_editor.py
+++ b/hg_delta_editor.py
@@ -539,7 +539,8 @@ class HgChangeReceiver(delta.Editor):
                 raise IOError
            # True here meant nuke all files, shouldn't happen with branch closing
             if self.commit_branches_empty[branch]: #pragma: no cover
-               assert False, 'Got asked to commit non-closed branch as empty with no files. Please report this issue.'
+               raise util.Abort('Empty commit to an open branch attempted. '
+                                'Please report this issue.')
             extra = our_util.build_extra(rev.revnum, branch,
                                      open(self.uuid_file).read(),
                                      self.subdir)
@@ -887,8 +888,8 @@ class HgChangeReceiver(delta.Editor):
 
         handler, baton = delta.svn_txdelta_apply(source, target, None)
         if not callable(handler): #pragma: no cover
-            # TODO(augie) Raise a real exception, don't just fail an assertion.
-            assert False, 'handler not callable, bindings are broken'
+            raise util.Abort('Error in Subversion bindings: '
+                             'cannot call handler!')
         def txdelt_window(window):
             try:
                 if not self._is_path_valid(self.current_file):