3 gt`g@s|ddlmZddlmZddlZddlZddlZddlmZm Z m Z ddl Z ddl Z ddZ e jjGddde jjZdS) )absolute_import)unicode_literalsN)_P_loggerc CsDytjj|ddStttfk r>tjtdj |YnXdS)NT)ZfuzzyzNot a valid date: "{0}".) dateutilparserparse ValueError TypeError OverflowErrorargparseZArgumentTypeErrorrformat)valr/usr/lib/python3.6/changelog.py validate_date!src@sLeZdZdZedZeddZddZddZ d d Z d d Z d dZ dS)ChangelogCommand changelogzShow changelog data of packagescCsd|j}|jdddttdd|jddttdd|jdd d td d |jd dtdddS)Nz--sinceZDATEzZshow changelog entries since DATE. To avoid ambiguosity, YYYY-MM-DD format is recommended.)metavardefaulttypehelpz--countz2show given number of changelog entries per package)rrrz --upgradesF store_truezmshow only new changelog entries for packages, that provide an upgrade for some of already installed packages.)ractionrpackage*ZPACKAGE)nargsr)Zadd_mutually_exclusive_group add_argumentrrint)rZ filter_grouprrr set_argparser-s   zChangelogCommand.set_argparsercCs|jj}d|_d|_d|_dS)NT)clidemandsZavailable_reposZsack_activation changelogs)selfr"rrr configure>szChangelogCommand.configurecCs|jjj}|jjr|jddx|jjD]d}tjj|ddj |jjdddd}|jj rh|j|jj d|r||j |j }q*t jtd|q*Wn|jj r|j|jj d|jjr|j}n|j}|S)NT)empty)Z ignore_caseF)Z with_nevraZ with_providesZwith_filenames)ZreponamezNo match for argument: %s)baseZsackqueryoptsrZfiltermdnfZsubjectZSubjectZget_best_queryZrepounionZlatestrinforupgradesZ available)r$qpkgZpkg_qrrrr(Ds$    zChangelogCommand.querycCs>tj}x0t|D]$}|j|jp$|j|jfgj|qW|S)N) collections OrderedDictsorted setdefaultZ source_namenameZevrappend)r$Zpackagesby_srpmr/rrrr6Zs$zChangelogCommand.by_srpmcsTjjrjj|Sjjr.|jdjjSjjrJfdd|jDS|jSdS)Ncs$g|]}|djjjkr|qS)Z timestamp)r)sinceZdate).0chlog)r$rr fsz6ChangelogCommand.filter_changelogs..)r)r-r'Zlatest_changelogscountr#r7)r$rr)r$rfilter_changelogs`s z"ChangelogCommand.filter_changelogscCs|jjr"tjtdj|jjnP|jjrLtjtdd|jjj|jjn&|jjrdtjtdntjtd|j |j }xb|D]Z}t tdjdj t dd ||Dx*|j||d D]}t |jj|qWqWdS) NzListing changelogs since {}zListing only latest changelogzListing {} latest changelogszBListing only new changelogs since installed version of the packagezListing all changelogszChangelogs for {}z, cSsh|] }t|qSr)str)r8r/rrr {sz'ChangelogCommand.run..r)r)r7rr,rrr;rr-r6r(printjoinr2r<r'Zformat_changelog)r$r6r4r9rrrrunks     zChangelogCommand.runN)r) __name__ __module__ __qualname__aliasesrZsummary staticmethodr r%r(r6r<rArrrrr(s  r)Z __future__rrr r0Zdateutil.parserrZdnfpluginscorerrrr*Zdnf.clirZpluginZregister_commandr!ZCommandrrrrrs