mercurial/cmdutil.py
changeset 41663 6a447a3d1bd0
parent 41662 b2df5dc3ebfb
child 41664 16a49c778bde
equal deleted inserted replaced
41662:b2df5dc3ebfb 41663:6a447a3d1bd0
  2389     # that doesn't support addremove
  2389     # that doesn't support addremove
  2390     if opts.get('addremove'):
  2390     if opts.get('addremove'):
  2391         dsguard = dirstateguard.dirstateguard(repo, 'commit')
  2391         dsguard = dirstateguard.dirstateguard(repo, 'commit')
  2392     with dsguard or util.nullcontextmanager():
  2392     with dsguard or util.nullcontextmanager():
  2393         if dsguard:
  2393         if dsguard:
  2394             if scmutil.addremove(repo, matcher, "", opts) != 0:
  2394             relative = scmutil.anypats(pats, opts)
       
  2395             uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=relative)
       
  2396             if scmutil.addremove(repo, matcher, "", uipathfn, opts) != 0:
  2395                 raise error.Abort(
  2397                 raise error.Abort(
  2396                     _("failed to mark all new/missing files as added/removed"))
  2398                     _("failed to mark all new/missing files as added/removed"))
  2397 
  2399 
  2398         return commitfunc(ui, repo, message, matcher, opts)
  2400         return commitfunc(ui, repo, message, matcher, opts)
  2399 
  2401 
  2467             files = set(old.files())
  2469             files = set(old.files())
  2468 
  2470 
  2469         # add/remove the files to the working copy if the "addremove" option
  2471         # add/remove the files to the working copy if the "addremove" option
  2470         # was specified.
  2472         # was specified.
  2471         matcher = scmutil.match(wctx, pats, opts)
  2473         matcher = scmutil.match(wctx, pats, opts)
       
  2474         relative = scmutil.anypats(pats, opts)
       
  2475         uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=relative)
  2472         if (opts.get('addremove')
  2476         if (opts.get('addremove')
  2473             and scmutil.addremove(repo, matcher, "", opts)):
  2477             and scmutil.addremove(repo, matcher, "", uipathfn, opts)):
  2474             raise error.Abort(
  2478             raise error.Abort(
  2475                 _("failed to mark all new/missing files as added/removed"))
  2479                 _("failed to mark all new/missing files as added/removed"))
  2476 
  2480 
  2477         # Check subrepos. This depends on in-place wctx._status update in
  2481         # Check subrepos. This depends on in-place wctx._status update in
  2478         # subrepo.precommit(). To minimize the risk of this hack, we do
  2482         # subrepo.precommit(). To minimize the risk of this hack, we do