contrib/simplemerge
changeset 48749 9ee70e175fed
parent 48578 77e24ee8994b
child 48752 109fec7bf7de
equal deleted inserted replaced
48746:18e69f224e4b 48749:9ee70e175fed
    11 from mercurial.i18n import _
    11 from mercurial.i18n import _
    12 from mercurial import (
    12 from mercurial import (
    13     context,
    13     context,
    14     error,
    14     error,
    15     fancyopts,
    15     fancyopts,
    16     pycompat,
       
    17     simplemerge,
    16     simplemerge,
    18     ui as uimod,
    17     ui as uimod,
    19 )
    18 )
    20 from mercurial.utils import procutil, stringutil
    19 from mercurial.utils import procutil, stringutil
    21 
    20 
    78     if opts[b'help']:
    77     if opts[b'help']:
    79         showhelp()
    78         showhelp()
    80         sys.exit(0)
    79         sys.exit(0)
    81     if len(args) != 3:
    80     if len(args) != 3:
    82         raise ParseError(_(b'wrong number of arguments').decode('utf8'))
    81         raise ParseError(_(b'wrong number of arguments').decode('utf8'))
       
    82     mode = b'merge'
    83     if len(opts[b'label']) > 2:
    83     if len(opts[b'label']) > 2:
    84         opts[b'mode'] = b'merge3'
    84         mode = b'merge3'
    85     local, base, other = args
    85     local, base, other = args
    86     overrides = opts[b'label']
    86     overrides = opts[b'label']
    87     if len(overrides) > 3:
    87     if len(overrides) > 3:
    88         raise error.InputError(b'can only specify three labels.')
    88         raise error.InputError(b'can only specify three labels.')
    89     labels = [local, other, base]
    89     labels = [local, other, base]
   101         simplemerge.simplemerge(
   101         simplemerge.simplemerge(
   102             uimod.ui.load(),
   102             uimod.ui.load(),
   103             local_input,
   103             local_input,
   104             base_input,
   104             base_input,
   105             other_input,
   105             other_input,
   106             **pycompat.strkwargs(opts)
   106             mode,
       
   107             quiet=opts.get(b'quiet'),
       
   108             allow_binary=opts.get(b'text'),
       
   109             print_result=opts.get(b'print'),
   107         )
   110         )
   108     )
   111     )
   109 except ParseError as e:
   112 except ParseError as e:
   110     e = stringutil.forcebytestr(e)
   113     e = stringutil.forcebytestr(e)
   111     procutil.stdout.write(b"%s: %s\n" % (sys.argv[0].encode('utf8'), e))
   114     procutil.stdout.write(b"%s: %s\n" % (sys.argv[0].encode('utf8'), e))