##// END OF EJS Templates
simplemerge: let extension check for binary inputs (unless `--text`)...
Martin von Zweigbergk -
r49596:109fec7b default
parent child Browse files
Show More
@@ -64,6 +64,17 b' def showhelp():'
64 64 procutil.stdout.write(b' %-*s %s\n' % (opts_len, first, second))
65 65
66 66
67 def _verifytext(input, ui, quiet=False, allow_binary=False):
68 """verifies that text is non-binary (unless opts[text] is passed,
69 then we just warn)"""
70 if stringutil.binary(input.text()):
71 msg = _(b"%s looks like a binary file.") % input.fctx.path()
72 if not quiet:
73 ui.warn(_(b'warning: %s\n') % msg)
74 if not allow_binary:
75 sys.exit(1)
76
77
67 78 try:
68 79 for fp in (sys.stdin, procutil.stdout, sys.stderr):
69 80 procutil.setbinary(fp)
@@ -97,15 +108,23 b' try:'
97 108 base_input = simplemerge.MergeInput(
98 109 context.arbitraryfilectx(base), labels[2]
99 110 )
111
112 quiet = opts.get(b'quiet')
113 allow_binary = opts.get(b'text')
114 ui = uimod.ui.load()
115 _verifytext(local_input, ui, quiet=quiet, allow_binary=allow_binary)
116 _verifytext(base_input, ui, quiet=quiet, allow_binary=allow_binary)
117 _verifytext(other_input, ui, quiet=quiet, allow_binary=allow_binary)
118
100 119 sys.exit(
101 120 simplemerge.simplemerge(
102 uimod.ui.load(),
121 ui,
103 122 local_input,
104 123 base_input,
105 124 other_input,
106 125 mode,
107 quiet=opts.get(b'quiet'),
108 allow_binary=opts.get(b'text'),
126 quiet=True,
127 allow_binary=allow_binary,
109 128 print_result=opts.get(b'print'),
110 129 )
111 130 )
General Comments 0
You need to be logged in to leave comments. Login now