Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 34978:691524f0bbf6 stable
amend: update .hgsubstate before committing a memctx (issue5677)
This is a minimal copy of localrepo.commit(). As the current amend() function
heavily depends on the wctx API, it wasn't easy to port it to use a separate
status tuple. So for now, wctx._status is updated in-place.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 04 Nov 2017 20:07:40 +0900 |
parents | 5f40efa472db |
children | 058c725925e3 ee64e677c3cf |
comparison
equal
deleted
inserted
replaced
34977:5c6b96b832c2 | 34978:691524f0bbf6 |
---|---|
3151 if (opts.get('addremove') | 3151 if (opts.get('addremove') |
3152 and scmutil.addremove(repo, matcher, "", opts)): | 3152 and scmutil.addremove(repo, matcher, "", opts)): |
3153 raise error.Abort( | 3153 raise error.Abort( |
3154 _("failed to mark all new/missing files as added/removed")) | 3154 _("failed to mark all new/missing files as added/removed")) |
3155 | 3155 |
3156 # Check subrepos. This depends on in-place wctx._status update in | |
3157 # subrepo.precommit(). To minimize the risk of this hack, we do | |
3158 # nothing if .hgsub does not exist. | |
3159 if '.hgsub' in wctx or '.hgsub' in old: | |
3160 from . import subrepo # avoid cycle: cmdutil -> subrepo -> cmdutil | |
3161 subs, commitsubs, newsubstate = subrepo.precommit( | |
3162 ui, wctx, wctx._status, matcher) | |
3163 # amend should abort if commitsubrepos is enabled | |
3164 assert not commitsubs | |
3165 if subs: | |
3166 subrepo.writestate(repo, newsubstate) | |
3167 | |
3156 filestoamend = set(f for f in wctx.files() if matcher(f)) | 3168 filestoamend = set(f for f in wctx.files() if matcher(f)) |
3157 | 3169 |
3158 changes = (len(filestoamend) > 0) | 3170 changes = (len(filestoamend) > 0) |
3159 if changes: | 3171 if changes: |
3160 # Recompute copies (avoid recording a -> b -> a) | 3172 # Recompute copies (avoid recording a -> b -> a) |