/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: Jelmer Vernooij
  • Date: 2020-06-21 02:15:25 UTC
  • mto: (7490.40.23 work)
  • mto: This revision was merged to the branch mainline in revision 7517.
  • Revision ID: jelmer@jelmer.uk-20200621021525-en904vhtu6t0qcv3
Rename BzrCommandError to CommandError.

Show diffs side-by-side

added added

removed removed

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