~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-05-08 07:05:00 UTC
  • mfrom: (3376.2.15 no-asserts)
  • Revision ID: pqm@pqm.ubuntu.com-20080508070500-9zyyvsk0eev20t4w
(mbp) remove and disallow assert statements

Show diffs side-by-side

added added

removed removed

Lines of Context:
439
439
 
440
440
    def version_file(self, file_id, trans_id):
441
441
        """Schedule a file to become versioned."""
442
 
        assert file_id is not None
 
442
        if file_id is None:
 
443
            raise ValueError()
443
444
        unique_add(self._new_id, trans_id, file_id)
444
445
        unique_add(self._r_new_id, file_id, trans_id)
445
446
 
509
510
        applied.
510
511
        """
511
512
        try:
512
 
            # there is a new id for this file
513
 
            assert self._new_id[trans_id] is not None
514
513
            return self._new_id[trans_id]
515
514
        except KeyError:
516
515
            if trans_id in self._removed_id:
1241
1240
                        file_id = self._tree.get_root_id()
1242
1241
                    else:
1243
1242
                        file_id = self.tree_file_id(trans_id)
1244
 
                    assert file_id is not None
1245
1243
                    # File-id isn't really being deleted, just moved
1246
1244
                    if file_id in self._r_new_id:
1247
1245
                        continue
1768
1766
    new_conflicts = set()
1769
1767
    for c_type, conflict in ((c[0], c) for c in conflicts):
1770
1768
        # Anything but a 'duplicate' would indicate programmer error
1771
 
        assert c_type == 'duplicate', c_type
 
1769
        if c_type != 'duplicate':
 
1770
            raise AssertionError(c_type)
1772
1771
        # Now figure out which is new and which is old
1773
1772
        if tt.new_contents(conflict[1]):
1774
1773
            new_file = conflict[1]
1985
1984
                    # preserve the execute bit when backing up
1986
1985
                    if keep_content and executable[0] == executable[1]:
1987
1986
                        tt.set_executability(executable[1], trans_id)
1988
 
                else:
1989
 
                    assert kind[1] is None
 
1987
                elif kind[1] is not None:
 
1988
                    raise AssertionError(kind[1])
1990
1989
            if versioned == (False, True):
1991
1990
                tt.version_file(file_id, trans_id)
1992
1991
            if versioned == (True, False):