am 24cd2803: allow diff program to be selected explicitly

* commit '24cd28032890b1ca7fbc34320a22bd575f59d641':
  allow diff program to be selected explicitly
This commit is contained in:
Doug Zongker 2012-08-14 16:51:40 -07:00 committed by Android Git Automerger
commit d3eb5e5b36

View file

@ -747,10 +747,11 @@ DIFF_PROGRAM_BY_EXT = {
}
class Difference(object):
def __init__(self, tf, sf):
def __init__(self, tf, sf, diff_program=None):
self.tf = tf
self.sf = sf
self.patch = None
self.diff_program = diff_program
def ComputePatch(self):
"""Compute the patch (as a string of data) needed to turn sf into
@ -759,8 +760,11 @@ class Difference(object):
tf = self.tf
sf = self.sf
ext = os.path.splitext(tf.name)[1]
diff_program = DIFF_PROGRAM_BY_EXT.get(ext, "bsdiff")
if self.diff_program:
diff_program = self.diff_program
else:
ext = os.path.splitext(tf.name)[1]
diff_program = DIFF_PROGRAM_BY_EXT.get(ext, "bsdiff")
ttemp = tf.WriteToTemp()
stemp = sf.WriteToTemp()