##// 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 return unc
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 def simplemerge(ui, local, base, other, **opts):
411 def simplemerge(ui, local, base, other, **opts):
401 def readfile(filename):
412 def readfile(filename):
402 f = open(filename, "rb")
413 f = open(filename, "rb")
403 text = f.read()
414 text = f.read()
404 f.close()
415 f.close()
405 if util.binary(text):
416 return _verifytext(text, filename, ui, opts)
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
412
417
413 mode = opts.get('mode','merge')
418 mode = opts.get('mode','merge')
414 if mode == 'union':
419 if mode == 'union':
General Comments 0
You need to be logged in to leave comments. Login now