contrib/simplemerge
changeset 48755 6ae3c97a0919
parent 48752 109fec7bf7de
child 48758 7dad4665d223
equal deleted inserted replaced
48754:d9602f0df4f3 48755:6ae3c97a0919
    13     context,
    13     context,
    14     error,
    14     error,
    15     fancyopts,
    15     fancyopts,
    16     simplemerge,
    16     simplemerge,
    17     ui as uimod,
    17     ui as uimod,
       
    18     util,
    18 )
    19 )
    19 from mercurial.utils import procutil, stringutil
    20 from mercurial.utils import procutil, stringutil
    20 
    21 
    21 options = [
    22 options = [
    22     (b'L', b'label', [], _(b'labels to use on conflict markers')),
    23     (b'L', b'label', [], _(b'labels to use on conflict markers')),
   114     ui = uimod.ui.load()
   115     ui = uimod.ui.load()
   115     _verifytext(local_input, ui, quiet=quiet, allow_binary=allow_binary)
   116     _verifytext(local_input, ui, quiet=quiet, allow_binary=allow_binary)
   116     _verifytext(base_input, ui, quiet=quiet, allow_binary=allow_binary)
   117     _verifytext(base_input, ui, quiet=quiet, allow_binary=allow_binary)
   117     _verifytext(other_input, ui, quiet=quiet, allow_binary=allow_binary)
   118     _verifytext(other_input, ui, quiet=quiet, allow_binary=allow_binary)
   118 
   119 
   119     sys.exit(
   120     merged_text, conflicts = simplemerge.simplemerge(
   120         simplemerge.simplemerge(
   121         ui,
   121             ui,
   122         local_input,
   122             local_input,
   123         base_input,
   123             base_input,
   124         other_input,
   124             other_input,
   125         mode,
   125             mode,
   126         quiet=True,
   126             quiet=True,
   127         allow_binary=allow_binary,
   127             allow_binary=allow_binary,
   128         print_result=opts.get(b'print'),
   128             print_result=opts.get(b'print'),
       
   129         )
       
   130     )
   129     )
       
   130     if opts.get(b'print'):
       
   131         ui.fout.write(merged_text)
       
   132     else:
       
   133         util.writefile(local, merged_text)
       
   134     sys.exit(1 if conflicts else 0)
   131 except ParseError as e:
   135 except ParseError as e:
   132     e = stringutil.forcebytestr(e)
   136     e = stringutil.forcebytestr(e)
   133     procutil.stdout.write(b"%s: %s\n" % (sys.argv[0].encode('utf8'), e))
   137     procutil.stdout.write(b"%s: %s\n" % (sys.argv[0].encode('utf8'), e))
   134     showhelp()
   138     showhelp()
   135     sys.exit(1)
   139     sys.exit(1)