mercurial/commands.py
changeset 45518 32ce4cbaec4b
parent 45486 ac7a3da0dbb6
child 45544 2b339c6c6e99
equal deleted inserted replaced
45517:2a68a5ec8dd0 45518:32ce4cbaec4b
  5984             ),
  5984             ),
  5985             mergestatemod.MERGE_RECORD_RESOLVED_PATH: (
  5985             mergestatemod.MERGE_RECORD_RESOLVED_PATH: (
  5986                 b'resolve.resolved',
  5986                 b'resolve.resolved',
  5987                 b'R',
  5987                 b'R',
  5988             ),
  5988             ),
  5989             mergestatemod.MERGE_RECORD_DRIVER_RESOLVED: (
       
  5990                 b'resolve.driverresolved',
       
  5991                 b'D',
       
  5992             ),
       
  5993         }
  5989         }
  5994 
  5990 
  5995         for f in ms:
  5991         for f in ms:
  5996             if not m(f):
  5992             if not m(f):
  5997                 continue
  5993                 continue
  6012             raise error.Abort(
  6008             raise error.Abort(
  6013                 _(b'resolve command not applicable when not merging')
  6009                 _(b'resolve command not applicable when not merging')
  6014             )
  6010             )
  6015 
  6011 
  6016         wctx = repo[None]
  6012         wctx = repo[None]
  6017 
       
  6018         if (
       
  6019             ms.mergedriver
       
  6020             and ms.mdstate() == mergestatemod.MERGE_DRIVER_STATE_UNMARKED
       
  6021         ):
       
  6022             proceed = mergemod.driverpreprocess(repo, ms, wctx)
       
  6023             ms.commit()
       
  6024             # allow mark and unmark to go through
       
  6025             if not mark and not unmark and not proceed:
       
  6026                 return 1
       
  6027 
       
  6028         m = scmutil.match(wctx, pats, opts)
  6013         m = scmutil.match(wctx, pats, opts)
  6029         ret = 0
  6014         ret = 0
  6030         didwork = False
  6015         didwork = False
  6031         runconclude = False
       
  6032 
  6016 
  6033         tocomplete = []
  6017         tocomplete = []
  6034         hasconflictmarkers = []
  6018         hasconflictmarkers = []
  6035         if mark:
  6019         if mark:
  6036             markcheck = ui.config(b'commands', b'resolve.mark-check')
  6020             markcheck = ui.config(b'commands', b'resolve.mark-check')
  6040         for f in ms:
  6024         for f in ms:
  6041             if not m(f):
  6025             if not m(f):
  6042                 continue
  6026                 continue
  6043 
  6027 
  6044             didwork = True
  6028             didwork = True
  6045 
       
  6046             # don't let driver-resolved files be marked, and run the conclude
       
  6047             # step if asked to resolve
       
  6048             if ms[f] == mergestatemod.MERGE_RECORD_DRIVER_RESOLVED:
       
  6049                 exact = m.exact(f)
       
  6050                 if mark:
       
  6051                     if exact:
       
  6052                         ui.warn(
       
  6053                             _(b'not marking %s as it is driver-resolved\n')
       
  6054                             % uipathfn(f)
       
  6055                         )
       
  6056                 elif unmark:
       
  6057                     if exact:
       
  6058                         ui.warn(
       
  6059                             _(b'not unmarking %s as it is driver-resolved\n')
       
  6060                             % uipathfn(f)
       
  6061                         )
       
  6062                 else:
       
  6063                     runconclude = True
       
  6064                 continue
       
  6065 
  6029 
  6066             # path conflicts must be resolved manually
  6030             # path conflicts must be resolved manually
  6067             if ms[f] in (
  6031             if ms[f] in (
  6068                 mergestatemod.MERGE_RECORD_UNRESOLVED_PATH,
  6032                 mergestatemod.MERGE_RECORD_UNRESOLVED_PATH,
  6069                 mergestatemod.MERGE_RECORD_RESOLVED_PATH,
  6033                 mergestatemod.MERGE_RECORD_RESOLVED_PATH,
  6182                     )
  6146                     )
  6183                     break
  6147                     break
  6184             ui.warn(_(b"arguments do not match paths that need resolving\n"))
  6148             ui.warn(_(b"arguments do not match paths that need resolving\n"))
  6185             if hint:
  6149             if hint:
  6186                 ui.warn(hint)
  6150                 ui.warn(hint)
  6187         elif ms.mergedriver and ms.mdstate() != b's':
  6151 
  6188             # run conclude step when either a driver-resolved file is requested
       
  6189             # or there are no driver-resolved files
       
  6190             # we can't use 'ret' to determine whether any files are unresolved
       
  6191             # because we might not have tried to resolve some
       
  6192             if (runconclude or not list(ms.driverresolved())) and not list(
       
  6193                 ms.unresolved()
       
  6194             ):
       
  6195                 proceed = mergemod.driverconclude(repo, ms, wctx)
       
  6196                 ms.commit()
       
  6197                 if not proceed:
       
  6198                     return 1
       
  6199 
       
  6200     # Nudge users into finishing an unfinished operation
       
  6201     unresolvedf = list(ms.unresolved())
  6152     unresolvedf = list(ms.unresolved())
  6202     driverresolvedf = list(ms.driverresolved())
  6153     if not unresolvedf:
  6203     if not unresolvedf and not driverresolvedf:
       
  6204         ui.status(_(b'(no more unresolved files)\n'))
  6154         ui.status(_(b'(no more unresolved files)\n'))
  6205         cmdutil.checkafterresolved(repo)
  6155         cmdutil.checkafterresolved(repo)
  6206     elif not unresolvedf:
       
  6207         ui.status(
       
  6208             _(
       
  6209                 b'(no more unresolved files -- '
       
  6210                 b'run "hg resolve --all" to conclude)\n'
       
  6211             )
       
  6212         )
       
  6213 
  6156 
  6214     return ret
  6157     return ret
  6215 
  6158 
  6216 
  6159 
  6217 @command(
  6160 @command(