mercurial/simplemerge.py
changeset 26587 56b2bcea2529
parent 26223 ed12abab068e
child 26614 ef1eb6df7071
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
    21 import os
    21 import os
    22 import sys
    22 import sys
    23 
    23 
    24 from .i18n import _
    24 from .i18n import _
    25 from . import (
    25 from . import (
       
    26     error,
    26     mdiff,
    27     mdiff,
    27     scmutil,
    28     scmutil,
    28     util,
    29     util,
    29 )
    30 )
    30 
    31 
   359         if util.binary(text):
   360         if util.binary(text):
   360             msg = _("%s looks like a binary file.") % filename
   361             msg = _("%s looks like a binary file.") % filename
   361             if not opts.get('quiet'):
   362             if not opts.get('quiet'):
   362                 ui.warn(_('warning: %s\n') % msg)
   363                 ui.warn(_('warning: %s\n') % msg)
   363             if not opts.get('text'):
   364             if not opts.get('text'):
   364                 raise util.Abort(msg)
   365                 raise error.Abort(msg)
   365         return text
   366         return text
   366 
   367 
   367     mode = opts.get('mode','merge')
   368     mode = opts.get('mode','merge')
   368     if mode == 'union':
   369     if mode == 'union':
   369         name_a = None
   370         name_a = None
   379         if len(labels) > 1:
   380         if len(labels) > 1:
   380             name_b = labels[1]
   381             name_b = labels[1]
   381         if len(labels) > 2:
   382         if len(labels) > 2:
   382             name_base = labels[2]
   383             name_base = labels[2]
   383         if len(labels) > 3:
   384         if len(labels) > 3:
   384             raise util.Abort(_("can only specify three labels."))
   385             raise error.Abort(_("can only specify three labels."))
   385 
   386 
   386     try:
   387     try:
   387         localtext = readfile(local)
   388         localtext = readfile(local)
   388         basetext = readfile(base)
   389         basetext = readfile(base)
   389         othertext = readfile(other)
   390         othertext = readfile(other)
   390     except util.Abort:
   391     except error.Abort:
   391         return 1
   392         return 1
   392 
   393 
   393     local = os.path.realpath(local)
   394     local = os.path.realpath(local)
   394     if not opts.get('print'):
   395     if not opts.get('print'):
   395         opener = scmutil.opener(os.path.dirname(local))
   396         opener = scmutil.opener(os.path.dirname(local))