~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

Merge up bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
        TODO: Perhaps callback with the ids and paths as they're added.
97
97
        """
98
98
        if isinstance(files, basestring):
99
 
            assert(ids is None or isinstance(ids, basestring))
100
 
            assert(kinds is None or isinstance(kinds, basestring))
 
99
            # XXX: Passing a single string is inconsistent and should be
 
100
            # deprecated.
 
101
            if not (ids is None or isinstance(ids, basestring)):
 
102
                raise AssertionError()
 
103
            if not (kinds is None or isinstance(kinds, basestring)):
 
104
                raise AssertionError()
101
105
            files = [files]
102
106
            if ids is not None:
103
107
                ids = [ids]
109
113
        if ids is None:
110
114
            ids = [None] * len(files)
111
115
        else:
112
 
            assert(len(ids) == len(files))
 
116
            if not (len(ids) == len(files)):
 
117
                raise AssertionError()
113
118
        if kinds is None:
114
119
            kinds = [None] * len(files)
115
 
        else:
116
 
            assert(len(kinds) == len(files))
 
120
        elif not len(kinds) == len(files):
 
121
            raise AssertionError()
117
122
        for f in files:
118
123
            # generic constraint checks:
119
124
            if self.is_control_filename(f):
180
185
            revprops['branch-nick'] = self.branch.nick
181
186
        author = kwargs.pop('author', None)
182
187
        if author is not None:
183
 
            assert 'author' not in revprops
 
188
            if 'author' in revprops:
 
189
                # XXX: maybe we should just accept one of them?
 
190
                raise AssertionError('author property given twice')
184
191
            revprops['author'] = author
185
192
        # args for wt.commit start at message from the Commit.commit method,
186
193
        args = (message, ) + args
240
247
        """
241
248
        raise NotImplementedError(self.mkdir)
242
249
 
 
250
    @needs_write_lock
 
251
    def put_file_bytes_non_atomic(self, file_id, bytes):
 
252
        """Update the content of a file in the tree.
 
253
        
 
254
        Note that the file is written in-place rather than being
 
255
        written to a temporary location and renamed. As a consequence,
 
256
        readers can potentially see the file half-written.
 
257
 
 
258
        :param file_id: file-id of the file
 
259
        :param bytes: the new file contents
 
260
        """
 
261
        raise NotImplementedError(self.put_file_bytes_non_atomic)
 
262
 
243
263
    def set_parent_ids(self, revision_ids, allow_leftmost_as_ghost=False):
244
264
        """Set the parents ids of the working tree.
245
265
 
276
296
        # not in an inner loop; and we want to remove direct use of this,
277
297
        # so here as a reminder for now. RBC 20070703
278
298
        from bzrlib.inventory import InventoryEntry
279
 
        assert isinstance(recurse, bool)
280
299
        if action is None:
281
300
            action = add.AddAction()
282
301