mercurial/commands.py
changeset 48427 38941a28406a
parent 48407 4d59e0f909e0
child 48461 eaad68294904
equal deleted inserted replaced
48426:de8181c5414d 48427:38941a28406a
  6128         wctx = repo[None]
  6128         wctx = repo[None]
  6129         m = scmutil.match(wctx, pats, opts)
  6129         m = scmutil.match(wctx, pats, opts)
  6130         ret = 0
  6130         ret = 0
  6131         didwork = False
  6131         didwork = False
  6132 
  6132 
  6133         tocomplete = []
       
  6134         hasconflictmarkers = []
  6133         hasconflictmarkers = []
  6135         if mark:
  6134         if mark:
  6136             markcheck = ui.config(b'commands', b'resolve.mark-check')
  6135             markcheck = ui.config(b'commands', b'resolve.mark-check')
  6137             if markcheck not in [b'warn', b'abort']:
  6136             if markcheck not in [b'warn', b'abort']:
  6138                 # Treat all invalid / unrecognized values as 'none'.
  6137                 # Treat all invalid / unrecognized values as 'none'.
  6181 
  6180 
  6182                 try:
  6181                 try:
  6183                     # preresolve file
  6182                     # preresolve file
  6184                     overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
  6183                     overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
  6185                     with ui.configoverride(overrides, b'resolve'):
  6184                     with ui.configoverride(overrides, b'resolve'):
  6186                         complete, r = ms.preresolve(f, wctx)
  6185                         r = ms.resolve(f, wctx)
  6187                     if not complete:
  6186                     if r:
  6188                         tocomplete.append(f)
       
  6189                     elif r:
       
  6190                         ret = 1
  6187                         ret = 1
  6191                 finally:
  6188                 finally:
  6192                     ms.commit()
  6189                     ms.commit()
  6193 
  6190 
  6194                 # replace filemerge's .orig file with our resolve file, but only
  6191                 # replace filemerge's .orig file with our resolve file
  6195                 # for merges that are complete
  6192                 try:
  6196                 if complete:
  6193                     util.rename(
  6197                     try:
  6194                         a + b".resolve", scmutil.backuppath(ui, repo, f)
  6198                         util.rename(
  6195                     )
  6199                             a + b".resolve", scmutil.backuppath(ui, repo, f)
  6196                 except OSError as inst:
  6200                         )
  6197                     if inst.errno != errno.ENOENT:
  6201                     except OSError as inst:
  6198                         raise
  6202                         if inst.errno != errno.ENOENT:
       
  6203                             raise
       
  6204 
  6199 
  6205         if hasconflictmarkers:
  6200         if hasconflictmarkers:
  6206             ui.warn(
  6201             ui.warn(
  6207                 _(
  6202                 _(
  6208                     b'warning: the following files still have conflict '
  6203                     b'warning: the following files still have conflict '
  6215             if markcheck == b'abort' and not all and not pats:
  6210             if markcheck == b'abort' and not all and not pats:
  6216                 raise error.StateError(
  6211                 raise error.StateError(
  6217                     _(b'conflict markers detected'),
  6212                     _(b'conflict markers detected'),
  6218                     hint=_(b'use --all to mark anyway'),
  6213                     hint=_(b'use --all to mark anyway'),
  6219                 )
  6214                 )
  6220 
       
  6221         for f in tocomplete:
       
  6222             try:
       
  6223                 # resolve file
       
  6224                 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
       
  6225                 with ui.configoverride(overrides, b'resolve'):
       
  6226                     r = ms.resolve(f, wctx)
       
  6227                 if r:
       
  6228                     ret = 1
       
  6229             finally:
       
  6230                 ms.commit()
       
  6231 
       
  6232             # replace filemerge's .orig file with our resolve file
       
  6233             a = repo.wjoin(f)
       
  6234             try:
       
  6235                 util.rename(a + b".resolve", scmutil.backuppath(ui, repo, f))
       
  6236             except OSError as inst:
       
  6237                 if inst.errno != errno.ENOENT:
       
  6238                     raise
       
  6239 
  6215 
  6240         ms.commit()
  6216         ms.commit()
  6241         branchmerge = repo.dirstate.p2() != repo.nullid
  6217         branchmerge = repo.dirstate.p2() != repo.nullid
  6242         # resolve is not doing a parent change here, however, `record updates`
  6218         # resolve is not doing a parent change here, however, `record updates`
  6243         # will call some dirstate API that at intended for parent changes call.
  6219         # will call some dirstate API that at intended for parent changes call.