§
    ôc  ã                   ó°   — 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mZm	Z	m
Z
 d dlmZmZ  ej        e¦  «        ZdZdez   Z	 	 dd„Zd„ Z	 	 	 dd	„Z	 	 dd
„ZdS )é    N)ÚenvironmentÚfeatureÚflagsÚrlist)Úexecute_commandÚ"execute_command_and_capture_output)ÚprefixÚmatch_archivesÚsort_byÚfirstÚlast)Ú
repositoryÚarchiveÚ
successfulÚpathsÚ
find_pathsÚborgc                 ó8  — |                      dd¦  «        }|dft                               ¦   «         t          j        k    r	|j        sdndz   t                               t          j        ¦  «        r	|j        sdndz   t          j	        d|¦  «        z   t          j	        d|¦  «        z   t          j
        |t          ¬	¦  «        z   |j        rt          j        | |j        |¦  «        nt          j        | |¦  «        z   |j        rt!          |j        ¦  «        ndz   S )
zÝ
    Given a local or remote repository path, a storage config dict, the arguments to the list
    action, and local and remote Borg paths, return a command as a tuple to list archives or paths
    within an archive.
    Ú	lock_waitNÚlist)z--info© )z--debugz	--show-rczremote-pathz	lock-wait)Úexcludes)ÚgetÚloggerÚgetEffectiveLevelÚloggingÚINFOÚjsonÚisEnabledForÚDEBUGr   Ú
make_flagsÚmake_flags_from_argumentsÚMAKE_FLAGS_EXCLUDESr   Úmake_repository_archive_flagsÚmake_repository_flagsr   Útuple)r   Ústorage_configÚlocal_borg_versionÚlist_argumentsÚ
local_pathÚremote_pathr   s          ú5/usr/lib/python3/dist-packages/borgmatic/borg/list.pyÚmake_list_commandr-      s?  € ð ×"Ò" ;°Ñ5Ô5€Ið 
�VÐõ ×'Ò'Ñ)Ô)­W¬\Ò9Ð9À.ÔBUÐ9ð ˆKàñ		
õ ×"Ò"¥7¤=Ñ1Ô1ðØ:HÔ:MðÐ$Ð$àñ
	
õ Ô
˜=¨+Ñ
6Ô
6ñ	7õ Ô
˜;¨	Ñ
2Ô
2ñ	3õ Ô
)¨.ÕCVÐ
WÑ
WÔ
Wñ	Xð$ Ô%ðM�EÔ/Ø˜NÔ2Ð4Fñô ð õ Ô,¨ZÐ9KÑLÔLñ'	
ð* +9Ô*>ÐF�5�Ô%Ñ&Ô&Ð&ÀBñ+	Hðó    c                 ó<   — | sdS t          d„ | D ¦   «         ¦  «        S )aJ  
    Given a sequence of path fragments or patterns as passed to `--find`, transform all path
    fragments into glob patterns. Pass through existing patterns untouched.

    For example, given find_paths of:

      ['foo.txt', 'pp:root/somedir']

    ... transform that into:

      ['sh:**/*foo.txt*/**', 'pp:root/somedir']
    r   c              3   ót   K  — | ]3}t          j        d ¦  «                             |¦  «        r|nd|› d�V — Œ4dS )z([-!+RrPp] )|(\w\w:)zsh:**/*z*/**N)ÚreÚcompileÚmatch)Ú.0Ú	find_paths     r,   ú	<genexpr>z"make_find_paths.<locals>.<genexpr>P   sh   è è € ð ð ð õ Œ:Ð-Ñ.Ô.×4Ò4°YÑ?Ô?ð	'ˆ	ˆ	à&�yÐ&Ð&Ð&ðð ð ð ð ð r.   )r&   )r   s    r,   Úmake_find_pathsr7   @   sA   € ð ð Øˆråð ð ð $ð	ñ ô ñ ô ð r.   c                 ó  — t          j        |¦  «        }t          t          t	          | ||t          j        | |d|› �gddd¬¦  «        ||¦  «        |¬¦  «                             d¦  «                             d¦  «        ¦  «        S )a  
    Given a local or remote repository path, an archive name, a storage config dict, the local Borg
    version, the archive path in which to list files, and local and remote Borg paths, capture the
    output of listing that archive and return it as a list of file paths.
    zsh:Nz
{path}{NL})r   r   r   r   r   Úformat©Úextra_environmentú
)	r   Úmake_environmentr&   r   r-   ÚargparseÚ	NamespaceÚstripÚsplit)r   r   r'   r(   Ú	list_pathr*   r+   Úborg_environments           r,   Úcapture_archive_listingrD   X   s¦   € õ #Ô3°NÑCÔCÐåÝ*ÝØØØ"ÝÔ"Ø)Ø#Ø, Ð,Ð,Ð-Ø#ØØ'ðñ ô ð Øñô ð /ð!	
ñ 	
ô 	
÷$ 
Šˆt‰Œß	Šˆt‰Œñ)ô ð r.   c                 ó"  — t           j                             ¦   «          |j        s£|j        sœt          j        t
          j        j        |¦  «        rt           	                    d¦  «         t          j        | |j        |j        |j        |j        |j        |j        |j        |j        ¬¦	  «	        }t)          j        | |||||¦  «        S |j        rMt,          D ]E}t/          ||d¦  «        r2t           	                    d|                     dd¦  «        › d�¦  «         ŒF|j        rt3          d¦  «        ‚t5          j        |¦  «        }|j        r™|j        s’t          j        | d	dd|j        |j        |j        |j        |j        ¬¦	  «	        }t9          t;          t)          j        | |||||¦  «        |¬
