##// END OF EJS Templates
simplemerge: simplify code now that we always write to a context...
Phil Cohen -
r33909:4074de97 default
parent child Browse files
Show More
@@ -436,17 +436,6 b' def simplemerge(ui, localctx, basectx, o'
436 436 # repository usually sees) might be more useful.
437 437 return _verifytext(ctx.decodeddata(), ctx.path(), ui, opts)
438 438
439 class ctxwriter(object):
440 def __init__(self, ctx):
441 self.ctx = ctx
442 self.text = ""
443
444 def write(self, text):
445 self.text += text
446
447 def close(self):
448 self.ctx.write(self.text, self.ctx.flags())
449
450 439 mode = opts.get('mode','merge')
451 440 name_a, name_b, name_base = None, None, None
452 441 if mode != 'union':
@@ -461,11 +450,6 b' def simplemerge(ui, localctx, basectx, o'
461 450 except error.Abort:
462 451 return 1
463 452
464 if opts.get('print'):
465 out = ui.fout
466 else:
467 out = ctxwriter(localctx)
468
469 453 m3 = Merge3Text(basetext, localtext, othertext)
470 454 extrakwargs = {
471 455 "localorother": opts.get("localorother", None),
@@ -479,12 +463,17 b' def simplemerge(ui, localctx, basectx, o'
479 463 extrakwargs['base_marker'] = '|||||||'
480 464 extrakwargs['name_base'] = name_base
481 465 extrakwargs['minimize'] = False
466
467 mergedtext = ""
482 468 for line in m3.merge_lines(name_a=name_a, name_b=name_b,
483 469 **pycompat.strkwargs(extrakwargs)):
484 out.write(line)
470 if opts.get('print'):
471 ui.fout.write(line)
472 else:
473 mergedtext += line
485 474
486 475 if not opts.get('print'):
487 out.close()
476 localctx.write(mergedtext, localctx.flags())
488 477
489 478 if m3.conflicts and not mode == 'union':
490 479 return 1
General Comments 0
You need to be logged in to leave comments. Login now