Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 43644:e01e0641f18a
cmdutil: use field names instead of field numbers on scmutil.status
As part of my pytype adventures I want to make scmutil.status no longer a
subclass of tuple. This is part of that process.
Differential Revision: https://phab.mercurial-scm.org/D7396
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 14 Nov 2019 15:26:17 -0500 |
parents | c21aca51b392 |
children | 9cb7f855e2fc |
comparison
equal
deleted
inserted
replaced
43643:d0310f21ee9e | 43644:e01e0641f18a |
---|---|
427 overrides = {(b'ui', b'commitsubrepos'): True} | 427 overrides = {(b'ui', b'commitsubrepos'): True} |
428 | 428 |
429 with repo.ui.configoverride(overrides, b'record'): | 429 with repo.ui.configoverride(overrides, b'record'): |
430 # subrepoutil.precommit() modifies the status | 430 # subrepoutil.precommit() modifies the status |
431 tmpstatus = scmutil.status( | 431 tmpstatus = scmutil.status( |
432 copymod.copy(status[0]), | 432 copymod.copy(status.modified), |
433 copymod.copy(status[1]), | 433 copymod.copy(status.added), |
434 copymod.copy(status[2]), | 434 copymod.copy(status.removed), |
435 copymod.copy(status[3]), | 435 copymod.copy(status.deleted), |
436 copymod.copy(status[4]), | 436 copymod.copy(status.unknown), |
437 copymod.copy(status[5]), | 437 copymod.copy(status.ignored), |
438 copymod.copy(status[6]), # pytype: disable=wrong-arg-count | 438 copymod.copy(status.clean), # pytype: disable=wrong-arg-count |
439 ) | 439 ) |
440 | 440 |
441 # Force allows -X subrepo to skip the subrepo. | 441 # Force allows -X subrepo to skip the subrepo. |
442 subs, commitsubs, newstate = subrepoutil.precommit( | 442 subs, commitsubs, newstate = subrepoutil.precommit( |
443 repo.ui, wctx, tmpstatus, match, force=True | 443 repo.ui, wctx, tmpstatus, match, force=True |
989 'hint' is the usual hint given to Abort exception. | 989 'hint' is the usual hint given to Abort exception. |
990 """ | 990 """ |
991 | 991 |
992 if merge and repo.dirstate.p2() != nullid: | 992 if merge and repo.dirstate.p2() != nullid: |
993 raise error.Abort(_(b'outstanding uncommitted merge'), hint=hint) | 993 raise error.Abort(_(b'outstanding uncommitted merge'), hint=hint) |
994 modified, added, removed, deleted = repo.status()[:4] | 994 st = repo.status() |
995 if modified or added or removed or deleted: | 995 if st.modified or st.added or st.removed or st.deleted: |
996 raise error.Abort(_(b'uncommitted changes'), hint=hint) | 996 raise error.Abort(_(b'uncommitted changes'), hint=hint) |
997 ctx = repo[None] | 997 ctx = repo[None] |
998 for s in sorted(ctx.substate): | 998 for s in sorted(ctx.substate): |
999 ctx.sub(s).bailifchanged(hint=hint) | 999 ctx.sub(s).bailifchanged(hint=hint) |
1000 | 1000 |
2563 def remove( | 2563 def remove( |
2564 ui, repo, m, prefix, uipathfn, after, force, subrepos, dryrun, warnings=None | 2564 ui, repo, m, prefix, uipathfn, after, force, subrepos, dryrun, warnings=None |
2565 ): | 2565 ): |
2566 ret = 0 | 2566 ret = 0 |
2567 s = repo.status(match=m, clean=True) | 2567 s = repo.status(match=m, clean=True) |
2568 modified, added, deleted, clean = s[0], s[1], s[3], s[6] | 2568 modified, added, deleted, clean = s.modified, s.added, s.deleted, s.clean |
2569 | 2569 |
2570 wctx = repo[None] | 2570 wctx = repo[None] |
2571 | 2571 |
2572 if warnings is None: | 2572 if warnings is None: |
2573 warnings = [] | 2573 warnings = [] |
2874 user = opts.get(b'user') or old.user() | 2874 user = opts.get(b'user') or old.user() |
2875 | 2875 |
2876 if len(old.parents()) > 1: | 2876 if len(old.parents()) > 1: |
2877 # ctx.files() isn't reliable for merges, so fall back to the | 2877 # ctx.files() isn't reliable for merges, so fall back to the |
2878 # slower repo.status() method | 2878 # slower repo.status() method |
2879 files = {fn for st in base.status(old)[:3] for fn in st} | 2879 st = base.status(old) |
2880 files = set(st.modified) | set(st.added) | set(st.removed) | |
2880 else: | 2881 else: |
2881 files = set(old.files()) | 2882 files = set(old.files()) |
2882 | 2883 |
2883 # add/remove the files to the working copy if the "addremove" option | 2884 # add/remove the files to the working copy if the "addremove" option |
2884 # was specified. | 2885 # was specified. |