allow diff program to be selected explicitly

Change-Id: I1d8df9cc3ed35cc5983bc50fc13975db32072dbe
This commit is contained in:
Doug Zongker 2012-08-14 16:36:15 -07:00
parent 8513b62f6a
commit 24cd280328
1 changed files with 7 additions and 3 deletions

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()