0
  /  	Eˆ{‹„„-i[D<†ªoZƒ›Ù«Ç505_‘I|¥‰ÓMdœv ©ƒ†ü+=ÅÄ ù   	E‹      Å”QoÚ0€ßû+<?ì�\(›¨ã©#HC£€(Ó4MÓdl“XMìÈ1eí¯ŸÓ€Ê&Ø¨4iO±“/w÷].&¯ÒÙpùe>B–74ÿô~2"ÜøÜ¤Ë´}ÐÂ`4ÅçÎU€ívl»�±,�»²èAí¬â.N`zAš{ô‘\2á¯ˆ8å
IÇZÈÈ¬˜�«•�ñ~±¿†1<²²dêJrà9ÓZ5°ª*gNý�³U!	´!}Øe!+#šäÑ¿Mäã=)4»få—–—£{V¨L'Ø™
S¢ÊÕ–'7º†UÁô]�©5F¬p	þ:Î¾y\Þ¼M	C¹•ë¿&Ó«Y’b:e¥ÏÇŽ37ž¹ÆtÂj‡J#ÔZIq¾má[õx:`Ú2©¬¹UUcüŒ‚W<Tå¦¨+æ]/½An©ëã¿4c~½M—éxÑ¶D4!ž«{ñgÃtÎ¬Ô¥ÊJîŒ}Ø¹´�_ëU]]í·hW©UYî0E¨ƒŽ’/ÐÛè;m¶úÐÐwï¨›çµ/±0ã+P~ÎŒ^«lcÛ©kÄ»ÂôLðPô7³8Œû�(ì„oQ¢¡S`}ü?-8f{®XÔ‰ß °?¸ìžë½?ˆ�9à°ûõ	<�0Úãí'ÔVl}A      	GˆÀ¿È473¾ÅÄ Ù   	G‹      ­“_oÓ0Åß÷).~à­¹mV&¶9F£©DE×V]BUNì&fI9.¡ûô8M«Ô&ñäÇÇçw­K_…óÑêËbV÷SX|z?�Œ€ô?_ŽÃUØ½þ q<#@RkËÄº®½úÒÓ&ÁÕS›gC¬¬Q±õ„„]Ðf�] M%nj•Í$›Bþ½Ô[[)!ýãä8ö}|âyÎV¥Œ1×Bfò­Pv�é„bkä¬ñàM#-vÍ“ƒÿaï\öqy´¥™Fm
?x¦’" V—„Q•'P™8 ¨b]Te¼xôµ!À3�¯“Ñü›Ó¡M›ÛŒrH�ÜäÝ(˜ÝÎƒ�°Ï%E~^sï4w„MyeÁ…T%E§ø¡?¨§nÃ°Õ„²Š�*­ÒÅ³â)j¬³ªäŽõ�#HÍ©ª•ˆ¿UƒÇ¿cq·ÏVádÙ–D4Ïé^øY„-¸‘……P[mv’ÖöuUåíq	‡œF%©% g•/€Û�…®‹S>W»³d:úî®í®”ëŒG.ýº!ñLDX÷Ù)Îùý¾Õë_÷ü+è_ß† Â�÷öc7è?þ5º€â¾Å(¶]ýM.ËŸ8    6  	Iˆl–Ü4ý( ©”u( 	•íÀà™S�ÿ�þC#Ì¬Ü¢#á�a	HçÊƒu¶ÛÉîÆÅ ƒ   	I# Copyright (C) 2007, 2009-2012 Canonical Ltd.
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

# Original author: David Allouche

from . import (
    errors,
    lock,
    merge,
    revision
    )
from .branch import Branch
from .i18n import gettext
from .trace import note


def _run_post_switch_hooks(control_dir, to_branch, force, revision_id):
    from .branch import SwitchHookParams
    hooks = Branch.hooks['post_switch']
    if not hooks:
        return
    params = SwitchHookParams(control_dir, to_branch, force, revision_id)
    for hook in hooks:
        hook(params)


def switch(control_dir, to_branch, force=False, quiet=False, revision_id=None,
           store_uncommitted=False, possible_transports=None):
    """Switch the branch associated with a checkout.

    :param control_dir: ControlDir of the checkout to change
    :param to_branch: branch that the checkout is to reference
    :param force: skip the check for local commits in a heavy checkout
    :param revision_id: revision ID to switch to.
    :param store_uncommitted: If True, store uncommitted changes in the
        branch.
    """
    try:
        tree = control_dir.open_workingtree()
    except errors.NotBranchError as ex:
        # Lightweight checkout and branch is no longer there
        if not force or store_uncommitted:
            raise ex
        else:
            tree = None
    else:
        if store_uncommitted or tree.branch.get_bound_location():
            tree.lock_write()
        else:
            tree.lock_tree_write()
    try:
        if tree is not None:
            parent_ids = tree.get_parent_ids()
            if len(parent_ids) > 1:
                raise errors.CommandError(
                    gettext('Pending merges must be '
                            'committed or reverted before using switch.'))

        if store_uncommitted:
            tree.store_uncommitted()
        if tree is None:
            source_repository = to_branch.repository
            base_revision_id = None
        else:
            source_repository = tree.branch.repository
            # Attempt to retrieve the base_revision_id now, since some
            # working tree formats (i.e. git) don't have their own
            # last_revision but just use that of the currently active branc