512
  B   ˆl–Ü4ý( ©”u( 	•íÀà™S�ÿ�þZ�ƒY¹DGÃ Â�ÏÂ„ï…¯Á_ŠI|¥�+Wé3ž¯ÁÀ ?÷     # Copyright (C) 2007 by Jelmer Vernooij <jelmer@samba.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

"""Bazaar command-line subcommands."""

from ...commands import (
    Command,
    display_command,
    )
from ...errors import (
    CommandError,
    ConflictsInTree,
    NoWorkingTree,
    UncommittedChanges,
    )
from ...option import (
    Option,
    )
from ...trace import (
    note,
    )
from ...transport import (
    NoSuchFile,
    )

from ...i18n import gettext


def finish_rebase(state, wt, replace_map, replayer):
    from .rebase import (
        rebase,
        )
    try:
        # Start executing plan from current Branch.last_revision()
        rebase(wt.branch.repository, replace_map, replayer)
    except ConflictsInTree:
        raise CommandError(gettext(
            "A conflict occurred replaying a commit."
            " Resolve the conflict and run 'brz rebase-continue' or "
            "run 'brz rebase-abort'."))
    # Remove plan file
    state.remove_plan()


class cmd_rebase(Command):
    """Re-base a branch.

    Rebasing is the process of taking a branch and modifying the history so
    that it appears to start from a different point. This can be useful
    to clean up the history before submitting your changes. The tree at the
    end of the process will be the same as if you had merged the other branch,
    but the history will be different.

    The command takes the location of another branch on to which the branch in
    the specified directory (by default, the current working directory)
    will be rebased. If a branch is not specified then the parent branch
    is used, and this is usually the desired result.

    The first step identifies the revisions that are in the current branch that
    are not in the parent branch. The current branch is then set to be at the
    same revision as the target branch, and each revision is replayed on top
    of the branch. At the end of the process it will appear as though your
    current branch was branched off the current last revision of the target.

    Each revision that is replayed may cause conflicts in the tree. If this
    happens the command will stop and allow you to fix them up. Resolve the
    commits as you would for a merge, and then run 'brz resolve' to marked
    them as resolved. Once you have resolved all the conflicts you should
    run 'brz rebase-continue' to continue the rebase operation.

    If conflicts are encountered and you decide that you do not wish to continue
    you can run 'brz rebase-abort'.

    The '--onto' option allows you to specify a different revision in the
    target branch to start at when replaying the revisions. This means that
    you can change the point at which the current branch will appear to be
    branched from when the operation completes.
    """
    takes_args = ['upstream_location?']
    takes_options = [
        'revision', 'merge-type', 'verbose',
        Option(
            'dry-run',
            help="Show what would be done, but don't actually do anything."),
        Option(
            'always-rebase-merges',
            help="Don't skip revisions that merge already present revisions."),
        Option(
            'pending-merges',
            help="Rebase pending merges onto local branch."),
        Option(
            'onto', help='Different revisi