##// END OF EJS Templates
simplemerge: extract verifytext as a helper function...
Phil Cohen -
r33824:de573184 default
parent child Browse files
Show More
@@ -397,18 +397,23 b' class Merge3Text(object):'
397 397
398 398 return unc
399 399
400 def _verifytext(text, path, ui, opts):
401 """verifies that text is non-binary (unless opts[text] is passed,
402 then we just warn)"""
403 if util.binary(text):
404 msg = _("%s looks like a binary file.") % path
405 if not opts.get('quiet'):
406 ui.warn(_('warning: %s\n') % msg)
407 if not opts.get('text'):
408 raise error.Abort(msg)
409 return text
410
400 411 def simplemerge(ui, local, base, other, **opts):
401 412 def readfile(filename):
402 413 f = open(filename, "rb")
403 414 text = f.read()
404 415 f.close()
405 if util.binary(text):
406 msg = _("%s looks like a binary file.") % filename
407 if not opts.get('quiet'):
408 ui.warn(_('warning: %s\n') % msg)
409 if not opts.get('text'):
410 raise error.Abort(msg)
411 return text
416 return _verifytext(text, filename, ui, opts)
412 417
413 418 mode = opts.get('mode','merge')
414 419 if mode == 'union':
General Comments 0
You need to be logged in to leave comments. Login now