~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Martin Pool
  • Date: 2007-04-04 01:22:11 UTC
  • mfrom: (2393.1.1 bzr.docs)
  • mto: This revision was merged to the branch mainline in revision 2397.
  • Revision ID: mbp@sourcefrog.net-20070404012211-sq269me6bai9m6xk
merge trunk and doc fix from elliot

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    testament,
29
29
    timestamp,
30
30
    )
31
 
from bzrlib.bundle import serializer as bundle_serializer
 
31
from bzrlib.bundle import (
 
32
    serializer as bundle_serializer,
 
33
    )
32
34
 
33
35
 
34
36
class MergeDirective(object):
250
252
        bundle_serializer.write_bundle(repository, revision_id,
251
253
                                       ancestor_id, s)
252
254
        return s.getvalue()
 
255
 
 
256
    def install_revisions(self, target_repo):
 
257
        """Install revisions and return the target revision"""
 
258
        if not target_repo.has_revision(self.revision_id):
 
259
            if self.patch_type == 'bundle':
 
260
                info = bundle_serializer.read_bundle(StringIO(self.patch))
 
261
                # We don't use the bundle's target revision, because
 
262
                # MergeDirective.revision_id is authoritative.
 
263
                info.install_revisions(target_repo)
 
264
            else:
 
265
                source_branch = _mod_branch.Branch.open(self.source_branch)
 
266
                target_repo.fetch(source_branch.repository, self.revision_id)
 
267
        return self.revision_id