DMA32
     ˆÂÁÆ524À¿Ã     ‹      Õ•QoÚ0Çßû)<?ì.�ŽªÔñÔ¤¡Q@”iš¦irbC¬&6²Œ}ú9$V•­Ó6­{òùò÷Ýý.‰�<‹Ç½ÙûI½žÝÑäí«á ‡pà]»ÏâêÁy3ú#ŒpæÜ²°Ùlš›vS›Ì¦�¹"?ëŒL]“;Žé)}ô‘L0îWDœt¹ ÅÅg¤çôÊYÉ…?·µÀÅZ¦Â–¶¢Ðf[/íPš‹ Þ^¶Á®’JH Šêó@�ˆ$šoËüáÏåCî@X²KYš†—¡5ËåBEØé%¦DdMa�©V’œ©»æBÎ1b¹‹ð‡AoüÑëÀeåiJÊŒ˜Gøe/]�£Ó+ö°æÆk®12ëP¡¹œKÁOŠo+ñ­ür:`\ibaS#—Nju�‚G<FMun—Ì³¾ð™9VUþ³n°ô»fL®§ýÑ,L«–ð2Ä¡ºßys˜N˜Ê¡X‘:ï¬±ªÏUb—Wû-ª‹6r‘9Lj •¿@:×9æ˜õåžÓ½u\é½ÒZA«ÓÃFx‰Â‹nÐAèi0¹fÇP[O…a¥î”Þ¨cÿAÿâ[ùPF'âÍÁõ¬Vˆ‚N·œÄòê›€uéÅY‰µÿ­1­Ö¿ðÈëêÁ@`7‚T#ð+?Zze    B   ˆl–Ü4ý( ©”u( 	•íÀà™S�ÿ�þ[qÑ¬Ü¢#á�a	HçÈ„‚ËßÇ_ŠI|¥�+Wé3ž¯ÁÅ ?÷     # Copyright (C) 2006-2007 by Jelmer Vernooij
#
# 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

"""Rebase."""

import os

from ... import (
    config as _mod_config,
    osutils,
    )
from ...errors import (
    BzrError,
    UnknownFormatError,
    NoCommonAncestor,
    UnrelatedBranches,
    )
from ...bzr.generate_ids import gen_revision_id
from ...bzr.inventorytree import InventoryTreeChange
from ...graph import FrozenHeadsCache
from ...merge import Merger
from ...revision import NULL_REVISION
from ...trace import mutter
from ...transport import NoSuchFile
from ...tsort import topo_sort
from ... import ui

from .maptree import (
    MapTree,
    map_file_ids,
    )

REBASE_PLAN_FILENAME = 'rebase-plan'
REBASE_CURRENT_REVID_FILENAME = 'rebase-current'
REBASE_PLAN_VERSION = 1
REVPROP_REBASE_OF = 'rebase-of'

class RebaseState:

    def has_plan(self):
        """Check whether there is a rebase plan present.

        :return: boolean
        """
        raise NotImplementedError(self.has_plan)

    def read_plan(self):
        """Read a rebase plan file.

        :return: Tuple with last revision info and replace map.
        """
        raise NotImplementedError(self.read_plan)

    def write_plan(self, replace_map):
        """Write a rebase plan file.

        :param replace_map: Replace map (old revid -> (new revid, new parents))
        """
        raise NotImplementedError(self.write_plan)

    def remove_plan(self):
        """Remove a rebase plan file.
        """
        raise NotImplementedError(self.remove_plan)

    def write_active_revid(self, revid):
        """Write the id of the revision that is currently being rebased.

        :param revid: Revision id to write
        """
        raise NotImplementedError(self.write_active_revid)

    def read_active_revid(self):
        """Read the id of the revision that is currently being rebased.

        :return: Id of the revision that is being rebased.
        """
        raise NotImplementedError(self.read_active_revid)


class RebaseState1(RebaseState):

    def __init__(self, wt):
        self.wt = wt
        self.transport = wt._transport

    def has_plan(self):
        """See `RebaseState`."""
        try:
            return self.transport.get_bytes(REBASE_PLAN_FILENAME) != b''
        except NoSuchFile:
            return False

    def read_plan(self):
        """See `RebaseState`."""
        text = self.transport.get_bytes(REBASE_PLAN_FILENAME)
        if text == b'':
            raise NoSuchFile(REBASE_PLAN_FILENAME)
        return unmarshall_rebase_plan(text)

    def write_plan(self, replace_map):
        """See `RebaseState`."""
        self.wt.update_feature_flags({b"rebase-v1": b"write-required"})
        content = marshall_rebase_plan(
            self.wt.branch.last_revis