268 merge = len(wctx.parents()) > 1 |
269 merge = len(wctx.parents()) > 1 |
269 if merge: |
270 if merge: |
270 raise error.Abort(_('cannot partially commit a merge ' |
271 raise error.Abort(_('cannot partially commit a merge ' |
271 '(use "hg commit" instead)')) |
272 '(use "hg commit" instead)')) |
272 |
273 |
|
274 status = repo.status(match=match) |
|
275 |
|
276 overrides = {(b'ui', b'commitsubrepos'): True} |
|
277 |
|
278 with repo.ui.configoverride(overrides, b'record'): |
|
279 # subrepoutil.precommit() modifies the status |
|
280 tmpstatus = scmutil.status(copymod.copy(status[0]), |
|
281 copymod.copy(status[1]), |
|
282 copymod.copy(status[2]), |
|
283 copymod.copy(status[3]), |
|
284 copymod.copy(status[4]), |
|
285 copymod.copy(status[5]), |
|
286 copymod.copy(status[6])) |
|
287 |
|
288 # Force allows -X subrepo to skip the subrepo. |
|
289 subs, commitsubs, newstate = subrepoutil.precommit( |
|
290 repo.ui, wctx, tmpstatus, match, force=True) |
|
291 for s in subs: |
|
292 if s in commitsubs: |
|
293 dirtyreason = wctx.sub(s).dirtyreason(True) |
|
294 raise error.Abort(dirtyreason) |
|
295 |
273 def fail(f, msg): |
296 def fail(f, msg): |
274 raise error.Abort('%s: %s' % (f, msg)) |
297 raise error.Abort('%s: %s' % (f, msg)) |
275 |
298 |
276 force = opts.get('force') |
299 force = opts.get('force') |
277 if not force: |
300 if not force: |
278 vdirs = [] |
301 vdirs = [] |
279 match.explicitdir = vdirs.append |
302 match.explicitdir = vdirs.append |
280 match.bad = fail |
303 match.bad = fail |
281 |
304 |
282 status = repo.status(match=match) |
|
283 if not force: |
305 if not force: |
284 repo.checkcommitpatterns(wctx, vdirs, match, status, fail) |
306 repo.checkcommitpatterns(wctx, vdirs, match, status, fail) |
285 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) |
307 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) |
286 diffopts.nodates = True |
308 diffopts.nodates = True |
287 diffopts.git = True |
309 diffopts.git = True |