-=[ Mr. Bumblebee ]=-
_Indonesia_
ó
¦îNc @@ sï d d l m Z d d l m Z e e ƒ d ƒ d d d g Z d d d d d d d d
„ Z d d „ Z y d d l m
Z m Z
m Z Wn- e k
r¸ d d
l m Z m Z
m Z n Xd „ Z e d k rë e j e e j d ƒ ƒ n d S( i ( t absolute_import( t lazy_imports1
import os
import sys
import time
import difflib
t PatienceSequenceMatchert unified_difft unified_diff_filest i s
c c@ sÞ | d k r t j } n | r1 d t | ƒ } n | rJ d t | ƒ } n t } x‡| d | | ƒ j | ƒ D]j}
| s¥ d | | | f Vd | | | f Vt } n |
d d |
d d |
d d |
d d f \ } } }
} d
| d | | |
d | |
| f VxÈ |
D]À \ } } } }
} | d k rZx | | | !D] } d | VqAWqn | d
k sr| d k r–x! | | | !D] } d | Vq€Wn | d
k s®| d k rx! | |
| !D] } d | Vq¼WqqWql Wd S( sŽ
Compare two sequences of lines; generate the delta as a unified diff.
Unified diffs are a compact way of showing line changes and a few
lines of context. The number of context lines is set by 'n' which
defaults to three.
By default, the diff control lines (those with ---, +++, or @@) are
created with a trailing newline. This is helpful so that inputs
created from file.readlines() result in diffs that are suitable for
file.writelines() since both the inputs and outputs have trailing
newlines.
For inputs that do not have trailing newlines, set the lineterm
argument to "" so that the output will be uniformly newline free.
The unidiff format normally has a header for filenames and modification
times. Any or all of these may be specified using strings for
'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. The modification
times are normally expressed in the format returned by time.ctime().
Example:
>>> for line in unified_diff('one two three four'.split(),
... 'zero one tree four'.split(), 'Original', 'Current',
... 'Sat Jan 26 23:30:50 1991', 'Fri Jun 06 10:20:52 2003',
... lineterm=''):
... print line
--- Original Sat Jan 26 23:30:50 1991
+++ Current Fri Jun 06 10:20:52 2003
@@ -1,4 +1,4 @@
+zero
one
-two
-three
+tree
four
s s
--- %s%s%ss
+++ %s%s%si i iÿÿÿÿi i i s @@ -%d,%d +%d,%d @@%st equalt t replacet deletet -t insertt +N( t Nonet difflibt SequenceMatchert strt Falset get_grouped_opcodest True( t at bt fromfilet tofilet fromfiledatet
tofiledatet nt linetermt sequencematchert startedt groupt i1t i2t j1t j2t tagt line( ( s7 /usr/lib/python2.7/dist-packages/bzrlib/patiencediff.pyR # s2 )" >(
c C@ sÅ | | k r g S| d k r4 t j } t j ƒ } n! t | d ƒ } t j | ƒ j } | d k ry t j } t j ƒ } n! t | d ƒ } t j | ƒ j } t | j ƒ | j ƒ d | d | d | ƒS( s% Generate the diff for two files.
R
t rbR R R ( t syst stdint timet opent ost statt st_mtimeR t readlines( R R R t file_at time_at file_bt time_b( ( s7 /usr/lib/python2.7/dist-packages/bzrlib/patiencediff.pyR i s ( t unique_lcs_ct recurse_matches_ct PatienceSequenceMatcher_c( t
unique_lcs_pyt recurse_matches_pyt PatienceSequenceMatcher_pyc C@ s d d l } | j d d ƒ } | j d d d d d d d
d d
d d
ƒ| j d d d d d d d d d
d d ƒi t d
6t j d 6} | j | ƒ \ } } | | j } t | ƒ d k rÈ d GHd Sx5 t | d | d d | ƒD] } t
j j | ƒ qæ Wd S( Ni t usagesA %prog [options] file_a file_b
Files can be "-" to read from stdins
--patiencet destt matchert actiont store_constt constt patiencet defaultt helps% Use the patience difference algorithms --difflibR s Use python's difflib algorithmi s# You must supply 2 filenames to diffiÿÿÿÿi R (
t optparset OptionParsert
add_optionR R R t
parse_argsR: t lenR R&