##// END OF EJS Templates
simplemerge: add optional context parameters to simplemerge...
Phil Cohen -
r33825:b3571dc0 default
parent child Browse files
Show More
@@ -408,7 +408,8 b' def _verifytext(text, path, ui, opts):'
408 raise error.Abort(msg)
408 raise error.Abort(msg)
409 return text
409 return text
410
410
411 def simplemerge(ui, local, base, other, **opts):
411 def simplemerge(ui, localfile, basefile, otherfile,
412 localctx=None, basectx=None, otherctx=None, repo=None, **opts):
412 def readfile(filename):
413 def readfile(filename):
413 f = open(filename, "rb")
414 f = open(filename, "rb")
414 text = f.read()
415 text = f.read()
@@ -421,8 +422,8 b' def simplemerge(ui, local, base, other, '
421 name_b = None
422 name_b = None
422 name_base = None
423 name_base = None
423 else:
424 else:
424 name_a = local
425 name_a = localfile
425 name_b = other
426 name_b = otherfile
426 name_base = None
427 name_base = None
427 labels = opts.get('label', [])
428 labels = opts.get('label', [])
428 if len(labels) > 0:
429 if len(labels) > 0:
@@ -435,16 +436,16 b' def simplemerge(ui, local, base, other, '
435 raise error.Abort(_("can only specify three labels."))
436 raise error.Abort(_("can only specify three labels."))
436
437
437 try:
438 try:
438 localtext = readfile(local)
439 localtext = readfile(localfile)
439 basetext = readfile(base)
440 basetext = readfile(basefile)
440 othertext = readfile(other)
441 othertext = readfile(otherfile)
441 except error.Abort:
442 except error.Abort:
442 return 1
443 return 1
443
444
444 local = os.path.realpath(local)
445 localfile = os.path.realpath(localfile)
445 if not opts.get('print'):
446 if not opts.get('print'):
446 opener = vfsmod.vfs(os.path.dirname(local))
447 opener = vfsmod.vfs(os.path.dirname(localfile))
447 out = opener(os.path.basename(local), "w", atomictemp=True)
448 out = opener(os.path.basename(localfile), "w", atomictemp=True)
448 else:
449 else:
449 out = ui.fout
450 out = ui.fout
450
451
General Comments 0
You need to be logged in to leave comments. Login now