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) |