~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2007-03-01 06:03:07 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-20070301060307-a6se6653vx5fi65s
Add merge-directive command

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import errno
25
25
import sys
26
26
import tempfile
 
27
import time
27
28
 
28
29
import bzrlib
29
30
from bzrlib import (
36
37
    ignores,
37
38
    log,
38
39
    merge as _mod_merge,
 
40
    merge_directive,
39
41
    osutils,
40
42
    repository,
41
43
    symbol_versioning,
3164
3166
        server.serve()
3165
3167
 
3166
3168
 
 
3169
class cmd_merge_directive(Command):
 
3170
    """Generate a merge directive auto-merge tools."""
 
3171
 
 
3172
    def run(self):
 
3173
        branch = Branch.open('.')
 
3174
        submit_branch = branch.get_submit_branch()
 
3175
        public_branch = branch.get_config().get_user_option('public_branch')
 
3176
        if public_branch is not None:
 
3177
            public_branch = Branch.open(public_branch)
 
3178
        if submit_branch is None:
 
3179
            submit_branch = branch.get_parent()
 
3180
        directive = merge_directive.MergeDirective.from_objects(
 
3181
            branch.repository, branch.last_revision(), time.time(),
 
3182
            osutils.local_time_offset(), submit_branch,
 
3183
            public_branch=public_branch)
 
3184
        self.outf.writelines(directive.to_lines())
 
3185
 
3167
3186
# command-line interpretation helper for merge-related commands
3168
3187
def _merge_helper(other_revision, base_revision,
3169
3188
                  check_clean=True, ignore_zero=False,