/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/rewrite/commands.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-23 01:17:33 UTC
  • mfrom: (7516.1.1 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200623011733-ohfy5ukvyehd2kpf
Merge lp:brz/3.1.

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    display_command,
22
22
    )
23
23
from ...errors import (
24
 
    BzrCommandError,
 
24
    CommandError,
25
25
    ConflictsInTree,
26
26
    NoSuchFile,
27
27
    NoWorkingTree,
45
45
        # Start executing plan from current Branch.last_revision()
46
46
        rebase(wt.branch.repository, replace_map, replayer)
47
47
    except ConflictsInTree:
48
 
        raise BzrCommandError(gettext(
 
48
        raise CommandError(gettext(
49
49
            "A conflict occurred replaying a commit."
50
50
            " Resolve the conflict and run 'brz rebase-continue' or "
51
51
            "run 'brz rebase-abort'."))
126
126
            rebase_todo,
127
127
            )
128
128
        if revision is not None and pending_merges:
129
 
            raise BzrCommandError(gettext(
 
129
            raise CommandError(gettext(
130
130
                "--revision and --pending-merges are mutually exclusive"))
131
131
 
132
132
        wt = WorkingTree.open_containing(directory)[0]
139
139
                else:
140
140
                    upstream_location = wt.branch.get_parent()
141
141
                    if upstream_location is None:
142
 
                        raise BzrCommandError(gettext("No upstream branch specified."))
 
142
                        raise CommandError(gettext("No upstream branch specified."))
143
143
                    note(gettext("Rebasing on %s"), upstream_location)
144
144
            upstream = Branch.open_containing(upstream_location)[0]
145
145
            upstream_repository = upstream.repository
146
146
            upstream_revision = upstream.last_revision()
147
147
            # Abort if there already is a plan file
148
148
            if state.has_plan():
149
 
                raise BzrCommandError(gettext(
 
149
                raise CommandError(gettext(
150
150
                    "A rebase operation was interrupted. "
151
151
                    "Continue using 'brz rebase-continue' or abort using 'brz "
152
152
                    "rebase-abort'"))
163
163
                    if revision[1] is not None:
164
164
                        stop_revid = revision[1].as_revision_id(wt.branch)
165
165
                else:
166
 
                    raise BzrCommandError(gettext(
 
166
                    raise CommandError(gettext(
167
167
                        "--revision takes only one or two arguments"))
168
168
 
169
169
            if pending_merges:
170
170
                wt_parents = wt.get_parent_ids()
171
171
                if len(wt_parents) in (0, 1):
172
 
                    raise BzrCommandError(gettext("No pending merges present."))
 
172
                    raise CommandError(gettext("No pending merges present."))
173
173
                elif len(wt_parents) > 2:
174
 
                    raise BzrCommandError(gettext(
 
174
                    raise CommandError(gettext(
175
175
                        "Rebasing more than one pending merge not supported"))
176
176
                stop_revid = wt_parents[1]
177
177
                assert stop_revid is not None, "stop revid invalid"
259
259
            try:
260
260
                last_rev_info = state.read_plan()[0]
261
261
            except NoSuchFile:
262
 
                raise BzrCommandError("No rebase to abort")
 
262
                raise CommandError("No rebase to abort")
263
263
            complete_revert(wt, [last_rev_info[1]])
264
264
            state.remove_plan()
265
265
        finally:
289
289
            replayer = WorkingTreeRevisionRewriter(wt, state, merge_type=merge_type)
290
290
            # Abort if there are any conflicts
291
291
            if len(wt.conflicts()) != 0:
292
 
                raise BzrCommandError(gettext(
 
292
                raise CommandError(gettext(
293
293
                    "There are still conflicts present. "
294
294
                    "Resolve the conflicts and then run "
295
295
                    "'brz resolve' and try again."))
297
297
            try:
298
298
                replace_map = state.read_plan()[1]
299
299
            except NoSuchFile:
300
 
                raise BzrCommandError(gettext("No rebase to continue"))
 
300
                raise CommandError(gettext("No rebase to continue"))
301
301
            oldrevid = state.read_active_revid()
302
302
            if oldrevid is not None:
303
303
                oldrev = wt.branch.repository.get_revision(oldrevid)
332
332
            try:
333
333
                replace_map = state.read_plan()[1]
334
334
            except NoSuchFile:
335
 
                raise BzrCommandError(gettext("No rebase in progress"))
 
335
                raise CommandError(gettext("No rebase in progress"))
336
336
            currentrevid = state.read_active_revid()
337
337
            if currentrevid is not None:
338
338
                note(gettext("Currently replaying: %s") % currentrevid)
380
380
                for revno in range(from_revno, to_revno + 1):
381
381
                    todo.append(from_branch.get_rev_id(revno))
382
382
            else:
383
 
                raise BzrCommandError(gettext(
 
383
                raise CommandError(gettext(
384
384
                    "--revision takes only one or two arguments"))
385
385
        else:
386
 
            raise BzrCommandError(gettext("--revision is mandatory"))
 
386
            raise CommandError(gettext("--revision is mandatory"))
387
387
 
388
388
        wt = WorkingTree.open(directory)
389
389
        wt.lock_write()
473
473
        stored_loc = branch_to.get_parent()
474
474
        if new_base is None:
475
475
            if stored_loc is None:
476
 
                raise BzrCommandError(gettext(
 
476
                raise CommandError(gettext(
477
477
                    "No pull location known or specified."))
478
478
            else:
479
479
                display_url = urlutils.unescape_for_display(