Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Nov 04 19:21:39 2017 +0900 +++ b/mercurial/cmdutil.py Sat Nov 04 20:07:40 2017 +0900 @@ -3153,6 +3153,18 @@ raise error.Abort( _("failed to mark all new/missing files as added/removed")) + # Check subrepos. This depends on in-place wctx._status update in + # subrepo.precommit(). To minimize the risk of this hack, we do + # nothing if .hgsub does not exist. + if '.hgsub' in wctx or '.hgsub' in old: + from . import subrepo # avoid cycle: cmdutil -> subrepo -> cmdutil + subs, commitsubs, newsubstate = subrepo.precommit( + ui, wctx, wctx._status, matcher) + # amend should abort if commitsubrepos is enabled + assert not commitsubs + if subs: + subrepo.writestate(repo, newsubstate) + filestoamend = set(f for f in wctx.files() if matcher(f)) changes = (len(filestoamend) > 0)