Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 41652:6a447a3d1bd0
addremove: pass around uipathfn and use instead of m.uipath() (API)
Differential Revision: https://phab.mercurial-scm.org/D5903
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 07 Feb 2019 23:25:39 -0800 |
parents | b2df5dc3ebfb |
children | 16a49c778bde |
comparison
equal
deleted
inserted
replaced
41651:b2df5dc3ebfb | 41652: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 |