mercurial/filemerge.py
changeset 48506 608a35db186c
parent 48505 40522aea2f27
child 48509 5151b0f6519e
equal deleted inserted replaced
48505:40522aea2f27 48506:608a35db186c
  1029 
  1029 
  1030     Returns whether the merge is complete, the return value of the merge, and
  1030     Returns whether the merge is complete, the return value of the merge, and
  1031     a boolean indicating whether the file was deleted from disk."""
  1031     a boolean indicating whether the file was deleted from disk."""
  1032 
  1032 
  1033     if not fco.cmp(fcd):  # files identical?
  1033     if not fco.cmp(fcd):  # files identical?
  1034         return True, None, False
  1034         return None, False
  1035 
  1035 
  1036     ui = repo.ui
  1036     ui = repo.ui
  1037     fd = fcd.path()
  1037     fd = fcd.path()
  1038     uipathfn = scmutil.getuipathfn(repo)
  1038     uipathfn = scmutil.getuipathfn(repo)
  1039     fduipath = uipathfn(fd)
  1039     fduipath = uipathfn(fd)
  1087         isexternal = True
  1087         isexternal = True
  1088 
  1088 
  1089     toolconf = tool, toolpath, binary, symlink, scriptfn
  1089     toolconf = tool, toolpath, binary, symlink, scriptfn
  1090 
  1090 
  1091     if mergetype == nomerge:
  1091     if mergetype == nomerge:
  1092         r, deleted = func(repo, mynode, fcd, fco, fca, toolconf, labels)
  1092         return func(repo, mynode, fcd, fco, fca, toolconf, labels)
  1093         return True, r, deleted
       
  1094 
  1093 
  1095     if orig != fco.path():
  1094     if orig != fco.path():
  1096         ui.status(
  1095         ui.status(
  1097             _(b"merging %s and %s to %s\n")
  1096             _(b"merging %s and %s to %s\n")
  1098             % (uipathfn(orig), uipathfn(fco.path()), fduipath)
  1097             % (uipathfn(orig), uipathfn(fco.path()), fduipath)
  1107             if wctx.isinmemory():
  1106             if wctx.isinmemory():
  1108                 raise error.InMemoryMergeConflictsError(
  1107                 raise error.InMemoryMergeConflictsError(
  1109                     b'in-memory merge does not support merge conflicts'
  1108                     b'in-memory merge does not support merge conflicts'
  1110                 )
  1109                 )
  1111             ui.warn(onfailure % fduipath)
  1110             ui.warn(onfailure % fduipath)
  1112         return True, 1, False
  1111         return 1, False
  1113 
  1112 
  1114     backup = _makebackup(repo, ui, wctx, fcd)
  1113     backup = _makebackup(repo, ui, wctx, fcd)
  1115     r = 1
  1114     r = 1
  1116     try:
  1115     try:
  1117         internalmarkerstyle = ui.config(b'ui', b'mergemarkers')
  1116         internalmarkerstyle = ui.config(b'ui', b'mergemarkers')
  1148             r = _premerge(
  1147             r = _premerge(
  1149                 repo, fcd, fco, fca, toolconf, backup, labels=premergelabels
  1148                 repo, fcd, fco, fca, toolconf, backup, labels=premergelabels
  1150             )
  1149             )
  1151             # we're done if premerge was successful (r is 0)
  1150             # we're done if premerge was successful (r is 0)
  1152             if not r:
  1151             if not r:
  1153                 return not r, r, False
  1152                 return r, False
  1154 
  1153 
  1155         needcheck, r, deleted = func(
  1154         needcheck, r, deleted = func(
  1156             repo,
  1155             repo,
  1157             mynode,
  1156             mynode,
  1158             fcd,
  1157             fcd,
  1175                         b'merge conflicts'
  1174                         b'merge conflicts'
  1176                     )
  1175                     )
  1177                 ui.warn(onfailure % fduipath)
  1176                 ui.warn(onfailure % fduipath)
  1178             _onfilemergefailure(ui)
  1177             _onfilemergefailure(ui)
  1179 
  1178 
  1180         return True, r, deleted
  1179         return r, deleted
  1181     finally:
  1180     finally:
  1182         if not r and backup is not None:
  1181         if not r and backup is not None:
  1183             backup.remove()
  1182             backup.remove()
  1184 
  1183 
  1185 
  1184