~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2007-03-02 04:31:47 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-20070302043147-ig72y3cqimym5mv4
add revision selection to mergedirective

Show diffs side-by-side

added added

removed removed

Lines of Context:
3181
3181
    takes_options = [RegistryOption('patch-type',
3182
3182
        'The type of patch to include in the directive',
3183
3183
        _directive_patch_type, value_switches=True),
3184
 
        Option('sign', help='GPG-sign the directive')]
 
3184
        Option('sign', help='GPG-sign the directive'), 'revision']
3185
3185
 
3186
3186
    def run(self, submit_branch=None, public_branch=None, patch_type='bundle',
3187
 
            sign=False):
 
3187
            sign=False, revision=None):
3188
3188
        branch = Branch.open('.')
3189
3189
        config_submit_branch = branch.get_submit_branch()
3190
3190
        if submit_branch is None:
3206
3206
            public_branch = Branch.open(public_branch)
3207
3207
        if patch_type != "bundle" and public_branch is None:
3208
3208
            raise errors.BzrCommandError('No public branch specified or known')
 
3209
        if revision is not None:
 
3210
            if len(revision) != 1:
 
3211
                raise errors.BzrCommandError('bzr merge-directive takes '
 
3212
                                             'exactly one revision identifier')
 
3213
            else:
 
3214
                revision_id = revision[0].in_history(branch).rev_id
 
3215
        else:
 
3216
            revision_id = branch.last_revision()
3209
3217
        directive = merge_directive.MergeDirective.from_objects(
3210
 
            branch.repository, branch.last_revision(), time.time(),
 
3218
            branch.repository, revision_id, time.time(),
3211
3219
            osutils.local_time_offset(), submit_branch,
3212
3220
            public_branch=public_branch, patch_type=patch_type)
3213
3221
        if sign: