~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

  • Committer: Martin Pool
  • Date: 2008-05-08 04:12:06 UTC
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080508041206-tkrr8ucmcyrlzkum
Some review cleanups for assertion removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
393
393
        # faster than three separate encodes.
394
394
        utf8path = (dirname + '/' + basename).strip('/').encode('utf8')
395
395
        dirname, basename = osutils.split(utf8path)
396
 
        if file_id.__class__ != str:
 
396
        # uses __class__ for speed; the check is needed for safety
 
397
        if file_id.__class__ is not str:
397
398
            raise AssertionError(
398
399
                "must be a utf8 file_id not %s" % (type(file_id), ))
399
400
        # Make sure the file_id does not exist in this tree
1738
1739
        """
1739
1740
        self._read_dirblocks_if_needed()
1740
1741
        if path_utf8 is not None:
1741
 
            if not isinstance(path_utf8, str):
 
1742
            if type(path_utf8) is not str:
1742
1743
                raise AssertionError('path_utf8 is not a str: %s %s'
1743
1744
                    % (type(path_utf8), path_utf8))
1744
1745
            # path lookups are faster
2580
2581
            if not self._dirblocks[0][0] == '':
2581
2582
                raise AssertionError(
2582
2583
                    "dirblocks don't start with root block:\n" + \
2583
 
                    pformat(dirblocks))
 
2584
                    pformat(self._dirblocks))
2584
2585
        if len(self._dirblocks) > 1:
2585
2586
            if not self._dirblocks[1][0] == '':
2586
2587
                raise AssertionError(
2587
2588
                    "dirblocks missing root directory:\n" + \
2588
 
                    pformat(dirblocks))
 
2589
                    pformat(self._dirblocks))
2589
2590
        # the dirblocks are sorted by their path components, name, and dir id
2590
2591
        dir_names = [d[0].split('/')
2591
2592
                for d in self._dirblocks[1:]]