-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/transport/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyc


	_Oc@@s9dZddlmZddlmZddlZddlmZeedddl	m
Z
ddlmZdd	l
mZmZiZd
ZdZdZd
ZdejfdYZeaeeedZdZdZdZdZdZde fdYZ!de fdYZ"de fdYZ#de#fdYZ$de#fdYZ%d ej&fd!YZ'd"e fd#YZ(d$e fd%YZ)d&e(fd'YZ*d(Z+ed)Z,ed*Z-ed+Z.d,Z/d-Z0d.e fd/YZ1ed0d1d2ed0d3d4ed5d1d6d7e2ed5d8d9ed:d7e2ed:d;d<ed=d7e2ed=d;d<ed>d7e2ed>d?d@edAd7e2edAd?d@edBd1dCedDd1dEedBd?d@edBd;d<edDd?d@edDd;d<edFd1dGedFdHdIedJd1dKedJdHdIedLd1dMedLdNdOedPd7e2edQd7e2edRd7e2edSd7e2edPdTdUedQdTdUedFdTdUedJdTdUedRdHdIedSdHdIedVedVdWdXedYedYdZd[ed\ed\d]d^ed_ed_d`daedbedbdcddedeededfdgedhedhdidjedkedkdldmednedndodpedqd1drd7e2edqdsdtedud7e2edudsdvedwd7e2edwdsdxedyd7e2edydsdxedzd1d{d7e2edzdsd|ed}ed}dsd~ejZ3e3j4dddd1dde3_5dS(sTransport is an abstraction layer to handle file access.

The abstraction is to allow access from the local filesystem, as well
as remote (such as http or sftp).

Transports are constructed from a string, being a URL or (as a degenerate
case) a local filesystem path.  This is typically the top directory of
a bzrdir, repository, or similar object we are interested in working with.
The Transport returned has methods to read, write and manipulate files within
it.
i(tabsolute_import(tStringION(tlazy_imports
import errno
from stat import S_ISDIR
import urlparse

from bzrlib import (
    errors,
    osutils,
    symbol_versioning,
    ui,
    urlutils,
    )
(tDEPRECATED_PARAMETER(tmutter(thookstregistrycC@stS(s-Return a dictionary of {urlprefix: [factory]}(ttransport_list_registry(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_get_protocol_handlersBscC@s
|adS(s{Replace the current protocol handlers dictionary.

    WARNING this will remove all build in protocols. Use with care.
    N(R(tnew_handlers((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_set_protocol_handlersGscC@s
tadS(N(tTransportListRegistryR(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_clear_protocol_handlersPscC@s~t}x>tjD]0\}}x!|D]}|j|jq)WqW|jd|jdt|}|j|S(s2Return a list of the modules providing transports.sbzrlib.transport.chrootsbzrlib.transport.pathfilter(tsetRtitemstaddt
get_moduletlisttsort(tmodulestprefixtfactory_listtfactorytresult((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_get_transport_modulesUs	



RcB@s,eZdZdZdZddZRS(soA registry which simplifies tracking available Transports.

    A registration of a new protocol requires two steps:
    1) register the prefix with the function register_transport( )
    2) register the protocol provider with the function
    register_transport_provider( ) ( and the "lazy" variant )

    This is needed because:
    a) a single provider can support multiple protocols ( like the ftp
    provider which supports both the ftp:// and the aftp:// protocols )
    b) a single protocol can have multiple providers ( like the http://
    protocol which is supported by both the urllib and pycurl provider )
    cC@s&|j|jdtj|dS(Ni(tgettinsertRt
_ObjectGetter(tselftkeytobj((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytregister_transport_providersscC@s)|j|jdtj||dS(Ni(RRRt_LazyObjectGetter(RRtmodule_nametmember_name((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt register_lazy_transport_providervscC@s|j|g|dS(N(tregister(RRthelp((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytregister_transportzsN(t__name__t
__module__t__doc__RR#tNoneR&(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRds
		cC@sItj|||rE|jds4t|nt|d ndS(Ns://i(RR&tendswitht
ValueErrort!register_urlparse_netloc_protocol(RR%tinfotregister_netloc((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytregister_transport_protos
cC@s0|tkrt|ntj|||dS(N(RR0R#(Rtmodulet	classname((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytregister_lazy_transports
cC@s-|tkrt|ntj||dS(N(RR0R(Rtklass((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR&s
cC@s&|tjkr"tjj|ndS(sFEnsure that protocol is setup to be used with urlparse netloc parsing.N(turlparsetuses_netloctappend(tprotocol((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR-scC@s&|tjkr"tjj|ndS(sRemove protocol from urlparse netloc parsing.

    Except for tests, you should never use that function. Using it with 'http',
    for example, will break all http transports.
    N(R5R6tremove(R8((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt$_unregister_urlparse_netloc_protocolscC@sxtj|}x@|D]8}|j}||krtj|j|PqqWt|dkrttj|ndS(sUnregister a transport.iN(RRtget_objR9tlen(tschemeRtltito((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytunregister_transports
t_CoalescedOffsetcB@s8eZdZdddgZdZdZdZRS(s8A data container for keeping track of coalesced offsets.tstarttlengthtrangescC@s||_||_||_dS(N(RCRDRE(RRCRDRE((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt__init__s		cC@s1t|j|j|jf|j|j|jfS(N(tcmpRCRDRE(Rtother((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt__cmp__scC@s#d|jj|j|j|jfS(Ns%s(%r, %r, %r)(t	__class__R'RCRDRE(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt__repr__s(R'R(R)t	__slots__RFRIRK(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRBs
		t
LateReadErrorcB@sGeZdZdZdZdZdZddZdZRS(szA helper for transports which pretends to be a readable file.

    When read() is called, errors.ReadError is raised.
    cC@s
||_dS(N(t_path(Rtpath((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRFscC@sdS(sa no-op - do nothing.N((R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytclosescC@stj|jdS(sRaise ReadError.N(terrorst	ReadErrorRN(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_failscC@s|jdS(N(RS(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt__iter__sicC@s|jdS(N(RS(Rtcount((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytreadscC@s|jdS(N(RS(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt	readliness(	R'R(R)RFRPRSRTRVRW(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRMs				t
FileStreamcB@s5eZdZdZdZedZdZRS(sBase class for FileStreams.cC@s||_||_dS(s-Create a FileStream for relpath on transport.N(t	transporttrelpath(RRYRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRFs	cC@sdS(s>A hook point for subclasses that need to take action on close.N((R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_closescC@sR|r.y|jWq.tjk
r*q.Xn|jt|jj|j=dS(N(t	fdatasyncRQtTransportNotPossibleR[t
_file_streamsRYtabspathRZ(Rtwant_fdatasync((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRPs
cC@stjd|jfdS(sForce data out to physical disk if possible.

        :raises TransportNotPossible: If this transport has no way to 
            flush to disk.
        s%s cannot fdatasyncN(RQR]RY(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR\s(R'R(R)RFR[tFalseRPR\(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRXs
			tFileFileStreamcB@s2eZdZdZdZdZdZRS(suA file stream object returned by open_write_stream.

    This version uses a file like object to perform writes.
    cC@s tj|||||_dS(N(RXRFtfile_handle(RRYRZRc((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRFscC@s|jjdS(N(RcRP(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR[scC@sQ|jjy|jj}Wntk
r?tjnXtj|dS(s,Force data out to physical disk if possible.N(RctflushtfilenotAttributeErrorRQR]tosutilsR\(RRe((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR\s

cC@stj||jdS(N(Rgtpump_string_fileRc(Rtbytes((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytwrites(R'R(R)RFR[R\Rj(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRbs
				tAppendBasedFileStreamcB@seZdZdZRS(sxA file stream object returned by open_write_stream.

    This version uses append on a transport to perform writes.
    cC@s|jj|j|dS(N(RYtappend_bytesRZ(RRi((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRjs(R'R(R)Rj(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRkstTransportHookscB@seZdZdZRS(sAMapping of hook names to registered callbacks for transport hookscC@s*tt|j|jddddS(Ntpost_connectsCalled after a new connection is established or a reconnect occurs. The sole argument passed is either the connected transport or smart medium instance.ii(ii(tsuperRmRFtadd_hook(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRF$s	(R'R(R)RF(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRm"st	TransportcB@seZdZdZdZeZdZedZ	dHdZdHdZdHdZ
dZd	Zd
ZdZdZd
ZdZedZdZdZdZdZdZdHdZdZdZdZdZdZ e!dHdZ"dZ#ddZ$dZ%e&dddd Z'dHd!Z(dHd"Z)dHe!dHd#Z*dHd$Z+dHe!dHd%Z,dHd&Z-dHdHd'Z.dHd(Z/dHd)Z0dHd*Z1dHd+Z2d,Z3dHd-Z4dHdHd.Z5d/Z6d0Z7d1Z8d2Z9dHd3Z:d4Z;d5Z<dHd6Z=d7Z>d8Z?d9Z@d:ZAdHd;ZBd<ZCd=ZDd>ZEd?ZFd@ZGdAZHdBZIdCZJdDZKdEZLdFZMdGZNRS(Is$This class encapsulates methods for retrieving or putting a file
    from/to a storage location.

    Most functions have a _multi variant, which allows you to queue up
    multiple requests. They generally have a dumb base implementation
    which just iterates over the arguments, but smart Transport
    implementations can do pipelining.
    In general implementations should support having a generator or a list
    as an argument (ie always iterate, never index)

    :ivar base: Base URL for the transport; should always end in a slash.
    i2icC@s;tt|j||_tj|\|_|_dS(N(RoRqRFtbaseturlutilstsplit_segment_parameterst	_raw_baset_segment_parameters(RRr((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRFGs	cC@st|dddk	rs|jtjtjfkrKtj|d|n>|jtjkrtd||ftj|d|nt	j
dkr|jtjdfkrtj|d|n|jtjkrtj
|d|n|jtjkrtj|d|n|jtjkrFtj|d|n|jtjkrstj|d|qsn|rtjd|ndS(sTranslate an IOError or OSError into an appropriate bzr error.

        This handles things like ENOENT, ENOTDIR, EEXIST, and EACCESS
        terrnotextrasEINVAL returned on path %s: %rtwin32it
orig_errorN(tgetattrR*RwtENOENTtENOTDIRRQt
NoSuchFiletEINVALRtsystplatformtESRCHtEEXISTt
FileExiststEACCEStPermissionDeniedt	ENOTEMPTYtDirectoryNotEmptytEBUSYtResourceBusytTransportError(RteROt
raise_generic((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_translate_errorMs$'cC@st|jdS(sReturn a new Transport object, cloned from the current location,
        using a subdirectory or parent directory. This allows connections
        to be pooled, rather than a new one needed for each subdir.
        N(tNotImplementedErrortclone(Rtoffset((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRiscC@s|}|g}xtr|jd}|j|jkrRtjd|jny|jdd|Wn;tjk
r|j||}qtjk
rPqXPqWx&|r|j	}|j
d|qWdS(s5Create all the directories leading down to self.base.s..s$Failed to create path prefix for %s.t.tmodeN(tTrueRRrRQtBzrCommandErrortmkdirR~R7Rtpoptensure_base(RRt
cur_transporttneededt
new_transport((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
create_prefixps&		
		cC@s@y|jdd|Wntjtjfk
r7tSXtSdS(sEnsure that the directory this transport references exists.

        This will create a directory if it doesn't exist.
        :return: True if the directory was created, False otherwise.
        RRN(RRQRRRaR(RR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRs
	cC@st|jdS(sReturn a URL for self that can be given to an external process.

        There is no guarantee that the URL can be accessed from a different
        machine - e.g. file:/// urls are only usable on the local machine,
        sftp:/// urls when the server is only bound to localhost are only
        usable from localhost etc.

        NOTE: This method may remove security wrappers (e.g. on chroot
        transports) and thus should *only* be used when the result will not
        be used to obtain a new transport within bzrlib. Ideally chroot
        transports would know enough to cause the external url to be the exact
        one used that caused the chrooting in the first place, but that is not
        currently the case.

        :return: A URL that can be given to another process.
        :raises InProcessTransport: If the transport is one that cannot be
            accessed out of the current process (e.g. a MemoryTransport)
            then InProcessTransport is raised.
        N(Rtexternal_url(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRscC@s|jS(sFReturn the segment parameters for the top segment of the URL.
        (Rv(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytget_segment_parametersscC@s]|dkr1y|j|=Wq>tk
r-q>Xn
||j|<tj|j|j|_dS(sSet a segment parameter.

        :param name: Segment parameter name (urlencoded string)
        :param value: Segment parameter value (urlencoded string)
        N(R*RvtKeyErrorRstjoin_segment_parametersRuRr(Rtnametvalue((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytset_segment_parameters

cC@stj||S(sMost children will need to copy from one file-like
        object or string to another one.
        This just gives them something easy to call.
        (Rgtpumpfile(Rt	from_filetto_file((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_pumpscC@s'yt|SWntk
r"dSXdS(scTry to figure out how many entries are in multi,
        but if not possible, return None.
        N(R<t	TypeErrorR*(Rtmulti((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
_get_totals
cC@stjj|||dS(sUNotify that this transport has activity.

        Implementations should call this from all methods that actually do IO.
        Be careful that it's not called twice, if one method is implemented on
        top of another.

        :param bytes: Number of bytes read or written.
        :param direction: 'read' or 'write' or None.
        N(tuit
ui_factorytreport_transport_activity(RRit	direction((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_report_activitys
cC@sM|dkrdS|dkr6|j|||dn|j|||dS(sUpdate the progress bar based on the current count
        and total available, total may be None if it was
        not possible to determine.
        Ni(R*tupdate(RtpbtmsgRUttotal((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
_update_pbs
c
C@s|j|}g}d}x]|D]U}	|j|||||rZ|j||	n|j||	|d7}q"Wt|S(s>Iterate over all entries in multi, passing them to func,
        and update the progress bar as you go along.

        :param expand:  If True, the entries will be passed to the function
                        by expanding the tuple. If False, it will be passed
                        as a single parameter.
        ii(RRR7ttuple(
RRtfuncRRtexpandRRRUtentry((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
_iterate_overs
cC@st|jdS(smReturn the full url to the given relative path.

        :param relpath: a string of a relative path
        N(RR_(RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR_scC@sdS(sXReturn the recommended page size for this transport.

        This is potentially different for every path in a given namespace.
        For example, local transports might use an operating system call to
        get the block size for a given path, which can vary due to mount
        points.

        :return: The page size in bytes.
        iii((R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytrecommended_page_size
s
cC@s]||jd kp"|j|js=tj||jnt|j}||jdS(s*Return the local path portion from a given absolute path.

        This default implementation is not suitable for filesystems with
        aliasing, such as that given by symlinks, where a path may not
        start with our base, but still be a relpath once aliasing is
        resolved.
        it/(Rrt
startswithRQtPathNotChildR<tstrip(RR_tpl((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRZs
%cC@stj|j|dS(sReturn the absolute path on the local filesystem.

        This function will only be defined for Transports which have a
        physical local filesystem representation.

        :raises errors.NotLocalUrl: When no local path representation is
            available.
        N(RQtNotLocalUrlR_(RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
local_abspath%s	cC@st|jdS(sDoes the file relpath exist?

        Note that some transports MAY allow querying on directories, but this
        is not part of the protocol.  In other words, the results of
        t.has("a_directory_name") are undefined.

        :rtype: bool
        N(Rthas(RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR0s	cc@sX|j|}d}x<|D]4}|j|d|||j|V|d7}qWdS(s,Return True/False for each entry in relpathsiRiN(RRR(RtrelpathsRRRURZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt	has_multi;s
cC@s(x!|D]}|j|rtSqWtS(s&Return True if any of the paths exist.(RRRa(RRRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pythas_anyDs
cC@stjddS(sIter the relative paths of files in the transports sub-tree.

        *NOTE*: This only lists *files*, not subdirectories!

        As with other listing functions, only some transports implement this,.
        you may check via listable() to determine if it will.
        snThis transport has not implemented iter_files_recursive (but must claim to be listable to trigger this error).N(RQR](R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytiter_files_recursiveKscC@st|jdS(smGet the file at the given relative path.

        This may fail in a number of ways:
         - HTTP servers may return content for a directory. (unexpected
           content failure)
         - FTP servers may indicate NoSuchFile for a directory.
         - SFTP servers may give a file handle for a directory that will
           fail on read().

        For correct use of the interface, be sure to catch errors.PathError
        when calling it and catch errors.ReadError when reading from the
        returned object.

        :param relpath: The relative path to the file
        :rtype: File-like object.
        N(RR(RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRXscC@s/|j|}z|jSWd|jXdS(sGet a raw string of the bytes for a file at the given location.

        :param relpath: The relative path to the file
        N(RRVRP(RRZtf((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt	get_byteskscC@stj|dS(s#Return a smart client medium for this transport if possible.

        A smart medium doesn't imply the presence of a smart server: it implies
        that the smart protocol can be tunnelled via this transport.

        :raises NoSmartMedium: if no smart server medium is available.
        N(RQt
NoSmartMedium(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytget_smart_mediumvscC@s+|r|j||}n|j||S(sGet parts of the file at the given relative path.

        :param relpath: The path to read data from.
        :param offsets: A list of (offset, size) tuples.
        :param adjust_for_latency: Adjust the requested offsets to accomodate
            transport latency. This may re-order the offsets, expand them to
            grab adjacent data when there is likely a high cost to requesting
            data relative to delivering it.
        :param upper_limit: When adjust_for_latency is True setting upper_limit
            allows the caller to tell the transport about the length of the
            file, so that requests are not issued for ranges beyond the end of
            the file. This matters because some servers and/or transports error
            in such a case rather than just satisfying the available ranges.
            upper_limit should always be provided when adjust_for_latency is
            True, and should be the size of the file in bytes.
        :return: A list or generator of (offset, data) tuples
        (t_sort_expand_and_combinet_readv(RRZtoffsetstadjust_for_latencytupper_limit((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytreadvs
cC@s,|s
dS|j|}|j|||S(sGet parts of the file at the given relative path.

        :param relpath: The path to read.
        :param offsets: A list of (offset, size) tuples.
        :return: A list or generator of (offset, data) tuples
        N(Rt_seek_and_read(RRZRtfp((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRss	<unknown>cc@st|}t|}t|}|j}|j|d|jd|j}i}z#x|D]}	|j|	j|j	|	j
}
t|
|	j
krtj
||	j|	j
dt|
nx?|	jD]4\}}|	j||f}
|
|||!||
<qWxh||krt|j|}|d}y|j}Wn!tk
re|jd}nX||fVq
WqaWWd|jXdS(sAn implementation of readv that uses fp.seek and fp.read.

        This uses _coalesce_offsets to issue larger reads and fewer seeks.

        :param fp: A file-like object that supports seek() and read(size).
            Note that implementations are allowed to call .close() on this file
            handle, so don't trust that you can use it for other work.
        :param offsets: A list of offsets to be read from the given file.
        :return: yield (pos, data) tuples for each request
        tlimittfudge_factortactualiN(Rtsortedtitertnextt_coalesce_offsetst_max_readv_combinet_bytes_to_read_before_seektseekRCRVRDR<RQtShortReadvErrorRERt
StopIterationRPR*(RRRRZtsorted_offsetstoffset_stacktcur_offset_and_sizet	coalescedtdata_maptc_offsettdatat	suboffsettsubsizeRt	this_datatthis_offset((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRs8	




cC@st|}t|dkr.d}|S|j}g}x|D]\}}||}|dkrrd}n|d}	||	}
||}|
dkrd}
n|dk	r|
||kr||
}n|j|
|fqGWg}|d\}}
|
|}xx|dD]l\}}||}||kr]|j||
f|}|}
|}qn||kr|}||}
qqW|j||
f|S(szHelper for readv.

        :param offsets: A readv vector - (offset, length) tuples.
        :param upper_limit: The highest byte offset that may be requested.
        :return: A readv vector that will read all the regions requested by
            offsets, in start-to-end order, with no duplicated regions,
            expanded by the transports recommended page size.
        ics@strdVndS(N(RaR*(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
empty_yieldersiiN(RR<RR*R7(RRRRtmaximum_expansiontnew_offsetsRRDt	expansiont	reductiont
new_offsett
new_lengthtcurrent_offsettcurrent_lengthtcurrent_finishtfinish((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRsF		
	


	


c
C@swd}tddg}g}|dkr3d}nx|D]\}}||}	|dk	r|||kr||jkr|dkst|j|kr|dks|	|j|kr||krtd||fn|	|j|_|jj||j|fn:|jdk	r/|j|nt||d|fg}|	}q:W|jdk	rs|j|n|S(sYield coalesced offsets.

        With a long list of neighboring requests, combine them
        into a single large request, while retaining the original
        offsets.
        Turns  [(15, 10), (25, 10)] => [(15, 20, [(0, 10), (10, 10)])]
        Note that overlapping requests are not permitted. (So [(15, 10), (20,
        10)] will raise a ValueError.) This is because the data we access never
        overlaps, and it allows callers to trust that we only need any byte of
        data for 1 request (so nothing needs to be buffered to fulfill a second
        request.)

        :param offsets: A list of (start, length) pairs
        :param limit: Only combine a maximum of this many pairs Some transports
                penalize multiple reads more than others, and sometimes it is
                better to return early.
                0 means no limit
        :param fudge_factor: All transports have some level of 'it is
                better to read some more data and throw it away rather
                than seek', so collapse if we are 'close enough'
        :param max_size: Create coalesced offsets no bigger than this size.
                When a single offset is bigger than 'max_size', it will keep
                its size and be alone in the coalesced offset.
                0 means no maximum size.
        :return: return a list of _CoalescedOffset objects, which have members
            for where to start, how much to read, and how to split those chunks
            back up
        iidisKOverlapping range not allowed: last range ended at %s, new one starts at %sNii@(R*RBRCR<RER,RDR7(
RRRtmax_sizetlast_endtcurtcoalesced_offsetsRCtsizetend((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRs0	
! 
cc@sX|j|}d}x<|D]4}|j|d|||j|V|d7}qWdS(sGet a list of file-like objects, one for each entry in relpaths.

        :param relpaths: A list of relative paths.
        :param pb:  An optional ProgressTask for indicating percent done.
        :return: A list or generator of file-like objects
        iRiN(RRR(RRRRRURZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt	get_multi[s

cC@sDt|ts(tdt|n|j|t|d|S(s&Atomically put the supplied bytes into the given location.

        :param relpath: The location to put the contents, relative to the
            transport base.
        :param bytes: A bytestring of data.
        :param mode: Create the file with the given mode.
        :return: None
        s$bytes must be a plain string, not %sR(t
isinstancetstrtAssertionErrorttypetput_fileR(RRZRiR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt	put_bytesls	c	C@sTt|ts(tdt|n|j|t|d|d|d|dS(sCopy the string into the target location.

        This function is not strictly safe to use. See
        Transport.put_bytes_non_atomic for more information.

        :param relpath: The remote location to put the contents.
        :param bytes:   A string object containing the raw bytes to write into
                        the target file.
        :param mode:    Possible access permissions for new file.
                        None means do not set remote permissions.
        :param create_parent_dir: If we cannot create the target file because
                        the parent directory does not exist, go ahead and
                        create it, and then try again.
        :param dir_mode: Possible access permissions for new directories.
        s$bytes must be a plain string, not %sRtcreate_parent_dirtdir_modeN(RRRRtput_file_non_atomicR(RRZRiRRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytput_bytes_non_atomiczscC@s3tjd|jjft|j||d|S(sRCopy the file-like object into the location.

        :param relpath: Location to put the contents, relative to base.
        :param f:       File-like object.
        :param mode: The mode for the newly created file,
                     None means just use the default.
        :return: The length of the file that was written.
        sZTransport %s should implement put_file, rather than implementing put() as of version 0.11.R(tsymbol_versioningtwarnRJR'tDeprecationWarningtput(RRZRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRs	
cC@sy|j||d|SWn^tjk
rz|s9ntj|}|r{|j|d||j||d|SnXdS(saCopy the file-like object into the target location.

        This function is not strictly safe to use. It is only meant to
        be used when you already know that the target does not exist.
        It is not safe, because it will open and truncate the remote
        file. So there may be a time when the file has invalid contents.

        :param relpath: The remote location to put the contents.
        :param f:       File-like object.
        :param mode:    Possible access permissions for new file.
                        None means do not set remote permissions.
        :param create_parent_dir: If we cannot create the target file because
                        the parent directory does not exist, go ahead and
                        create it, and then try again.
        :param dir_mode: Possible access permissions for new directories.
        RN(RRQR~RgtdirnameR(RRZRRRRt
parent_dir((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRscC@st|jdS(s%Create a directory at the given path.N(RR(RRZR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRsc@s4fd}tj|||ddtS(sCreate a group of directoriesc@sj|ddS(NR(R(RO(RR(s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRsRR(R<RRa(RRRRR((RRs=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytmkdir_multiscC@st|jdS(sOpen a writable file stream at relpath.

        A file stream is a file like object with a write() method that accepts
        bytes to write.. Buffering may occur internally until the stream is
        closed with stream.close().  Calls to readv or the get_* methods will
        be synchronised with any internal buffering that may be present.

        :param relpath: The relative path to the file.
        :param mode: The mode for the newly created file,
                     None means just use the default
        :return: A FileStream. FileStream objects have two methods, write() and
            close(). There is no guarantee that data is committed to the file
            if close() has not been called (even if get() is called on the same
            path).
        N(Rtopen_write_stream(RRZR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR
scC@s3tjd|jjft|j||d|S(suAppend bytes from a file-like object to a file at relpath.

        The file is created if it does not already exist.

        :param f: a file-like object of the bytes to append.
        :param mode: Unix mode for newly created files.  This is not used for
            existing files.

        :returns: the length of relpath before the content was written to it.
        s`Transport %s should implement append_file, rather than implementing append() as of version 0.11.R(RRRJR'RR7(RRZRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytappend_files	
cC@sDt|ts(tdt|n|j|t|d|S(shAppend bytes to a file at relpath.

        The file is created if it does not already exist.

        :type f: str
        :param f: a string of the bytes to append.
        :param mode: Unix mode for newly created files.  This is not used for
            existing files.

        :returns: the length of relpath before the content was written to it.
        s$bytes must be a plain string, not %sR(RRRRRR(RRZRiR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRlscC@s|j||j|ddtS(sAppend the text in each file-like or string object to
        the supplied location.

        :param files: A set of (path, f) entries
        :param pb:  An optional ProgressTask for indicating percent done.
        R7R(RRR(RtfilesR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytappend_multiscC@s|j||j|dS(sCopy the item at rel_from to the location at rel_to.

        Override this for efficiency if a specific transport can do it
        faster than this default implementation.
        N(RR(Rtrel_fromtrel_to((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytcopyscC@s|j||j|ddtS(suCopy a bunch of entries.

        :param relpaths: A list of tuples of the form [(from, to), (from, to),...]
        RR(RRR(RRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
copy_multisc@s7fd}tj|||ddtS(sSCopy a set of entries from self into another Transport.

        :param relpaths: A list/generator of entries to be copied.
        :param mode: This is the target mode for the newly created files
        TODO: This interface needs to be updated so that the target location
              can be different from the source location.
        c@s#j|j|ddS(NR(RR(RO(RRHR(s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
copy_entry&stcopy_toR(R<RRa(RRRHRRR((RRHRs=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRs	cC@sU|j|}|j|}|j|}|jd|jd@|j|dS(sCopy a subtree from one relpath to another.

        If a faster implementation is available, specific transports should
        implement it.
        RiN(RtstatRtst_modetcopy_tree_to_transport(Rtfrom_relpatht
to_relpathtsourcettargetR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt	copy_tree+s
cC@sg}dg}x|r|j}|dkr@|j|nx`|j|D]O}|d|}|j|}t|jr|j|qP|j|qPWqW|j||dS(sCopy a subtree from one transport to another.

        self.base is used as the source tree root, and to_transport.base
        is used as the target.  to_transport.base must exist (and be a
        directory).
        RRN(RRtlist_dirRtS_ISDIRRR7R(Rtto_transportRtdirectoriestdirROR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR:s		cC@st|jdS(sRename a file or directory.

        This *must* fail if the destination is a nonempty directory - it must
        not automatically remove it.  It should raise DirectoryNotEmpty, or
        some other PathError if the case can't be specifically detected.

        If the destination is an empty directory or a file this function may
        either fail or succeed, depending on the underlying transport.  It
        should not attempt to remove the destination if overwriting is not the
        native transport behaviour.  If at all possible the transport should
        ensure that the rename either completes or not, without leaving the
        destination deleted and the new file not moved in place.

        This is intended mainly for use in implementing LockDir.
        N(Rtrename(RRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR$PscC@sYt|j|jr8|j|||j|n|j|||j|dS(s	Move the item at rel_from to the location at rel_to.

        The destination is deleted if possible, even if it's a non-empty
        directory tree.

        If a transport can directly implement this it is suggested that
        it do so for efficiency.
        N(R RRRtdelete_treeRtdelete(RRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytmovecs
	cC@s|j||j|ddtS(syMove a bunch of entries.

        :param relpaths: A list of tuples of the form [(from1, to1), (from2, to2),...]
        R'R(RR'R(RRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
move_multisscC@st|jdS(sUMove a bunch of entries to a single location.
        This differs from move_multi in that you give a list of from, and
        a single destination, rather than multiple destinations.

        :param relpaths: A list of relative paths [from1, from2, from3, ...]
        :param rel_to: A directory where each entry should be placed.
        N(Rt
move_multi_to(RRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR)zs
cC@st|jdS(sDelete the item at relpathN(RR&(RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR&scC@s|j||j|ddtS(s0Queue up a bunch of deletes to be done.
        R&R(RR&Ra(RRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytdelete_multisc	C@s|j|}g}dg}g}x|r|j}|dkrU|j|nx`|j|D]O}|d|}|j|}t|jr|j|qe|j|qeWq'W|j||jx|D]}|j	|qW|j	|dS(s=Delete an entire tree. This may require a listable transport.RRN(
RRR7RRR RR*treversetrmdir(	RRZtsubtreeRR"tpending_rmdirsR#ROR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR%s&		


cC@sd|j|jj|jfS(Ns<%s.%s url=%s>(R(RJR'Rr(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRKscC@st|jdS(sReturn the stat information for a file.
        WARNING: This may not be implementable for all protocols, so use
        sparingly.
        NOTE: This returns an object with fields such as 'st_size'. It MAY
        or MAY NOT return the literal result of an os.stat() call, so all
        access should be via named fields.
        ALSO NOTE: Stats of directories may not be supported on some
        transports.
        N(RR(RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRs
cC@s
tdS(s%Remove a directory at the given path.N(R(RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR,sc@s:gfd}j|||ddt}S(s8Stat multiple files and return the information.
        c@sjj|dS(N(R7R(RO(Rtstats(s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytgathersRR(RRa(RRRR0RU((RR/s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
stat_multiscC@stjd|dS(sHReturn a string representing the path to which the symbolic link points.s-Dereferencing symlinks is not supported on %sN(RQR](RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytreadlinkscC@stjd|dS(s5Create a hardlink pointing to source named link_name.s"Hard links are not supported on %sN(RQR](RRt	link_name((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pythardlinkscC@stjd|dS(s4Create a symlink pointing to source named link_name.s Symlinks are not supported on %sN(RQR](RRR3((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytsymlinkscC@st|jdS(s+Return True if this store supports listing.N(Rtlistable(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR6scC@stjd|dS(sReturn a list of all files at the given location.
        WARNING: many transports do not support this, so trying avoid using
        it if at all possible.
        s`Transport %r has not implemented list_dir (but must claim to be listable to trigger this error).N(RQR](RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRs	cC@stjd|dS(syLock the given file for shared (read) access.

        WARNING: many transports do not support this, so trying avoid using it.
        These methods may be removed in the future.

        Transports may raise TransportNotPossible if OS-level locks cannot be
        taken over this transport.

        :return: A lock object, which should contain an unlock() function.
        s#transport locks not supported on %sN(RQR](RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt	lock_readscC@stjd|dS(s}Lock the given file for exclusive (write) access.

        WARNING: many transports do not support this, so trying avoid using it.
        These methods may be removed in the future.

        Transports may raise TransportNotPossible if OS-level locks cannot be
        taken over this transport.

        :return: A lock object, which should contain an unlock() function.
        s#transport locks not supported on %sN(RQR](RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
lock_writescC@stS(s4Return true if this connection cannot be written to.(Ra(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytis_readonlyscC@stS(sReturn true if this transport can store and retrieve unix modebits.

        (For example, 0700 to make a directory owner-private.)

        Note: most callers will not want to switch on this, but should rather
        just try and set permissions and let them be either stored or not.
        This is intended mainly for the use of the test suite.

        Warning: this is not guaranteed to be accurate as sometimes we can't
        be sure: for example with vfat mounted on unix, or a windows sftp
        server.(Ra(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_can_roundtrip_unix_modebitsscC@sdS(N(R*(Rt
other_base((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
_reuse_forscC@sdS(N((R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
disconnectscC@sdS(sbReturns a transport suitable to re-issue a redirected request.

        :param source: The source url as returned by the server.
        :param target: The target url as returned by the server.

        The redirection can be handled only if the relpath involved is not
        renamed by the redirection.

        :returns: A transport or None.
        N(R*(RRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_redirected_tos
N(OR'R(R)RRRmRRFRRR*RRRRRRRRRRRR_RRZRRRRRRRRRaRRRRtstaticmethodRRRRRRRRR
RRlRRRRRRR$R'R(R)R&R*R%RKRR,R1R2R4R5R6RR7R8R9R:R<R=R>(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRq,s											
							
			
"	
3	;<																			
	
				t_SharedConnectioncB@s eZdZddddZRS(s/A connection shared between several transports.cC@s||_||_||_dS(sConstructor.

        :param connection: An opaque object specific to each transport.

        :param credentials: An opaque object containing the credentials used to
            create the connection.
        N(t
connectiontcredentialsRr(RRARBRr((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRF.s		N(R'R(R)R*RF(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR@+stConnectedTransportcB@seZdZddZedZedZedZedZ	edZ
edZddZe
d	Ze
d
ZdZdZd
ZdZddZdZdZdZdZdZRS(s(A transport connected to a remote server.

    This class provide the basis to implement transports that need to connect
    to a remote server.

    Host and credentials are available as private attributes, cloning preserves
    them and share the underlying, protocol specific, connection.
    cC@s|jds|d7}n|j||_|dk	ra|jj|j_|jj|j_nt|j}tt|j	||dkrt
|_n|j|_dS(s8Constructor.

        The caller should ensure that _from_transport points at the same host
        as the new base.

        :param base: transport root URL

        :param _from_transport: optional transport to build from. The built
            transport will share the connection with this transport.
        RN(R+t
_split_urlt_parsed_urlR*tpasswordtquoted_passwordRRoRCRFR@t_shared_connection(RRrt_from_transport((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRFEs
cC@s
|jjS(N(REtuser(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_userdscC@s
|jjS(N(RERF(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt	_passwordhscC@s
|jjS(N(REthost(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_hostlscC@s
|jjS(N(REtport(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_portpscC@s
|jjS(N(RERO(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRNtscC@s
|jjS(N(RER=(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_schemexscC@sB|dkr"|j|jd|S|j|j|d|SdS(sReturn a new transport with root at self.base + offset

        We leave the daughter classes take advantage of the hint
        that it's a cloning not a raw creation.
        RIN(R*RJRrR_(RR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR|scC@stjj|S(N(RstURLtfrom_string(turl((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRDscC@stj|}|dk	r7dtj||f}n|dk	rVd||f}ntj|}tj|||dddfS(sBuild the full URL for the given already URL encoded path.

        user, password, host and path will be quoted if they contain reserved
        chars.

        :param scheme: protocol
        :param user: login
        :param password: associated password
        :param host: the server address
        :param port: the associated port
        :param path: the absolute path on the server

        :return: The corresponding URL.
        s%s@%ss%s:%dN(RstquoteR*tescapeR5t
urlunparse(R=RJRFRMROROtnetloc((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_unsplit_urlscC@sC|j|}g}|j|jjkr:|jdn|j|jjkr_|jdn|j|jjkr|jdn|j|jjkr|jdn|j|jjd kp|jj|jjs|jdn|rdj	|}t
j||jd|nt
|jj}|j|jd	S(
s8Return the local path portion from a given absolute pathsscheme mismatchsuser name mismatchs
host mismatchs
port mismatchis
path mismatchs, RxR(RDR=RER7RJRMRORORtjoinRQRRrR<R(RR_t
parsed_urlterrorRxR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRZs$cC@st|jj|S(sReturn the full url to the given relative path.

        :param relpath: the relative path urlencoded

        :returns: the Unicode version of the absolute path for relpath.
        (RRER(RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR_scC@s|jj|jS(sReturn the absolute path part of the url to the given relative path.

        This is the path that the remote server expect to receive in the
        requests, daughter classes should redefine this method if needed and
        use the result to build their requests.

        :param relpath: the path relative to the transport base urlencoded.

        :return: the absolute Unicode path on the server,
        (RERRO(RRZ((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_remote_pathscC@s|jS(sGet the object shared amongst cloned transports.

        This should be used only by classes that needs to extend the sharing
        with objects other than transports.

        Use _get_connection to get the connection itself.
        (RH(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_get_shared_connectionscC@s>||j_||j_x|jdD]}||q&WdS(s9Record a newly created connection with its associated credentials.

        Note: To ensure that connection is still shared after a temporary
        failure and a new one needs to be created, daughter classes should
        always call this method to set the connection and do so each time a new
        connection is created.

        :param connection: An opaque object representing the connection used by
            the daughter class.

        :param credentials: An opaque object representing the credentials
            needed to create the connection.
        RnN(RHRARBR(RRARBthook((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_set_connectionscC@s
|jjS(s1Returns the transport specific connection object.(RHRA(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_get_connectionscC@s
|jjS(s9Returns the credentials used to establish the connection.(RHRB(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_get_credentialsscC@s||j_dS(sUpdate the credentials of the current connection.

        Some protocols can renegociate the credentials within a connection,
        this method allows daughter classes to share updated credentials.

        :param credentials: the updated credentials.
        N(RHRB(RRB((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt_update_credentialss
cC@sy|j|}Wntjk
r*dSXd}|j|jjkr|j|jjkr|j|jjkr|j|jjkr|j	}|j
ds|d7}n|jj	|kr|S|j|d|}n|S(sMReturns a transport sharing the same connection if possible.

        Note: we share the connection if the expected credentials are the
        same: (host, port, user). Some protocols may disagree and redefine the
        criteria in daughter classes.

        Note: we don't compare the passwords here because other_base may have
        been obtained from an existing transport.base which do not mention the
        password.

        :param other_base: the URL we want to share the connection with.

        :return: A new transport or None if the connection cannot be shared.
        RRIN(RDRQt
InvalidURLR*R=RERJRMROROR+RJ(RR;R[RYRO((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR<s 	
cC@st|jdS(smDisconnect the transport.

        If and when required the transport willl reconnect automatically.
        N(RR=(R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyR=-sN(R'R(R)R*RFtpropertyRKRLRNRPRNRQRR?RDRYRZR_R]R^R`RaRbRcR<R=(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRC;s*				
	
				+cC@st|tstdnddlm}|j|}y|jd}WnJtk
rtj	|rt
jd|ddntj|}nX|j
dr|j
d	rtjtjd
|dStj	|stj|S|S(svDetermine a fully qualified URL from a location string.

    This will try to interpret location as both a URL and a directory path. It
    will also lookup the location in directories.

    :param location: Unicode or byte string object with a location
    :raise InvalidURL: If the location is already a URL, but not valid.
    :return: Byte string with resulting URL
    s%location not a byte or unicode stringi(R"tasciiRORxsURLs must be properly escapedsfile:sfile://Ri(Rt
basestringRtbzrlib.directory_serviceR"tdereferencetencodetUnicodeErrorRstis_urlRQRdtlocal_path_to_urlRRZ(tlocationR"((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytlocation_to_url5s 


cC@sttj||S(sOpen a transport for a local path.

    :param path: Local path as byte or unicode string
    :return: Transport object for path
    (tget_transport_from_urlRsRm(ROtpossible_transports((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytget_transport_from_pathVscC@s/d}|dk	raxL|D]A}|j|}|dk	r||krV|j|n|SqWnd}xtjD]}\}}|dk	rt|j|rtt||\}}|r|dk	r||krtn|j|n|SqtqtWtj	|st
jd|nt
j||dS(s(Open a transport to access a URL.
    
    :param base: a URL
    :param transports: optional reusable transports list. If not None, created
        transports will be added to the list.

    :return: A new transport optionally sharing its connection with one of
        possible_transports.
    RON(
R*R<R7RRRt_try_transport_factoriesRRsRlRQRdtUnsupportedProtocol(RTRqRYtttt_same_connectiontlast_errtprotoR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRp`s*

cC@s(|dkrd}ntt||S(sNOpen a transport to access a URL or directory.

    :param base: either a URL or a directory name.

    :param transports: optional reusable transports list. If not None, created
        transports will be added to the list.

    :return: A new transport optionally sharing its connection with one of
        possible_transports.
    RN(R*RpRo(RrRq((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt
get_transports	cC@std}xa|D]Y}y|j|dfSWq
tjk
re}td|||f|}q
q
Xq
Wd|fS(Ns-failed to instantiate transport %r for %r: %r(R*R;RQtDependencyNotPresentR(RrRRwRR((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRss
cC@sd}xrt|D][}y||SWqtjk
rm}d|j|j|jf}||||}qXqWtjdS(sExecute an action with given transport catching redirections.

    This is a facility provided for callers needing to follow redirections
    silently. The silence is relative: it is the caller responsability to
    inform the user about each redirection or only inform the user of a user
    via the exception parameter.

    :param action: A callable, what the caller want to do while catching
                  redirections.
    :param transport: The initial transport used.
    :param redirected: A callable receiving the redirected transport and the
                  RedirectRequested exception.

    :return: Whatever 'action' returns
    is%s is%s redirected to %sN(trangeRQtRedirectRequestedRtpermanentlyRtTooManyRedirections(tactionRYt
redirectedtMAX_REDIRECTIONStredirectionsRtredirection_notice((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytdo_catching_redirectionsstServercB@s eZdZdZdZRS(s`A Transport Server.

    The Server interface provides a server for a given transport type.
    cC@sdS(s%Setup the server to service requests.N((R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytstart_serverscC@sdS(s4Remove the server and cleanup any resources it owns.N((R((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pytstop_servers(R'R(R)RR(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyRs	sfile://R%s.Access using the standard filesystem (default)sbzrlib.transport.localtLocalTransportssftp://s2Access using SFTP (most SSH servers provide SFTP).R/sbzrlib.transport.sftpt
SFTPTransportshttp+urllib://sbzrlib.transport.http._urllibtHttpTransport_urllibshttps+urllib://shttp+pycurl://sbzrlib.transport.http._pycurltPyCurlTransportshttps+pycurl://shttp://s1Read-only access of branches exported on the web.shttps://s;Read-only access of branches exported on the web using SSL.sftp://sAccess using passive FTP.sbzrlib.transport.ftptFtpTransportsaftp://sAccess using active FTP.sgio+s)Access using any GIO supported protocols.sbzrlib.transport.gio_transporttGioTransports
ftp+gssapi://saftp+gssapi://sftp+nogssapi://saftp+nogssapi://sbzrlib.transport.ftp._gssapitGSSAPIFtpTransports	memory://sbzrlib.transport.memorytMemoryTransports	readonly+sbzrlib.transport.readonlytReadonlyTransportDecoratorsfakenfs+sbzrlib.transport.fakenfstFakeNFSTransportDecoratorslog+sbzrlib.transport.logtTransportLogDecoratorstrace+sbzrlib.transport.tracetTransportTraceDecoratorsunlistable+sbzrlib.transport.unlistabletUnlistableTransportDecorators
brokenrename+sbzrlib.transport.brokenrenametBrokenRenameTransportDecoratorsvfat+sbzrlib.transport.fakevfattFakeVFATTransportDecoratorsnosmart+sbzrlib.transport.nosmarttNoSmartTransportDecoratorsbzr://s*Fast access using the Bazaar smart server.sbzrlib.transport.remotetRemoteTCPTransports	bzr-v2://tRemoteTCPTransportV2Onlysbzr+http://tRemoteHTTPTransportsbzr+https://s
bzr+ssh://s3Fast access using the Bazaar smart server over SSH.tRemoteSSHTransportsssh:tHintingSSHTransporttbzrsbzrlib.smart.servert	serve_bzrs?The Bazaar smart server protocol over TCP. (default port: 4155)(6R)t
__future__Rt	cStringIORRtbzrlib.lazy_importRtglobalstbzrlib.symbol_versioningRtbzrlib.traceRtbzrlibRRR^RR
RRtRegistryRRR*RaR0R3R&R-R:RAtobjectRBRMRXRbRktHooksRmRqR@RCRoRrRpRyRsRRRttransport_server_registryt
register_lazytdefault_key(((s=/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.pyt<module>s8											
	

	!
#	
	*																						
	
	
	

	
	
	

									
	


Copyright © 2017 || Recoded By Mr.Bumblebee