/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.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:
201
201
        if not _internal:
202
202
            raise errors.BzrError("Please use bzrdir.open_workingtree or "
203
203
                "WorkingTree.open() to obtain a WorkingTree.")
204
 
        assert isinstance(basedir, basestring), \
205
 
            "base directory %r is not a string" % basedir
206
204
        basedir = safe_unicode(basedir)
207
205
        mutter("opening working tree %r", basedir)
208
206
        if deprecated_passed(branch):
216
214
            self._control_files = self.branch.control_files
217
215
        else:
218
216
            # assume all other formats have their own control files.
219
 
            assert isinstance(_control_files, LockableFiles), \
220
 
                    "_control_files must be a LockableFiles, not %r" \
221
 
                    % _control_files
222
217
            self._control_files = _control_files
223
218
        # update the whole cache up front and write to disk if anything changed;
224
219
        # in the future we might want to do this more selectively
297
292
            False then the inventory is the same as that on disk and any
298
293
            serialisation would be unneeded overhead.
299
294
        """
300
 
        assert inv.root is not None
301
295
        self._inventory = inv
302
296
        self._inventory_is_modified = dirty
303
297
 
612
606
        # function - they should be part of lock_write and unlock.
613
607
        inv = self.inventory
614
608
        for f, file_id, kind in zip(files, ids, kinds):
615
 
            assert kind is not None
616
609
            if file_id is None:
617
610
                inv.add_path(f, kind=kind)
618
611
            else:
1204
1197
                                       DeprecationWarning)
1205
1198
 
1206
1199
        # check destination directory
1207
 
        assert not isinstance(from_paths, basestring)
 
1200
        if isinstance(from_paths, basestring):
 
1201
            raise ValueError()
1208
1202
        inv = self.inventory
1209
1203
        to_abs = self.abspath(to_dir)
1210
1204
        if not isdir(to_abs):
1749
1743
 
1750
1744
    def _write_basis_inventory(self, xml):
1751
1745
        """Write the basis inventory XML to the basis-inventory file"""
1752
 
        assert isinstance(xml, str), 'serialised xml must be bytestring.'
1753
1746
        path = self._basis_inventory_name()
1754
1747
        sio = StringIO(xml)
1755
1748
        self._control_files.put(path, sio)
1873
1866
                            # ... but not ignored
1874
1867
                            has_changed_files = True
1875
1868
                            break
1876
 
                    elif content_change and (kind[1] != None):
 
1869
                    elif content_change and (kind[1] is not None):
1877
1870
                        # Versioned and changed, but not deleted
1878
1871
                        has_changed_files = True
1879
1872
                        break
2648
2641
 
2649
2642
    @classmethod
2650
2643
    def unregister_format(klass, format):
2651
 
        assert klass._formats[format.get_format_string()] is format
2652
2644
        del klass._formats[format.get_format_string()]
2653
2645
 
2654
2646