input:b0011v0002p0013e0006-e0,1,2,k110,111,r0,1,8,amlsfw
  .   ˆ{‹„„-i[D<†ªoZƒ›Ù«Â‚h@_‘I|¥‰ÓMdœv ©ƒ†ü+=ÂÁ ¤    ‹      ­“QoÛ Çßû)n<ì­¾Um÷°b¦ÎŽÔHi¥ž¦iÚb£ÚÆ‚K²ôÓÇ™ÚI­¦ª{Ž÷¿ÿü]¾ÈŠïË	Ü·3X~ý2›fÀN¿�gˆy‘�É‡3ÄÉœ«‰úOˆ»Ý.Ù�'ÎWX¬°¦¶¹À@Þ*J4i&Nø'Àk#u�“¥Æˆi§Í/pk@·¡`µ‰çöËÆ©{lœë?bØ”1D¦Å KÔfk•AííÖxl�Þ4;G&pSF<ªðÒéý ~ö…b¾ƒYô†©œjØÊÆV]ÊÈõLpÛV¼JZåºALv÷Ie×dC)û1Í?#‡T§—P{³NÙç,�_-Òœ‰¹lGù<s™k&f2ÄíÚý"|7Âwöáå„ùÈä&(o{²®{D1Z|jU¹&ô2z½Œjÿ”ý¯nHõW3–×«É¼È§«±%zHñXÝ›®�‰¥ô¦#È­7Šœß}�"ï»2ôW–p¬ÚÛª&& NáYò5ÁãSáxx‘ÇïðêvNƒq       ˆÀ¿Ã609¾ÂÁ a    ‹      Õ–ßoÚ0ÇßûWx~ØÚn4xêÒÐ( Ê4MÓT™Ø«‰Ù†Œþõsm³	46j¢;'ßœïcŸøo‚agòmÔEŸ&7}4úò±ßë \øÚè “ øÐ¬Ö<€î #Y›¶ ²,«f�ªÒs˜Œ!²IÜcµm•Y†É™Ÿ¿#gÈ�8eÎ"ß
sÒ“ŒÿDj†@-¬Œ»ÿV_Š�›Ü·<�0]ä�L‹%×¹_©¯AÂ¥Wž×ð¡ˆèú€M'þT±UÞ·wÐ~\¸5 �®»Ë]M|¡%�Å\¶±U)&¾HæÈè°�A„J˜ÆTÞWçb†�mïu†?œl”ÿM|Š"Ígmü¡Ó\Û&špèvÍ�Ó\cÒ§Æ¢D11œíßâ[ñ°;`PhnB-R+”|–‚C,£†*6)u¬çŽ ÒeU!aþ6£ëqw0	zãbHXâ9»ÿ�5LFTsiQ 4­›ÁRÿ­œšôê±‰6	k1�,&UÐVå?PÎTÌ¸.sî"|Ì·°å,ÿH«^«_T<¯â½GÞe«v�Ðó_È{©2YpE°@ÉXHŽIa÷ ¨7‘×l�7w¸mæó	ÒheîŠÒÂ¤Ôx­("ßò6$kÿ¢º<*Èþ‹"U™[ÏŽam1'^Ú�ËüœÀäÉÝ£ñbêÉXjÂÚì�~ýÝ©"³˜nN
‡ðä¿Â-vÁ—î,Ã¤°‡ 8qå�ØÝƒ’Ü`Rj‹Ýóê›K�ë«£Åµõ
—õs    F   ˆl–Ðz¾”j_)% õÀ;q§”Å£’þB8Öl²„,�7  ´ÞÍ_óÅÁÀÄ‚Á_‹I|¥Žƒî4ÃVŸÄÃ     ‹      e�ÁNÃ0DÏñW,‚Êé!1í�C£@Bˆ3ý€¦é&µ”Øa½¦A¨ÿŽ�’ªGÏ<ÏÎ®ôÁ1éše!ÄWEð†ün‚bœ®¡ÂO¯	SÙ"gz6äò�~øˆJÀÛ©\\ôE'nû=à+‘¥ÿèÕZ\c£t;<ÏU”&_)82n£Ôúi�cÝW±’©X[Su¹¥V­Vù£ºwXgÆ÷Ì8¸l¯Û glÝTPˆÞ|‡9Žƒ%vahãMƒàE·¡æÖ^VIÇ%üˆD7�Æ*ñyW– /”œÌ„�dO`ðt³p*Ÿ�Cš"›JwxØÀnÜAïÃ¡‚9¢ÉYˆ„�=™ù´aP!Î…øìöo«        	ˆÇ‘äÇò 8à@ãÌ�ÒºË¿ÏÆƒh¹ÅÄÃ      	128
  A   ˆl–Ü4ý( ©”u( 	•íÀà™S�ÿ�þB6H³rˆ�†A„% ?ŸÇƒqÐ¹Æ_ŠI|¥�+Wé3ž¯ÆÅ <    # vim: expandtab

# Copyright (C) 2011-2018 Jelmer Vernooij <jelmer@jelmer.uk>

# 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


"""Remote helper for git for accessing bzr repositories."""

CAPABILITIES = ["fetch", "option", "push"]

import os

from ..controldir import ControlDir
from ..errors import NotBranchError, NoRepositoryPresent
from ..repository import InterRepository
from ..transport import get_transport_from_path

from . import (
    LocalGitProber,
    )
from .dir import (
    BareLocalGitControlDirFormat,
    LocalGitControlDirFormat,
    )

from .object_store import (
    get_object_store,
    )
from .refs import (
    get_refs_container,
    ref_to_branch_name,
    )
from .repository import (
    GitRepository,
    )

from ..plugins.fastimport import exporter as fastexporter

try:
    import fastimport  # noqa: F401
except ModuleNotFoundError:
    pass
else:
    CAPABILITIES.append("import")
    CAPABILITIES.append("refspec *:*")


def open_remote_dir(url):
    try:
        return ControlDir.open(url)
    except NotBranchError:
        return ControlDir.create(url)


def fetch(outf, wants, shortname, remote_dir, local_dir):
    remote_repo = remote_dir.find_repository()
    local_repo = local_dir.find_repository()
    inter = InterRepository.get(remote_repo, local_repo)
    revs = []
    for (sha1, ref) in wants:
        revs.append((sha1, None))
    if (isinstance(remote_repo, GitRepository) and
            isinstance(local_repo, GitRepository)):
        lossy = False
    else:
        lossy = True
    inter.fetch_revs(revs, lossy=lossy)
    outf.write(b"\n")


def push(outf, wants, shortname, remote_dir, local_dir):
    for (src_ref, dest_ref) in wants:
        local_branch = local_dir.open_branch(ref=src_re