\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@s7dZddlmZddlZddlZddlZddlZddlmZddl m Z m Z ddl m Z mZmZmZmZmZmZmZmZddlmZmZiZejeZiZejeZedd d d d eed dd dd edZdZ dZ!ddgededfddgededfddd ededfd ddedfgej"ej#Z$eddd d ed!ed"fge$ed#d$ej%d%ed&Z&d'e'fd(YZ(d)Z)e(gZ*dS(*scommand to allow external programs to compare revisions The extdiff Mercurial extension allows you to use external programs to compare revisions, or revision with working directory. The external diff programs are called with a configurable set of options and two non-option arguments: paths to directories containing snapshots of files to compare. If there is more than one file being compared and the "child" revision is the working directory, any modifications made in the external diff program will be copied back to the working directory from the temporary directory. The extdiff extension also allows you to configure new diff commands, so you do not need to type :hg:`extdiff -p kdiff3` always. :: [extdiff] # add new command that runs GNU diff(1) in 'context diff' mode cdiff = gdiff -Nprc5 ## or the old way: #cmd.cdiff = gdiff #opts.cdiff = -Nprc5 # add new command called meld, runs meld (no need to name twice). If # the meld executable is not available, the meld tool in [merge-tools] # will be used, if available meld = # add new command called vimdiff, runs gvimdiff with DirDiff plugin # (see http://www.vim.org/scripts/script.php?script_id=102) Non # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in # your .vimrc vimdiff = gvim -f "+next" \ "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" Tool arguments can include variables that are expanded at runtime:: $parent1, $plabel1 - filename, descriptive label of first parent $child, $clabel - filename, descriptive label of child revision $parent2, $plabel2 - filename, descriptive label of second parent $root - repository root $parent is an alias for $parent1. The extdiff extension will look in your [diff-tools] and [merge-tools] sections for diff tool arguments, when none are specified in [extdiff]. :: [extdiff] kdiff3 = [diff-tools] kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child You can use -I/-X and list of file or directory names like normal :hg:`diff` command. The extdiff extension makes snapshots of only needed files, so running the external diff program will actually be pretty fast (at least faster than having to compare the entire tree). i(tabsolute_importN(t_(tnullidtshort( tarchivaltcmdutilterrort filemerget formattertpycompatt registrartscmutiltutil(tprocutilt stringutiltextdiffsopts\..*tdefaultttgenerics diff-toolss .*\.diffargs$sships-with-hg-corec C@stjj|j}|dkr*d}n|d k rOd|t|f}ntjj||}tj|g}|d k r|jt dt |t|fn|jt dt ||r|j j ddt tj|||dd tj||d |xt|D]r} tj| } |jd | |d kr#tjj|| } |j| |j| tj| fq#q#Wn||fS( ssnapshot files as of some revision if not using snapshot, -I/-X does not work and recursive diff in tools like kdiff3 and meld displays too many files.Rtroots%s.%ss(making snapshot of %d files from rev %s s3making snapshot of %d files from working directory tuit archivemetatfilestmatchfntsubreposs %s N(tostpathtbasenameRtNoneRtjointmkdirtnoteRtlenRt setconfigtFalseRtarchiveR t matchfilestsortedR tpconverttappendtwjointlstat( RtrepoRtnodettmproott listsubrepostdirnametbaset fnsandstattfntwfntdest((s3/usr/lib64/python2.7/site-packages/hgext/extdiff.pytsnapshotvs2      2c/ @s|jd}|jd}d|k|rT|rTtd}tj|nr|rtj||d}|j|j} } n;tj ||\} }|s|dj} n |t } | j } | j } |j } r| t krt qn|jd}tj || ||}|jdr|r]tjtdn| dkr6tjtdq6ntt|j| | |d |d \}}}rtt|j| | |d |d \}}}nttt}}}||B|B|B}||B|B}|s6d Stjd d }zv|jds~||B||B|B}t|||| ||d }d|| j}r||B||B|B}t|||| ||d }d|| j}n d}d}g}d} d}!| rOt|||| ||d }"d|| j}!nEt|dkrt|||d||\}"}nd}"|j} |}#|}$|!}%t|dkrRtj|j}&tjj|||&}|&|}#tjj|s tj}nrVtjj|||&}|&|}$tjj|sVtj}qVntjj| |"|&}"|&|!}%qRnd}'tj |diO}(t!j"||| j|| jg|(d|j#j$||'d|WdQXt!j%|| |'}#t!j%|| |'}%|j#j$||#}|j#j$||%}"d}d}$g}i|d6|d6|d6|#d6|$d6|%d6|"d6|jd6fd})d}* rt&j'|*| r|d 7}nt&j(|*|)|}|j)d!tj*||f|j+|d"|d#dx|D]\}+},}-tj,|+}.|.t-j.|-t-j.ks|.j/|-j/ks|.j0d$@|-j0d$@kr'|j)d%|,|+ftj1|+|,q'q'WdSWd|j2td&t3j4|XdS('s Do the actual diff: - copy to a temp structure if diffing 2 internal revisions - copy to a temp structure if diffing working revision with another one and more than 1 file is changed - just invoke the diff for a single file in the working dir trevtchanges$parent2s2cannot specify --rev and --change at the same timeRtpatchs&--patch cannot be used with --subreposs--patch requires two revisionsR-iitprefixsextdiff.s@%dRis hg-%h.patchRt fntemplatetmatchNtparenttparent1tparent2tplabel1tplabel2tclabeltchildRc@sJ|jd}|jd} r5|dkr5|S|tj|S(NiiR=(tgroupR t shellquote(R:tpretkey(tdo3waytreplace(s3/usr/lib64/python2.7/site-packages/hgext/extdiff.pytquote#s sJ(['"]?)([^\s'"$]*)\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)\1s $parent1 $childsrunning %r in %s tcwdt blockedtagi@s6file changed while diffing. Overwriting: %s (src: %s) scleaning up temp directory (5tgetRRtAbortR t revsingleRtp1tp2trevpairRR+R"R:tmaptsettstatusR tmkdtempR4R5R RR t localpathtpopRRRtisfiletdevnullRt nullformatterRtexporttvfstreljoint makefilenametretsearchtsubtdebugtbytestrtsystemR)tstattST_MTIMEtst_sizetst_modetcopyfileRtshutiltrmtree(/RR*tcmdlinetpatstoptstrevsR6tmsgtctx2tctx1atctx1btnode1atnode1btnode2Rtmatchertmod_atadd_atrem_atmod_btadd_btrem_btmodaddtcommonR,t dir1a_filestdir1atrev1at dir1b_filestdir1btrev1bR0tdir2roottrev2tdir2tlabel1atlabel1btlabel2t common_filettemplatetfmRHtregextcopy_fnt working_fntsttcpstat((RFRGs3/usr/lib64/python2.7/site-packages/hgext/extdiff.pytdodiffs                 &     totoptions!pass option to comparison programtOPTtrR5trevisiontREVtcR6schange made by revisionR7s!compare patches for two revisionstptprogramscomparison program to runtCMDshg extdiff [OPT]... [FILE]...t helpcategoryt inferrepocO@stj|}|jd}|jd}|sKd}|pEdg}ndjttj|g|}t|||||S(suse external program to diff repository (or selected files) Show differences between revisions for the specified files, using an external program. The default program used is diff, with default options "-Npru". To select a different program, use the -p/--program option. The program will be passed the names of two directories to compare. To pass additional options to the program, use -o/--option. These will be passed before the names of the directories to compare. When two revision arguments are given, then changes are shown between those revisions. If only one revision is specified then that revision is compared to the working directory, and, when no revisions are specified, the working directory files are compared to its parent.RRtdiffs-Nprut (R t byteskwargsRKRRQR RCR(RR*RlRmRRRk((s3/usr/lib64/python2.7/site-packages/hgext/extdiff.pyRQs"tsavedcmdcB@s eZdZdZdZRS(suse external program to diff repository (or selected files) Show differences between revisions for the specified files, using the following program:: %(path)s When two revision arguments are given, then changes are shown between those revisions. If only one revision is specified then that revision is compared to the working directory, and, when no revisions are specified, the working directory files are compared to its parent. cC@sDtj|}|jitjtj|d6;_||_dS(NR(Rt escapestrt__doc__R tsysstrtuireprt_cmdline(tselfRRktdocpath((s3/usr/lib64/python2.7/site-packages/hgext/extdiff.pyt__init__s(cO@s^tj|}djttj|d}|rAd|}nt|||j|||S(NRR(R RRRQR RCRR(RRR*RlRmtoptions((s3/usr/lib64/python2.7/site-packages/hgext/extdiff.pyt__call__s  (t__name__t __module__RRR(((s3/usr/lib64/python2.7/site-packages/hgext/extdiff.pyRqs  c C@sx|jdD]\}}tj|}|jdr|d}|stj|}|dkrtj||pz|}qn|j dd|}tj |}|rL|d|7}qLn|jdrqnu|r|}t t j |dk}nKtj|}|dkr7tj||p1|}ntj |}t}|s|j d|dp{|j d |d}|r|d|7}qnt|ttd |d tjd tt||qWdS( NRscmd.isopts.Ris diff-toolss .diffargss merge-toolsshg %s [OPTION]... [FILE]...RR(t configitemsR t expandpatht startswithR tfindexeRRtfindexternaltooltconfigRCR R t shlexsplitR"tcommandt extdiffoptsRtCATEGORY_FILE_CONTENTStTrueR(RtcmdRtdiffoptsRktargs((s3/usr/lib64/python2.7/site-packages/hgext/extdiff.pytuisetups<    (+Rt __future__RRR^RiRdtmercurial.i18nRtmercurial.nodeRRt mercurialRRRRRR R R R tmercurial.utilsR RtcmdtableRt configtablet configitemRRt testedwithR4Rtwalkoptst subrepooptsRRRtobjectRRt i18nfunctions(((s3/usr/lib64/python2.7/site-packages/hgext/extdiff.pytBs@    @    % !   &