~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2007-06-28 04:31:59 UTC
  • mto: (2520.5.2 bzr.mpbundle)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: aaron.bentley@utoronto.ca-20070628043159-nwi7dnmpvd6jn3ie
Start work on using merge base from directives

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
            else:
198
198
                source_branch = _mod_branch.Branch.open(self.source_branch)
199
199
                target_repo.fetch(source_branch.repository, self.revision_id)
200
 
        if self.patch is not None:
201
 
            self._verify_patch(target_repo)
202
200
        return self.revision_id
203
201
 
204
202
 
253
251
    def get_raw_bundle(self):
254
252
        return self.bundle
255
253
 
256
 
    def _verify_patch(self, repository):
257
 
        pass
258
 
 
259
254
    def _bundle(self):
260
255
        if self.patch_type == 'bundle':
261
256
            return self.patch
487
482
        # Strip trailing whitespace
488
483
        calculated_patch = re.sub(' *\n', '\n', calculated_patch)
489
484
        stored_patch = re.sub(' *\n', '\n', stored_patch)
490
 
        if calculated_patch != stored_patch:
 
485
        return (calculated_patch == stored_patch)
 
486
 
 
487
    def install_revisions_base(self, repository):
 
488
        self.install_revisions(repository)
 
489
        return self.base_revision_id, self.revision_id, 'verified'
 
490
 
 
491
    def install_revisions(self, repository):
 
492
        _BaseMergeDirective.install_revisions(self, repository)
 
493
        verified = self._maybe_verify(repository)
 
494
        if verified == 'failed':
491
495
            raise errors.PatchVerificationFailed()
492
496
 
 
497
    def _maybe_verify(self, repository):
 
498
        if self.patch is not None:
 
499
            if self._verify_patch(repository):
 
500
                return 'verified'
 
501
            else:
 
502
                return 'failed'
 
503
        else:
 
504
            return 'inapplicable'
 
505
 
 
506
    def install_revisions_base(self, repository):
 
507
        _BaseMergeDirective.install_revisions(self, repository)
 
508
        verified = self._maybe_verify(repository)
 
509
        return None, self.revision_id, verified
 
510
 
493
511
 
494
512
class MergeDirectiveFormatRegistry(registry.Registry):
495
513