Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/Tools/scripts/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/Tools/scripts/__pycache__/diff.cpython-34.pyc

�
e f��@s�dZddlZddlZddlZddlZddlZddlmZmZdd�Zdd�Z	e
dkr�e	�ndS)	aS Command line interface to difflib.py providing diffs in four formats:

* ndiff:    lists every line and highlights interline changes.
* context:  highlights clusters of changes in a before/after format.
* unified:  highlights clusters of changes in an inline format.
* html:     generates side by side comparison with change highlights.

�N)�datetime�timezonecCs1tjtj|�jtj�}|j�j�S)N)	rZ
fromtimestamp�os�stat�st_mtimerZutcZ
astimezoneZ	isoformat)�path�t�r	�7/opt/alt/python34/lib64/python3.4/Tools/scripts/diff.py�
file_mtimesrcCsAd}tj|�}|jddddddd�|jd	dddddd
�|jddddddd�|jd
dddddd�|jdddddddd�|j�\}}t|�dkr�|j�tjd�nt|�dkr|jd�n|j	}|\}}t
|�}t
|�}t|��}	|	j�}
WdQXt|��}|j�}WdQX|j
r�tj|
|||||d|�}
n{|jr�tj|
|�}
n]|jr	tj�j|
|||d|jd|�}
n$tj|
|||||d|�}
tjj|
�dS)Nz&usage: %prog [options] fromfile tofilez-c�action�
store_true�defaultF�helpz'Produce a context format diff (default)z-uzProduce a unified format diffz-mzAProduce HTML side by side diff (can use -c and -l in conjunction)z-nzProduce a ndiff format diffz-lz--lines�type�int�z'Set number of context lines (default 3)r��z*need to specify both a fromfile and tofile�n�contextZnumlines)�optparseZOptionParserZ
add_option�
parse_args�lenZ
print_help�sys�exit�error�linesr�open�	readlines�u�difflibZunified_diffrZndiff�mZHtmlDiffZ	make_file�cZcontext_diff�stdout�
writelines)Zusage�parserZoptions�argsrZfromfileZtofileZfromdateZtodateZffZ	fromlinesZtfZtolinesZdiffr	r	r
�mains:"
		'		0$r(�__main__)�__doc__rrZtimer!rrrrr(�__name__r	r	r	r
�<module>	s<&