##// END OF EJS Templates
simplemerge: work with opts as native strings instead of bytes...
Martin von Zweigbergk -
r46714:5510e2ac default
parent child Browse files
Show More
@@ -433,9 +433,9 b' def _verifytext(text, path, ui, opts):'
433 433 then we just warn)"""
434 434 if stringutil.binary(text):
435 435 msg = _(b"%s looks like a binary file.") % path
436 if not opts.get(b'quiet'):
436 if not opts.get('quiet'):
437 437 ui.warn(_(b'warning: %s\n') % msg)
438 if not opts.get(b'text'):
438 if not opts.get('text'):
439 439 raise error.Abort(msg)
440 440 return text
441 441
@@ -460,7 +460,6 b' def simplemerge(ui, localctx, basectx, o'
460 460
461 461 The merged result is written into `localctx`.
462 462 """
463 opts = pycompat.byteskwargs(opts)
464 463
465 464 def readctx(ctx):
466 465 # Merges were always run in the working copy before, which means
@@ -472,11 +471,11 b' def simplemerge(ui, localctx, basectx, o'
472 471 # repository usually sees) might be more useful.
473 472 return _verifytext(ctx.decodeddata(), ctx.path(), ui, opts)
474 473
475 mode = opts.get(b'mode', b'merge')
474 mode = opts.get('mode', b'merge')
476 475 name_a, name_b, name_base = None, None, None
477 476 if mode != b'union':
478 477 name_a, name_b, name_base = _picklabels(
479 [localctx.path(), otherctx.path(), None], opts.get(b'label', [])
478 [localctx.path(), otherctx.path(), None], opts.get('label', [])
480 479 )
481 480
482 481 try:
@@ -488,7 +487,7 b' def simplemerge(ui, localctx, basectx, o'
488 487
489 488 m3 = Merge3Text(basetext, localtext, othertext)
490 489 extrakwargs = {
491 b"localorother": opts.get(b"localorother", None),
490 b"localorother": opts.get("localorother", None),
492 491 b'minimize': True,
493 492 }
494 493 if mode == b'union':
@@ -504,7 +503,7 b' def simplemerge(ui, localctx, basectx, o'
504 503 for line in m3.merge_lines(
505 504 name_a=name_a, name_b=name_b, **pycompat.strkwargs(extrakwargs)
506 505 ):
507 if opts.get(b'print'):
506 if opts.get('print'):
508 507 ui.fout.write(line)
509 508 else:
510 509 mergedtext += line
@@ -519,7 +518,7 b' def simplemerge(ui, localctx, basectx, o'
519 518 addedflags = (localflags ^ otherflags) - baseflags
520 519 flags = b''.join(sorted(commonflags | addedflags))
521 520
522 if not opts.get(b'print'):
521 if not opts.get('print'):
523 522 localctx.write(mergedtext, flags)
524 523
525 524 if m3.conflicts and not mode == b'union':
General Comments 0
You need to be logged in to leave comments. Login now