~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Jelmer Vernooij
  • Date: 2010-03-12 19:59:50 UTC
  • mto: This revision was merged to the branch mainline in revision 5089.
  • Revision ID: jelmer@samba.org-20100312195950-wwufs49rlkf0s471
``bzrlib.merge_directive._BaseMergeDirective`` has been renamed to 
``bzrlib.merge_directive.BaseMergeDirective`` and is now public.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
            " provided to the next.", (1, 15, 0), False))
65
65
 
66
66
 
67
 
class _BaseMergeDirective(object):
 
67
class BaseMergeDirective(object):
68
68
 
69
69
    hooks = MergeDirectiveHooks()
70
70
 
92
92
        self.source_branch = source_branch
93
93
        self.message = message
94
94
 
 
95
    def to_lines(self):
 
96
        """Serialize as a list of lines
 
97
 
 
98
        :return: a list of lines
 
99
        """
 
100
        raise NotImplementedError(self.to_lines)
 
101
 
 
102
    def get_raw_bundle(self):
 
103
        """Return the bundle for this merge directive.
 
104
 
 
105
        :return: bundle text or None if there is no bundle
 
106
        """
 
107
        return None
 
108
 
95
109
    def _to_lines(self, base_revision=False):
96
110
        """Serialize as a list of lines
97
111
 
303
317
                                          basename, body)
304
318
 
305
319
 
306
 
class MergeDirective(_BaseMergeDirective):
 
320
class MergeDirective(BaseMergeDirective):
307
321
 
308
322
    """A request to perform a merge into a branch.
309
323
 
338
352
        :param source_branch: A public location to merge the revision from
339
353
        :param message: The message to use when committing this merge
340
354
        """
341
 
        _BaseMergeDirective.__init__(self, revision_id, testament_sha1, time,
 
355
        BaseMergeDirective.__init__(self, revision_id, testament_sha1, time,
342
356
            timezone, target_branch, patch, source_branch, message)
343
357
        if patch_type not in (None, 'diff', 'bundle'):
344
358
            raise ValueError(patch_type)
428
442
        return None, self.revision_id, 'inapplicable'
429
443
 
430
444
 
431
 
class MergeDirective2(_BaseMergeDirective):
 
445
class MergeDirective2(BaseMergeDirective):
432
446
 
433
447
    _format_string = 'Bazaar merge directive format 2 (Bazaar 0.90)'
434
448
 
437
451
                 bundle=None, base_revision_id=None):
438
452
        if source_branch is None and bundle is None:
439
453
            raise errors.NoMergeSource()
440
 
        _BaseMergeDirective.__init__(self, revision_id, testament_sha1, time,
 
454
        BaseMergeDirective.__init__(self, revision_id, testament_sha1, time,
441
455
            timezone, target_branch, patch, source_branch, message)
442
456
        self.bundle = bundle
443
457
        self.base_revision_id = base_revision_id