~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/serializer/v07.py

  • Committer: Robert Collins
  • Date: 2006-06-11 11:44:47 UTC
  • mfrom: (1762 +trunk)
  • mto: (1767.2.2 integration)
  • mto: This revision was merged to the branch mainline in revision 1769.
  • Revision ID: robertc@robertcollins.net-20060611114447-ba56b7e27a72c941
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
                base_tree = last_rev_tree
178
178
            else:
179
179
                base_tree = self.source.revision_tree(base_id)
180
 
            force_binary = (i != 0)
 
180
 
181
181
            self._write_revision(rev, rev_tree, base_id, base_tree, 
182
 
                                 explicit_base, force_binary)
 
182
                                 explicit_base)
183
183
 
184
184
            last_rev_id = base_id
185
185
            last_rev_tree = base_tree
186
186
 
187
187
    def _write_revision(self, rev, rev_tree, base_rev, base_tree, 
188
 
                        explicit_base, force_binary):
 
188
                        explicit_base):
189
189
        """Write out the information for a revision."""
190
190
        def w(key, value):
191
191
            self._write(key, value, indent=1)
195
195
        w('date', format_highres_date(rev.timestamp, rev.timezone))
196
196
        self.to_file.write('\n')
197
197
 
198
 
        self._write_delta(rev_tree, base_tree, rev.revision_id, force_binary)
 
198
        self._write_delta(rev_tree, base_tree, rev.revision_id)
199
199
 
200
200
        w('revision id', rev.revision_id)
201
201
        w('sha1', StrictTestament.from_revision(self.source, 
222
222
        self.to_file.write(' // '.join(p_texts).encode('utf-8'))
223
223
        self.to_file.write('\n')
224
224
 
225
 
    def _write_delta(self, new_tree, old_tree, default_revision_id, 
226
 
                     force_binary):
 
225
    def _write_delta(self, new_tree, old_tree, default_revision_id):
227
226
        """Write out the changes between the trees."""
228
227
        DEVNULL = '/dev/null'
229
228
        old_label = ''
230
229
        new_label = ''
231
230
 
232
 
        def do_diff(file_id, old_path, new_path, action, force_binary):
 
231
        def do_diff(file_id, old_path, new_path, action):
233
232
            def tree_lines(tree, require_text=False):
234
233
                if file_id in tree:
235
234
                    tree_file = tree.get_file(file_id)
240
239
                    return []
241
240
 
242
241
            try:
243
 
                if force_binary:
244
 
                    raise errors.BinaryFile()
245
242
                old_lines = tree_lines(old_tree, require_text=True)
246
243
                new_lines = tree_lines(new_tree, require_text=True)
247
244
                action.write(self.to_file)
265
262
            if text_modified and kind == "symlink":
266
263
                action.add_property('target', entry.symlink_target)
267
264
            if text_modified and kind == "file":
268
 
                do_diff(file_id, old_path, new_path, action, force_binary)
 
265
                do_diff(file_id, old_path, new_path, action)
269
266
            else:
270
267
                action.write(self.to_file)
271
268