/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/propose/cmds.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-19 22:18:01 UTC
  • mfrom: (7515.1.1 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200619221801-6chb6w22ctckkajl
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/386125

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    return urlutils.basename(branch.user_url)
47
47
 
48
48
 
 
49
def _check_already_merged(branch, target):
 
50
    # TODO(jelmer): Check entire ancestry rather than just last revision?
 
51
    if branch.last_revision() == target.last_revision():
 
52
        raise errors.BzrCommandError(gettext(
 
53
            'All local changes are already present in target.'))
 
54
 
 
55
 
49
56
class cmd_publish_derived(Command):
50
57
    __doc__ = """Publish a derived branch.
51
58
 
79
86
            submit_branch = local_branch.get_parent()
80
87
            note(gettext('Using parent branch %s') % submit_branch)
81
88
        submit_branch = _mod_branch.Branch.open(submit_branch)
 
89
        _check_already_merged(local_branch, submit_branch)
82
90
        if name is None:
83
91
            name = branch_name(local_branch)
84
92
        hoster = _mod_propose.get_hoster(submit_branch)
151
159
               help='Allow fallback to lossy push, if necessary.'),
152
160
        Option('allow-collaboration',
153
161
               help='Allow collaboration from target branch maintainer(s)'),
 
162
        Option('allow-empty',
 
163
               help='Do not prevent empty merge proposals.'),
154
164
        ]
155
165
    takes_args = ['submit_branch?']
156
166
 
159
169
    def run(self, submit_branch=None, directory='.', hoster=None,
160
170
            reviewers=None, name=None, no_allow_lossy=False, description=None,
161
171
            labels=None, prerequisite=None, commit_message=None, wip=False,
162
 
            allow_collaboration=False):
 
172
            allow_collaboration=False, allow_empty=False):
163
173
        tree, branch, relpath = (
164
174
            controldir.ControlDir.open_containing_tree_or_branch(directory))
165
175
        if submit_branch is None:
169
179
        if submit_branch is None:
170
180
            raise errors.BzrCommandError(
171
181
                gettext("No target location specified or remembered"))
172
 
        else:
173
 
            target = _mod_branch.Branch.open(submit_branch)
 
182
        target = _mod_branch.Branch.open(submit_branch)
 
183
        if not allow_empty:
 
184
            _check_already_merged(branch, target)
174
185
        if hoster is None:
175
186
            hoster = _mod_propose.get_hoster(target)
176
187
        else: