ó
’3Rc           @   s<   d  Z  d d l Z d d l m Z d e f d „  ƒ  YZ d S(   s>   Make blobs in a git repository accessible as file like objectsiÿÿÿÿN(   t   GitRepositoryErrort   GitVfsc           B   s6   e  Z d  e f d „  ƒ  YZ d d „ Z d d „ Z RS(   t   _Filec           B   s>   e  Z d  Z d „  Z d „  Z d „  Z d d „ Z d „  Z RS(   su   
        A file like object representing a file in git

        @todo: We don't support any byte ranges yet.
        c         C   s   t  |  _ t j | ƒ |  _ d  S(   N(   t   itert   _itert   StringIOt   _data(   t   selft   content(    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyt   __init__   s    	c         C   s   |  j  j ƒ  S(   N(   R   t   readline(   R   (    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyR
   "   s    c         C   s   |  j  j ƒ  S(   N(   R   t	   readlines(   R   (    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyR   %   s    c         C   s   |  j  j | ƒ S(   N(   R   t   read(   R   t   size(    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyR   (   s    c         C   s
   |  j  ƒ  S(   N(   t   close(   R   (    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyR   +   s    N(	   t   __name__t
   __module__t   __doc__R	   R
   R   t   NoneR   R   (    (    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyR      s   			c         C   s   | |  _  | p d |  _ d S(   s©   
        Access files in a unpaced Debian source package.

        @param repo: the git repository to act on
        @param committish: the committish to act on
        t   HEADN(   t   _repot   _committish(   R   t   repot
   committish(    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyR	   .   s    	c         C   sw   | p	 d } | d k r' t  d ƒ ‚ n  y* t j |  j j d |  j | f ƒ ƒ SWn t k
 rr } t | ƒ ‚ n Xd  S(   Nt   rs   Only reading supported so fars   %s:%s(   t   NotImplementedErrorR   R   R   t   showR   R    t   IOError(   R   t   patht   flagst   e(    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyt   open8   s    N(   R   R   t   objectR   R   R	   R   (    (    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyR      s   
(   R   R   t   gbp.git.repositoryR    R    R   (    (    (    s/   /usr/lib/python2.7/dist-packages/gbp/git/vfs.pyt   <module>   s   