~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branchbuilder.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-09-27 04:04:26 UTC
  • mfrom: (3744.1.2 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080927040426-dv3yctm2h2fd2bzf
(jam) Merge 1.7.1rc1 back into bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
            ('add', ('path', 'file-id', 'kind', 'content' or None))
130
130
            ('modify', ('file-id', 'new-content'))
131
131
            ('unversion', 'file-id')
132
 
            # not supported yet: ('rename', ('orig-path', 'new-path'))
 
132
            ('rename', ('orig-path', 'new-path'))
133
133
        :param message: An optional commit message, if not supplied, a default
134
134
            commit message will be written.
135
135
        :return: The revision_id of the new commit
157
157
            to_add_kinds = []
158
158
            new_contents = {}
159
159
            to_unversion_ids = []
160
 
            # TODO: MemoryTree doesn't support rename() or
161
 
            #       apply_inventory_delta, so we'll postpone allowing renames
162
 
            #       for now
163
 
            # to_rename = []
 
160
            to_rename = []
164
161
            for action, info in actions:
165
162
                if action == 'add':
166
163
                    path, file_id, kind, content = info
177
174
                    new_contents[file_id] = content
178
175
                elif action == 'unversion':
179
176
                    to_unversion_ids.append(info)
 
177
                elif action == 'rename':
 
178
                    from_relpath, to_relpath = info
 
179
                    to_rename.append((from_relpath, to_relpath))
180
180
                else:
181
181
                    raise ValueError('Unknown build action: "%s"' % (action,))
182
182
            if to_unversion_ids:
187
187
                    tree.add([path], [file_id], ['directory'])
188
188
                else:
189
189
                    tree.mkdir(path, file_id)
 
190
            for from_relpath, to_relpath in to_rename:
 
191
                tree.rename_one(from_relpath, to_relpath)
190
192
            tree.add(to_add_files, to_add_file_ids, to_add_kinds)
191
193
            for file_id, content in new_contents.iteritems():
192
194
                tree.put_file_bytes_non_atomic(file_id, content)