~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2007-03-09 06:50:57 UTC
  • mto: (2323.6.9 0.15-integration)
  • mto: This revision was merged to the branch mainline in revision 2330.
  • Revision ID: aaron.bentley@utoronto.ca-20070309065057-6fhwzmcmq6gsnvph
Re-design patch handling to use a dict

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
            ancestor_id = _mod_revision.common_ancestor(revision_id,
202
202
                                                        submit_revision_id,
203
203
                                                        repository)
 
204
            type_handler = {'bundle': klass._generate_bundle,
 
205
                            'diff': klass._generate_diff,
 
206
                            None: lambda x, y, z: None }
 
207
            patch = type_handler[patch_type](repository, revision_id,
 
208
                                             ancestor_id)
204
209
            if patch_type == 'bundle':
205
210
                s = StringIO()
206
211
                bundle_serializer.write_bundle(repository, revision_id,
227
232
        s = StringIO()
228
233
        diff.show_diff_trees(tree_1, tree_2, s)
229
234
        return s.getvalue()
 
235
 
 
236
    @staticmethod
 
237
    def _generate_bundle(repository, revision_id, ancestor_id):
 
238
        s = StringIO()
 
239
        bundle_serializer.write_bundle(repository, revision_id,
 
240
                                       ancestor_id, s)
 
241
        return s.getvalue()