~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Martin Pool
  • Date: 2008-04-24 07:22:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080424072253-opmjij7xfy38w27f
Remove every assert statement from bzrlib!

Depending on the context they are:

 * turned into an explicit if/raise of either AssertionError 
   or something more specific -- particularly where they protect
   programming interfaces, complex invariants, or data file integrity
 * removed, if they're redundant with a later check, not protecting
   a meaningful invariant
 * turned into a selftest method on tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
323
323
        return branch.repository.revision_tree(revision_id)
324
324
 
325
325
    if revision_specs is not None:
326
 
        assert (old_revision_spec is None
327
 
                and new_revision_spec is None)
328
326
        if len(revision_specs) > 0:
329
327
            old_revision_spec = revision_specs[0]
330
328
        if len(revision_specs) > 1:
516
514
def _patch_header_date(tree, file_id, path):
517
515
    """Returns a timestamp suitable for use in a patch header."""
518
516
    mtime = tree.get_file_mtime(file_id, path)
519
 
    assert mtime is not None, \
520
 
        "got an mtime of None for file-id %s, path %s in tree %s" % (
521
 
                file_id, path, tree)
522
517
    return timestamp.format_patch_date(mtime)
523
518
 
524
519
 
913
908
        else:
914
909
            extra_factories = []
915
910
        if external_diff_options:
916
 
            assert isinstance(external_diff_options, basestring)
917
911
            opts = external_diff_options.split()
918
912
            def diff_file(olab, olines, nlab, nlines, to_file):
919
913
                external_diff(olab, olines, nlab, nlines, to_file, opts)