¦  «                             d¦  «                              d¦  «        ¦  «        }	n|j        f}	|	D ]�}
t           !                    | › d|
› �¦  «         tE          j"        |¦  «        }|
|_        t,          D ]}tG          ||d¦  «         ŒtI          | |||||¦  «        tK          |j        ¦  «        z   }tM          |tN          j(        ||¬¦  «         ŒždS )aÊ  
    Given a local or remote repository path, a storage config dict, the local Borg version, the
    arguments to the list action, and local and remote Borg paths, display the output of listing
    the files of a Borg archive (or return JSON output). If list_arguments.find_paths are given,
    list the files by searching across multiple archives. If neither find_paths nor archive name
    are given, instead list the archives in the given repository.
    zpOmitting the --archive flag on the list action is deprecated when using Borg 2.x+. Use the rlist action instead.)	r   Úshortr9   r   r	   r
   r   r   r   NzThe --Ú_ú-zB flag on the list action is ignored when using the --archive flag.zZThe --json flag on the list action is not supported when using the --archive/--find flags.Tr:   r<   z: Listing archive )Úoutput_log_levelÚborg_local_pathr;   ))Ú	borgmaticr   Úadd_custom_log_levelsr   r   r   Ú	availableÚFeatureÚRLISTÚwarningr>   r?   rF   r9   r   r	   r
   r   r   r   r   Úlist_repositoryÚ#ARCHIVE_FILTER_FLAGS_MOVED_TO_RLISTÚgetattrÚreplaceÚ
ValueErrorr   r=   r&   r   Úmake_rlist_commandr@   rA   ÚanswerÚcopyÚsetattrr-   r7   r   r   ÚANSWER)r   r'   r(   r)   r*   r+   Úrlist_argumentsÚnamerC   Úarchive_linesr   Úarchive_argumentsÚmain_commands                r,   Úlist_archiver`   €   s  € õ Ô×*Ò*Ñ,Ô,Ð,àÔ!ð 
¨.Ô*Cð 
ÝÔ�Wœ_Ô2Ð4FÑGÔGð 	Ý�NŠNð Cñô ð õ #Ô,Ø!Ø Ô&Ø!Ô(ØÔ$Ø!Ô(Ø)Ô8Ø"Ô*Ø Ô&ØÔ$ð

ñ 

ô 

ˆõ Ô$Ø˜Ð(:¸OÈZÐYdñ
ô 
ð 	
ð Ôð Ý7ð 	ð 	ˆDÝ�~ t¨TÑ2Ô2ð Ý—’Øw˜TŸ\š\¨#¨sÑ3Ô3ÐwÐwÐwñô ð øð Ôð 
ÝØhñ
ô 
ð 	
õ #Ô3°NÑCÔCÐð Ô ð 2¨Ô)?ð 2Ý"Ô,Ø!ØØØØ!Ô(Ø)Ô8Ø"Ô*Ø Ô&ØÔ$ð

ñ 

ô 

ˆõ Ý.ÝÔ(ØØ"Ø&Ø#ØØñô ð #3ð
ñ 
ô 
÷ ŠU�4‰[Œ[ßŠU�4‰[Œ[ñ
ô 
ˆˆð  (Ô/Ð1ˆð !ð 
ð 
ˆÝ�Š˜Ð@Ð@°wÐ@Ð@ÑAÔAÐAå œI nÑ5Ô5ÐØ$+ÐÔ!õ 8ð 	3ð 	3ˆDÝÐ% t¨TÑ2Ô2Ð2Ð2å(ØØØØØØñ
ô 
õ ˜NÔ5Ñ6Ô6ñ7ˆõ 	ØÝ$œ^Ø&Ø.ð		
ñ 	
ô 	
ð 	
ð 	
ð)
ð 
r.   )r   N)Nr   N)r>   rX   r   r1   Úborgmatic.loggerrK   Úborgmatic.borgr   r   r   r   Úborgmatic.executer   r   Ú	getLoggerÚ__name__r   rR   r#   r-   r7   rD   r`   r   r.   r,   ú<module>rf      s  ðØ €€€Ø €€€Ø €€€Ø 	€	€	€	à Ð Ð Ð Ø =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø QÐ QÐ QÐ QÐ QÐ QÐ QÐ Qà	ˆÔ	˜8Ñ	$Ô	$€ð '_Ð #ðð (ñ(Ð ð Øð&ð &ð &ð &ðRð ð ð: ØØð%ð %ð %ð %ðZ Øðp
ð p
ð p
ð p
ð p
ð p
r.   