
ct\c           @   sq  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m	 Z	 d f  d     YZ
 d f  d     YZ d f  d	     YZ e   Z d
 Z e j d k r e d 7Z n  e d Z g  d  Z d   Z e d  Z d   Z d e	 j f d     YZ d   Z d e f d     YZ d   Z d j d  Z e j e k rte j e j  n  e j d k Z e j  d e j!  Z" d   Z# e$ d  Z% d   Z& d e' f d     YZ( e j  d   Z) d! e	 j f d"     YZ* d# f  d$     YZ+ d% e+ f d&     YZ, d' f  d(     YZ- d)   Z. e j  d*  d+  Z/ g  d,  Z0 d- f  d.     YZ1 d S(/   sm   
svn-Command based Implementation of a Subversion WorkingCopy Path.

  SvnWCCommandPath  is the main class.

iN(   t   commont   cachec           B   s    e  Z i  Z i  Z i  Z i  Z RS(    (   t   __name__t
   __module__t   proplistt   infot   entriest   prop(    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR      s   t	   RepoEntryc           B   s   e  Z d    Z d   Z RS(   c         C   s   | |  _  | |  _ | |  _ d  S(   N(   t   urlt   revt	   timestamp(   t   selfR	   R
   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   __init__   s    		c         C   s   d |  j  |  j |  j f S(   Ns   repo: %s;%s  %s(   R	   R
   R   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   __str__    s    (   R   R   R   R   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR      s   	t	   RepoCachec           B   s;   e  Z d  Z d Z d   Z d   Z d d  Z d   Z RS(   s    The Repocache manages discovered repository paths
    and their revisions.  If inside a timeout the cache
    will even return the revision of the root.
    i   c         C   s   g  |  _  d  S(   N(   t   repos(   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   *   s    c         C   s   g  |  _  d  S(   N(   R   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   clear-   s    c         C   s   | d  k r d  S| d  k r+ t j   } n  xX |  j D]+ } | | j k r5 | | _ | | _ Pq5 q5 Wt | | |  } |  j j |  d  S(   N(   t   Nonet   timeR   R	   R   R
   R   t   append(   R   R	   R
   R   t   entry(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   put0   s    		c         C   so   t  j    } xV |  j D]K } | j | j  r | | j |  j k  rT | j | j f S| j d f Sq W| d f S(   Ni(   R   R   t
   startswithR	   R   t   timeoutR
   (   R   R	   t   nowR   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   getA   s    N(	   R   R   t   __doc__R   R   R   R   R   R   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   #   s   		s   _ -/\=$.~+%t   win32t   :s   @:c         C   sj   y |  d SWnW t  k
 re t j j d  } | j   d j | j d  d   } |  j |  | SXd  S(   Ni    s   svn -q --versiont   .i   (   t
   IndexErrort   pyt   processt   cmdexect   stript   joint   splitR   (   t   vert   v(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   _getsvnversionU   s    
c         C   s:   t  |   }  t j d k r6 t  |   j d d  }  n  |  S(   NR   t   $s   \$(   t   strt   syst   platformt   replace(   t   text(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   _escape_helper_   s    c         C   s@   x9 t  |   D]+ } | j   r% q n  | | k r7 q n  t SWt S(   N(   R*   t   isalnumt   Truet   False(   R.   t   allowed_charst   c(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   _check_for_bad_charse   s    c         C   sw   |  j  d d  \ } } | d k rs | j  d d  \ } } t | t  sZ t | t  rs t d |  f   qs n  d  S(   Ns   ://i   t   filet   /s   bad char in %r(   R%   R5   t   ALLOWED_CHARS_HOSTt   ALLOWED_CHARSt
   ValueError(   R	   t   protot   urit   hostt   uripath(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   checkbadcharsn   s    t   SvnPathBasec           B   s   e  Z d  Z d Z d   Z e e d d d  Z d   Z d   Z	 d   Z
 d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d e j f d     YZ RS(   s2    Base implementation for SvnPath implementations. R7   c         C   s   |  j  S(   N(   t   strpath(   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   _geturl   s    s   url of this svn-path.c         C   s   |  j  S(   s7    return a string representation (including rev-number) (   RA   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR      s    c         C   s   t  |  j  S(   N(   t   hashRA   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   __hash__   s    c         K   s:  t  j |  j  } | j d |  j  | _ | j d |  j  | _ |  j d  \ } } } } d | k r d | k s d | k r t d |   q nU | j d |  } | j d |  } | r | j	 d  r d | } n  | | | d <| j d	 |  | j d
 |  j
  | d r)d | | _ n d | | _ | S(   s   create a modified version of this path. A 'rev' argument
            indicates a new revision.
            the following keyword arguments modify various path parts::

              http://host.com/repo/path/file.ext
              |-----------------------|          dirname
                                        |------| basename
                                        |--|     purebasename
                                            |--| ext
        R
   t   auths!   dirname,basename,purebasename,extt   basenamet   purebasenamet   exts   invalid specification %rR   t   dirnamet   seps   %(dirname)s%(sep)s%(basename)ss   %(dirname)s(   t   objectt   __new__t	   __class__R   R
   RE   t
   _getbyspecR:   t
   setdefaultR   RJ   RA   (   R   t   kwt   objRI   RF   RG   RH   t   pb(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   new   s&    
c   	      C   s#  g  } |  j  j |  j  } x| j d  D] } | j   } | d k ri | j |  j j | d    q+ | d k r | j | d  q+ | d } | j d  } | d k r | d } } n | |  | | } } | d k r | j |  q+ | d k r| j |  q+ t d	 |   q+ W| S(
   s   get specified parts of the path.  'arg' is a string
            with comma separated path parts. The parts are returned
            in exactly the order of the specification.

            you may specify the following parts:

            http://host.com/repo/path/file.ext
            |-----------------------|          dirname
                                      |------| basename
                                      |--|     purebasename
                                          |--| ext
        t   ,RI   iRF   R   t    RG   RH   s   Don't know part %r(   RA   R%   RJ   R#   R   R$   t   rfindt	   NameError(	   R   t   spect   rest   partst   nameRF   t   iRG   RH   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRN      s&     
c         C   s:   t  |   t  |  k o9 |  j | j k p9 |  j | j k S(   s3    return true if path and rev attributes each match (   R*   R
   (   R   t   other(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   __eq__   s    c         C   s   |  | k S(   N(    (   R   R]   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   __ne__   s    c         G   sp   | s
 |  St  g  | D] } | j |  j  ^ q  } |  j f | } |  j |  j j |  |  j |  j  } | S(   s    return a new Path (with the same revision) which is composed
            of the self Path followed by 'args' path components.
        (   t   tupleR#   RJ   RA   RM   R$   R
   RE   (   R   t   argst   argRZ   t   newpath(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR$      s    +'c         C   s   |  j  |  } | S(   s+    return the content of the given property. (   t   _propget(   R   R[   t   value(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   propget   s    c         C   s   |  j    } | S(   s    list all property names. (   t	   _proplist(   R   t   content(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR      s    c         C   s   |  j    j S(   s2    Return the size of the file content of the Path. (   R   t   size(   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRi      s    c         C   s   |  j    j S(   s0    Return the last modification time of the file. (   R   t   mtime(   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRj      s    c         C   s
   t  |  S(   N(   R/   (   R   t   cmd(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   _escape   s    t   Checkersc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s?   y |  j  j   j d k SWn t j j k
 r: |  j   SXd  S(   Nt   dir(   t   pathR   t   kindR    t   errort   Errort   _listdirworks(   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRn     s    c         C   s4   y |  j  j   Wn t j j k
 r+ t SXt Sd  S(   N(   Ro   t   listdirR    Rq   t   ENOENTR2   R1   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRs     s
    c         C   s9   y |  j  j   j d k SWn t j j k
 r4 t SXd  S(   NR6   (   Ro   R   Rp   R    Rq   Ru   R2   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR6   #  s    c         C   s6   y |  j  j   SWn t j j k
 r1 |  j   SXd  S(   N(   Ro   R   R    Rq   Ru   Rs   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   exists)  s    (   R   R   Rn   Rs   R6   Rv   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRm     s   			N(   R   R   R   RJ   RB   t   propertyR   R	   R   RD   RS   RN   R^   R_   R$   Rf   R   Ri   Rj   Rl   R    Rm   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR@   {   s"   				"	$								c         C   sW   |  j  d  } | d k r. t d |    n  |  |  }  t j |  d  } t j |  S(   NR   is   could not parse %ss   %Y-%m-%dT%H:%M:%S(   RV   R:   R   t   strptimet   mktime(   t   timestrR\   t
   parsedtime(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   parse_apr_time/  s    
t   PropListDictc           B   s    e  Z d  Z d   Z d   Z RS(   sD    a Dictionary which fetches values (InfoSvnCommand instances) lazilyc         C   s6   t  j |  g  | D] } | d  f ^ q  | |  _ d  S(   N(   t   dictR   R   Ro   (   R   Ro   t   keynamest   x(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   9  s    )c         C   sJ   t  j |  |  } | d  k rF |  j j |  } t  j |  | |  n  | S(   N(   R~   t   __getitem__R   Ro   Rf   t   __setitem__(   R   t   keyRe   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   =  s
    (   R   R   R   R   R   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR}   7  s   	c           C   s   t  j d k r d Sd S(   NR   s	   LC_ALL=C RU   (   R+   R,   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt	   fixlocaleD  s    s   * | \ / : < > ? 	 
   t    s   ^([a-z]\:\\)?[^:]+$c         C   s   t  } |  j } t rD | j d  t j |  sD t d   qD n  x? | D]7 } | t j k sl | | k rK t d | f   qK qK Wd  S(   NR   s    path may not contain a colon (:)s   illegal character %r in path(	   t   ILLEGAL_CHARSRA   t	   ISWINDOWSt   removet   _reg_allow_diskt   matchR:   t   stringt	   printable(   Ro   t   illegalt   spt   char(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   _check_pathO  s    	c         C   sX   t  |   |  j } | r> |  j d k r> d | |  j f } n | rT d | f } n  | S(   Nis   %s@%ss   %s@HEAD(   R   RA   R
   (   Ro   t   addatR   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   path_to_fspathZ  s    
	c         C   s   t  |  t  } d d l m } t r t j |  } | j d d  } | j d  r d | j d  j d d  | | t	 | j d    f } q | |  } n | |  } |  j
 d k r d | |  j
 f } n d | f } d	 | f S(
   Ni(   t   quotes   \R7   i   s   /%s%ss   %s@%ss   %s@HEADs	   file://%s(   R   R2   t   urllibR   R   R   R   R-   t   groupt   lenR
   (   Ro   t   fspathR   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   url_from_pathc  s    &t   SvnAuthc           B   s/   e  Z d  Z e e d  Z d   Z d   Z RS(   s/    container for auth information for Subversion c         C   s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   t   usernamet   passwordt
   cache_autht   interactive(   R   R   R   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   x  s    			c         C   s   |  j  j d d  } |  j j d d  } g  } | rM | j d | f  n  | rj | j d | f  n  |  j s | j d  n  |  j s | j d  n  d j |  S(   Nt   "s   \"s   --username="%s"s   --password="%s"s   --no-auth-caches   --non-interactiveR   (   R   R-   R   R   R   R   R$   (   R   t   unamet   passwdt   ret(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   makecmdoptions~  s    		c         C   s   d |  j  f S(   Ns   <SvnAuth username=%s ...>(   R   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    (   R   R   R   R1   R   R   R   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   v  s   	s   \s*(\d+)\s*(\S+) (.*)t   SvnWCCommandPathc           B   sp  e  Z d  Z e j Z d< d< d  Z e d   d< d< d  Z e d   d< d< d  Z	 d   Z
 d   Z e e d< d< d  Z d	   Z d
   Z d   Z d   Z d   Z d   Z d< d  Z d   Z d   Z d< d< d  Z d e d  Z d d  Z d   Z d   Z d   Z d   Z d   Z d d d  Z d   Z  d   Z! d    Z" d!   Z# d"   Z$ d# d# d# d$  Z% d< d%  Z& d&   Z' e( j) d' e( j*  Z+ d( d d)  Z, d*   Z- d+   Z. d,   Z/ d# d-  Z0 d# d.  Z1 d/   Z2 d0   Z3 d d1  Z4 d< d< d2  Z5 d3 d4  Z6 d5   Z7 d6 e8 j9 j: j; f d7     YZ; d< d e< d8  Z= d9   Z> d:   Z? d;   Z@ RS(=   s    path implementation offering access/modification to svn working copies.
        It has methods similar to the functions in os.path and similar to the
        commands of the svn client.
    c         C   s   t  j |   } t | |   r= | j |  k r1 | S| j } n  t t |  t  rh t d | f   n  t	 j
 j |  | _ | | _ | S(   Ns   bad char in wcpath %s(   RK   RL   t
   isinstanceRM   t	   localpathR5   R*   R9   R:   R    Ro   t   localRE   (   t   clst   wcpathRE   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRL     s    		c         C   s   t  |  j  S(   N(   R*   R   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   <lambda>  s    s   string pathc         C   s   |  j  d d  j S(   Nt   usecachei    (   R   R
   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    t   revisionc         C   s   |  j  t | d d   k S(   NR   (   R   t   getattrR   (   R   R]   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR^     s    c         C   sX   t  |  d d   d  k r3 |  j   } | j |  _ n  t |  j t j j  sQ t	  |  j S(   Nt   _url(
   R   R   R   R	   R   R   R    t   builtint   _basestringt   AssertionError(   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRB     s
    s   url of this WC itemc         C   s
   t  |  S(   N(   R/   (   R   Rk   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRl     s    c         C   s   |  j  j |  S(   s!    pickle object into path location(   R   t   dump(   R   RQ   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    c         C   s   |  j    } t j j | j  S(   s*    return current SvnPath for this WC-item. (   R   R    Ro   t   svnurlR	   (   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    c         C   s   d |  j  S(   Ns	   svnwc(%r)(   RA   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   __repr__  s    c         C   s   t  |  j  S(   N(   R*   R   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    c         C   s    |  j  d  k r d S|  j  j   S(   NRU   (   RE   R   R   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   _makeauthoptions  s    c         C   s;   | r t  |  p g  } | j |  j    |  j | |  S(   N(   t   listR   R   t   _svn(   R   Rk   Ra   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   _authsvn  s    c         G   s  d | g } g  | D] } |  j  |  ^ q } | j |  | j d |  j  |  j   t   d j |  } yc z; d } t j j |  } d t j | <t	 j
 j |  } Wd  | r | t j | <n
 t j | =XWn t	 j
 j j k
 rt j   d }	 |	 j j   }
 |
 j d  d k r4t	 j j |    n* |
 j d	  d k r^t	 j j |    n  |
 j d
  d k s|
 j d  d k s|
 j d  d k s|
 j d  d k rt	 j j |
   n    n X| S(   Ns   svn %ss   "%s"R   t   LC_MESSAGESt   Ci   s	   not foundis   E200009:s   file existss   file already existss   w150002:s   can't create directory(   Rl   t   extendR   RA   R   R$   t   ost   environR   R    R!   R"   Rr   R+   t   exc_infot   errt   lowert   findRq   Ru   t   EEXIST(   R   Rk   Ra   t   lt   itemR   R   t   holdt   outt   et   strerr(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s8    "c         C   s   |  j  d | g  d S(   s    switch to given URL. t   switchN(   R   (   R   R	   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    c         C   s   g  } | d k r |  j } n  | d k s6 | d k rd t j d k r t   d k r | d 7} q n7 t   d k r | d | 7} n | j d t |   | j |  |  j d |  d S(	   s$    checkout from url to local wcpath. iR   s   1.3s   @HEADs   @%ds   -rt   coN(   R   R	   R+   R,   R(   R   R*   R   (   R   R	   R
   Ra   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   checkout  s    t   HEADc         C   s6   d | g } | s" | j  d  n  |  j d |  d S(   s=    update working copy item to given revision. (None -> HEAD). s   -rs   --non-interactivet   upN(   R   R   (   R   R
   R   t   opts(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   update  s    t   wc         C   s   |  j  j | |  d S(   s)    write content into local filesystem wc. N(   R   t   write(   R   Rh   t   mode(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    c         G   s"   |  j  |  j j |   d |  j S(   s0    return the directory Path of the current Path. RE   (   RM   R   t   dirpathRE   (   R   Ra   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    c         C   sN   |  j    } | j d d  r+ | j   n  |  j d d  rJ |  j   n  |  S(   NRn   i    (   R   t   checkt   _ensuredirst   mkdir(   R   t   parent(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    c         O   s   |  j  |   } | j   r> | j d t  r: | j   n  | S| j d d  rZ | j   S| j   } | j   | j d  | j   | S(   s    ensure that an args-joined path exists (by default as
            a file). if you specify a keyword argument 'directory=True'
            then the path is forced  to be a directory path.
        t	   versionedRn   i    RU   (   R$   R   R2   t   addR   R   R   R   (   R   Ra   t   kwargst   pR   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   ensure  s    


c         G   s.   | r |  j  |   j   S|  j d  |  Sd S(   s1    create & return the directory joined with args. R   N(   R$   R   R   (   R   Ra   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   /  s    c         C   s   |  j  d  d S(   s    add ourself to svn R   N(   R   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   7  s    i   c         C   sn   | s t  d   |  j d t  s> t j j |   j   d Sg  } | rZ | j d  n  |  j d |  d S(   s    remove a file or a directory tree. 'rec'ursive is
            ignored and considered always true (because of
            underlying svn semantics.
        s!   svn cannot remove non-recursivelyR   Ns   --forceR   (	   R   R   R1   R    Ro   R   R   R   R   (   R   t   rect   forcet   flags(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   ;  s    c         C   s*   t  j j d t |   t |  f  d S(   s    copy path to target.s   svn copy %s %sN(   R    R!   R"   R*   (   R   t   target(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   copyJ  s    c         C   s*   t  j j d t |   t |  f  d S(   s    rename this path to target. s   svn move --force %s %sN(   R    R!   R"   R*   (   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   renameN  s    c         C   s.   |  j  d  j   } | s* t d   n  d S(   s(    set a lock (exclusive) on the resource t   locks!   unknown error in svn lock commandN(   R   R#   R:   (   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   R  s    c         C   s;   |  j  d  j   } | j d  r7 t | d   n  d S(   s    unset a previously set lock t   unlocks   svn:i   N(   R   R#   R   t	   Exception(   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   Y  s    c         C   s   y |  j    Wn n Xd S(   s$    remove any locks from the resource N(   R   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   cleanup`  s    i    c         C   s   | r t  d   n d } | r* d } n d } | r? d } n d } y& d | | | f } |  j |  } WnT t j j j k
 r d | | | f } |  j |  } t |   j | |   } n Xt |   j | |   } | S(   s2    return (collective) Status object for this file. s1   XXX cannot perform status() on external items yetRU   s   --non-recursives   -us$   status -v --xml --no-ignore %s %s %ss   status -v --no-ignore %s %s %s(	   R:   R   R    R!   R"   Rr   t   WCStatust
   fromstringt   XMLWCStatus(   R   t   updatesR   t	   externalsRk   R   t
   rootstatus(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   statush  s(    		c         C   s<   g  } | d k	 r& | j d |  n  |  j d |  } | S(   sj    return a diff of the current path against revision rev (defaulting
            to the last one).
        s   -r %dt   diffN(   R   R   R   (   R   R
   Ra   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s
    c         C   s   |  j  d  } g  } | j   } t j j |  j  j   } x t t | |   D]n \ } \ } } t	 j
 |  } | s t d | f   n  | j   \ }	 }
 } | j t |	  |
 | f  qR W| S(   s[    return a list of tuples of three elements:
            (revision, commiter, line)
        t   blames:   output line %r of svn blame does not match expected format(   R   t
   splitlinesR    Ro   R   R	   t	   readlinest	   enumeratet   zipt	   rex_blameR   R:   t   groupsR   t   int(   R   R   t   resultt
   blamelinest	   reallinesR\   t	   blamelinet   linet   mR
   R[   t   _(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    " s   .*Committed revision (\d+)\.$RU   c         C   s   d | j  d d  f } | s, | d 7} n  |  j |  } y t j |  =Wn t k
 r\ n X| r |  j j |  } t | j d   Sd S(   s/    commit with support for non-recursive commits s   commit -m "%s" --force-logR   s   \"s    -Ni   N(	   R-   R   R   R   t   KeyErrort   _rex_commitR   R   R   (   R   t   msgR   Rk   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   commit  s    c         G   sc   t  j j j   } z? | j d  } | j |  |  j d | d t |  |  Wd | j   Xd S(   s*    set property name to value on this path. Re   t   propsets   --fileN(	   R    Ro   R   t   mkdtempR$   R   R   R*   R   (   R   R[   Re   Ra   t   dR   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR    s    #c         C   s   |  j  d |  } | d  S(   s!    get property name on this path. Rf   i(   R   (   R   R[   RY   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRf     s    c         C   s   |  j  d |  } | d  S(   s$    delete property name on this path. t   propdeli(   R   (   R   R[   RY   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR    s    c         C   st   | r" |  j  d  } t |  |  S|  j  d  } | j d  } g  | d D] } | j   ^ qK } t |  |  Sd S(   s    return a mapping of property names to property values.
If rec is True, then return a dictionary mapping sub-paths to such mappings.
s   proplist -RR   s   
i   N(   R   t   make_recursive_propdictR%   R#   R}   (   R   R   RY   t   linesR   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    #c         C   s+   | r |  j  d  } n |  j  d  } | S(   sK    revert the local changes of this path. if rec is True, do so
recursively. s	   revert -Rt   revert(   R   (   R   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR    s    c         K   s:   | r |  j  j |   } n	 |  j  } |  j | d |  j S(   s   create a modified version of this path. A 'rev' argument
            indicates a new revision.
            the following keyword arguments modify various path parts:

              http://host.com/repo/path/file.ext
              |-----------------------|          dirname
                                        |------| basename
                                        |--|     purebasename
                                            |--| ext
        RE   (   R   RS   RM   RE   (   R   RP   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRS     s    	c         O   s5   | s
 |  S|  j  j | |   } |  j | d |  j S(   s    return a new Path (with the same revision) which is composed
            of the self Path followed by 'args' path components.
        RE   (   R   R$   RM   RE   (   R   Ra   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR$     s    c         C   s|  | o t  j j |   } | sxy |  j d  } Wn t j j j k
 r t j	   d } | j
 j d  d k r t j j |  | j
   n3 | j
 j d  d k r t j j |  | j
   n    n X| j   d k s | j   j d  d k rt j j |  |   n  t |  } t j d k rh| j |  j k rht j j |  d	 d
 | j |  j f   qhn  | t  j |  <n  | S(   s9    return an Info structure with svn-provided information. R   i   s$   Path is not a working copy directoryis   is not under version controlRU   s   not a versioned resourceR   s   not a versioned resource:s	    %s != %s(   R   R   R   R   R    R!   R"   Rr   R+   R   R   R   Rq   Ru   R#   R   t   InfoSvnWCCommandR,   Ro   R   (   R   R   R   t   outputR   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s*     c         C   s   t  | t  r! t j |  } n  d   } g  } xa |  j j |  D]M } |  j | d |  j } | |  rC | s | |  rC | j |  qC qC W|  j	 | |  | S(   s    return a sequence of Paths.

        listdir will return either a tuple or a list of paths
        depending on implementation choices.
        c         S   s   |  j  d k S(   Ns   .svn(   RF   (   Ro   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   notsvn$  s    RE   (
   R   R*   R    t	   FNMatcherR   Rt   RM   RE   R   t	   _sortlist(   R   t   filt   sortR
  t   pathsR   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRt     s    	t   rc         C   s   t  |  j |  S(   s,    return an opened file with the given mode. (   t   openRA   (   R   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR  /  s    c         C   s   |  j  j |  S(   N(   R   RN   (   R   RX   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRN   3  s    Rm   c           B   s   e  Z d    Z d   Z RS(   c         C   s   | |  _  | j |  _ d  S(   N(   t	   svnwcpathR   Ro   (   R   Ro   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   7  s    	c         C   s   y |  j  j   } Wn t j j t j j f k
 r9 t St j j j	 k
 r t
 j   d } | j j d  d k r{ t S| j j   j d  d k r t S  n Xt Sd  S(   Ni   s   is not a working copyis   not a versioned resource(   R  R   R    Rq   Ru   R   R2   R!   R"   Rr   R+   R   R   R   R   R1   (   R   t   sR   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   :  s    (   R   R   R   R   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRm   6  s   	c         C   s  |  j    s t  | d k r$ d p' | } | d k r< d p? | } | d k rc | d k rc d } n d | | f } | r d p d } t   } |  j   } | d | | | |  j f } t j | d t j d t j d	 t	 }	 |	 j
   \ }
 } t j j |
 t j    }
 t   \ } } y | j |
  } Wn | k
 rLt d
   n Xg  } xE t d | j j  D]. } | j | j k ri| j t |   qiqiW| S(   s    return a list of LogEntry instances for this path.
rev_start is the starting revision (defaulting to the first one).
rev_end is the last revision (defaulting to HEAD).
if verbose is True, then the LogEntry instances also know which files changed.
R   i   RU   s   -r %s:%ss   -vs   svn log --xml %s %s %s "%s"t   stdoutt   stderrt   shells   no such revisionN(   R   R   R   R   R   RA   t
   subprocesst   Popent   PIPER1   t   communicateR    R   t   _totextR+   t   getdefaultencodingt	   importxmlt   parseStringR:   t   filtert
   firstChildt
   childNodest   nodeTypet   ELEMENT_NODER   t   LogEntry(   R   t	   rev_startt   rev_endt   verboset   rev_optt   verbose_optt
   locale_envt   auth_optRk   t   popenR  R  t   minidomt
   ExpatErrort   treeR   t   logentry(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   logI  s6    					c         C   s   |  j    j S(   s2    Return the size of the file content of the Path. (   R   Ri   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRi   s  s    c         C   s   |  j    j S(   s0    Return the last modification time of the file. (   R   Rj   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRj   w  s    c         C   s   t  |  j |  j |  j f  S(   N(   RC   RA   RM   RE   (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyRD   {  s    N(A   R   R   R   R   RJ   R   RL   Rw   RA   R
   R^   RB   R	   Rl   R   R   R   R   R   R   R   R   R   R1   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   ret   compilet   DOTALLR   R   R  Rf   R  R   R  RS   R$   R   Rt   R  RN   R    Ro   R   Rm   R2   R1  Ri   Rj   RD   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     sh   										!											&
		
							*		R   c           B   sY   e  Z d Z d d d d  Z e d  Z e j d  Z	 d d d d  Z
 e e
  Z
 RS(   t   modifiedt   addedt   conflictt	   unchangedt   externalt   deletedt   prop_modifiedt   unknownt   update_availablet
   incompletet   kindmismatcht   ignoredt   lockedt   replacedc         C   sL   | |  _  | |  _ | |  _ | |  _ x! |  j D] } t |  | g   q. Wd  S(   N(   R   R
   t   modrevt   authort	   attrnamest   setattr(   R   R   R
   RC  RD  R[   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    				c         K   sz   i  } xN |  j  D]C } | | k s, | | r x$ t |  |  D] } d | | <q< Wq q W| j   } | rv | j   n  | S(   Ni   (   RE  R   t   keysR  (   R   R  RP   R  R[   Ro   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   allpath  s    s$   \s+(\d+|-)\s+(\S+)\s+(.+?)\s{2,}(.*)c      	   C   s-  t  | | | |  } d } x|  j d  D]} | j   sC q+ n  | d  | d } }	 | \ }
 } } } } } } } |
 d k rO| j d d  d } |
 d k r | j | d d } | j j |  q+ |
 d k r| j | j j | d d d | j	 } | j
 j |  q+ |
 d	 k r+ | j | d d } | j j |  q+ q+ n  t  j j |	  } | s| d
 k r|	 j   } | j | d d } | j j |  q+ n  | j   j d  d k rt |	 j d  d j    } q+ n  | j   j d  d k rq+ n  t d |   n | j   \ } } } } | j | d d } |
 d k r| j d d  sut d   | j j |  n |
 d k s| d k r| j j |  n |
 d k r| j j |  n |
 d k r| j j |  n |
 d k r| j j |  nm |
 d k r/| j j |  nN |
 d k rN| j j |  n/ |
 j   sm| j j |  n t d |
   | d k r| j j |  n  | d k s| d k r| j  j |  n  | d
 k r| j j |  n  | | k r+ | | _! | | _" | | _# | r+ | | _$ q+ q+ q+ q+ W| S(   s4    return a new WCStatus object from data 's'
        s   
i   s   ?XIi   t   ?t   abst   XRE   t   It   *s   against revision:iR   s   status on externals   could not parse line %rt   MR6   s3   didn't expect a directory with changed content heret   At   +t   DR   t   ~t   !t   Rs   received flag %rt   Lt   KN(%   R   R   R%   R#   R$   R<  R   RM   R   RE   R9  R@  t   _rex_statusR   R=  R   R   R   R:   R   R   R   R5  R6  R:  R7  R?  R>  RB  R8  t   NotImplementedErrorR;  RA  R
   RC  RD  t
   update_rev(   t   datat
   rootwcpathR
   RC  RD  R   RY  R   R   t   restt   c0t   c1t   c2t   c3t   c4t   c5t   x6t   c7t   fnR   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    			
(   R5  R6  R7  R8  R9  R:  R;  R<  R=  R>  R?  R@  RA  RB  N(   R   R   RE  R   R   R1   RH  R2  R3  RW  R   t   staticmethod(    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s     	]R   c           B   s&   e  Z d d d d   Z e e  Z RS(   c         C   s<  t  | | | |  } d$ } t   \ } } y | j |   }	 Wn3 | k
 rr t j   d }
 t t |
    n X|	 j d  } | r | d j	 d  | _
 n  x|	 j d  D]} | j	 d  } | j d  d } | j	 d	  } | d
 k r| j | d d } | j j |  q n | d k rk| j | j j | d d d | j } | j j |  q nn | d k r| j | d d } | j j |  q n7 | d k r| j | d d } | j j |  q n  | j	 d  } | d k s | d k rd } d } d } d } n | d k r*n | j d  d } | r| j	 d  } d } | j d  } | rx% | d j D] } | | j 7} q{Wn  d } x. | j d  d j D] } | | j 7} qWn  | j | d d } | d k s| j d d  st d   i d d 6d d
 6d d  6d d 6j | |  } t | |  } | j |  | j	 d!  } | d% k r| j j |  n  | | k r| | _ | | _ | | _ | | _ n  | j d"  } | r| d } | j	 d	  } | d& k r| j j |  qn  | j d#  } t  |  r | j! j |  q q W| S('   sL    parse 'data' (XML string as outputted by svn st) into a status obj
        i   t   againstiR   R   Ro   s	   wc-statusi    R   t   unversionedRJ  R9  RE   R@  R>  R6  t   nonet   0RI  RU   RB  R   RD  t   dateR5  R6   s2   did't expect a directory with changed content hereR8  t   normalR<  R7  t
   conflictedt   propss   repos-statusR   N(   Ri  Rl  (   R6  R5  ("   R   R   R  R  R+   R   R:   R*   t   getElementsByTagNamet   getAttributeRY  R$   R<  R   RM   R   RE   R9  R@  R>  R!  t	   nodeValueR   R   R   R   R;  R
   RC  RD  Rk  R=  R   RA  (   RZ  R[  R
   RC  RD  R   RY  R-  R.  t   docR   t   urevelst   entryelRo   t   statuselt
   itemstatusR   Rk  t   commitelt
   author_elsR4   t   itemattrnamet   attrt   propsstatust
   rstatuselst	   rstatuselt   ritemstatust   lockels(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    		!	
			
N(   R   R   R   R   Rf  (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s   iR  c           B   s   e  Z d    Z d   Z RS(   c         C   s  i  } xo | j  d  D]^ } | j   s. q n  | j  d d  \ } } | j   j d d  } | j   } | | | <q Wy | d |  _ Wn t k
 r t d   n X| d d	 k r d
 p | d |  _ y t | d  |  _	 Wn t k
 r d  |  _	 n Xt j j | d  |  _ |  j j   |  _ d | k rMt | d  |  _ n  d | k ri| d |  _ n  d | k rt | d  |  _ |  j d |  _ n  d  S(   Ns   
R   i   R   RU   R	   s   Not a versioned resourcet   nodekindt	   directoryRn   R   Ro   t   lastchangedrevt   lastchangedauthort   lastchangeddatei@B (   R%   R#   R   R-   R	   R   R:   Rp   R   R
   R   R    Ro   R   Ri   t   created_revt   last_authort   parse_wcinfotimeRj   R   (   R   R	  R  R   R   Re   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR   j  s4    #c         C   s   |  j  | j  k S(   N(   t   __dict__(   R   R]   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR^     s    (   R   R   R   R^   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR  i  s   	)c         C   s\   t  j d |   } | s+ t d |    n  | j   \ }  } t j |  d  } t j |  S(   s#    Returns seconds since epoch, UTC. s&   (\d+-\d+-\d+ \d+:\d+:\d+) ([+-]\d+) .*s   timestring %r does not matchs   %Y-%m-%d %H:%M:%S(   R2  R   R:   R   R   Rx   t   calendart   timegm(   Rz   R   t   timezoneR{   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR    s    s   Properties on '(.*)':c         C   s  g  | j  d  D] } | r | ^ q } i  } x | r| j d  } | j |  } | sn t d |   n  | j   d } |  j | d d }	 g  }
 x? | r | d j d  r | j d  j   } |
 j |  q W|
 s t	 d   t
 |	 |
  | |	 <q1 W| S(   s5    Return a dictionary of path->PropListDict mappings. s   
i    s    could not parse propget-line: %rRJ  i   s     s   must have found properties!(   R%   t   popR   R:   R   R$   R   R#   R   R   R}   (   t   wcrootR	  t   rexR   R  t   pdictR   R   Ro   R   t	   propnamest   propname(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR    s     (	c         C   sA   |  r
 |  Sd d l  m } d d l m } |  j | | g  |  S(   Ni(   R-  (   R.  (   t   xml.domR-  t   xml.parsers.expatR.  R   (   R   R-  R.  (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR    s    R$  c           B   s   e  Z d    Z d   Z RS(   c         C   s5  t  | j d   |  _ xt d  | j  D]} | j | j k r+ | j d k rd | j	 j
 |  _ q-| j d k r | j	 r | j	 j
 |  _ q*d |  _ q-| j d k r | j	 j
 } t |  |  _ q-| j d k r-g  |  _ xH t d  | j  D]1 } | j | j k r |  j j t |   q q Wq-q+ q+ Wd  S(   NR   RD  R   RU   Rk  R  (   R   Rp  R
   R  R   R!  R"  R#  t   nodeNameR   Rq  RD  R   R|   Rk  t   strpathsR   t	   PathEntry(   R   R0  t   lpartRz   t   ppart(    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s"    		c         C   s   d |  j  |  j |  j f S(   Ns#   <Logentry rev=%d author=%s date=%s>(   R
   RD  Rk  (   R   (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR     s    (   R   R   R   R   (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyR$    s   	(2   R   R   R+   R   R2  R  R    R  t   py._pathR    R   R   R   t   repositoriesR9   R,   R8   R(   R/   R5   R?   t   PathBaseR@   R|   R~   R}   R   R%   R   RJ   R   R   R3  RL  R   R   R1   R   R   RK   R   R   R   R   R   R  R  R  R  R$  (    (    (    s-   lib/python2.7/site-packages/py/_path/svnwc.pyt   <module>   sN   <		(	

								 ~l-	