1322 _('mark new/missing files as added/removed before committing')), |
1322 _('mark new/missing files as added/removed before committing')), |
1323 ('', 'close-branch', None, |
1323 ('', 'close-branch', None, |
1324 _('mark a branch as closed, hiding it from the branch list')), |
1324 _('mark a branch as closed, hiding it from the branch list')), |
1325 ('', 'amend', None, _('amend the parent of the working dir')), |
1325 ('', 'amend', None, _('amend the parent of the working dir')), |
1326 ('s', 'secret', None, _('use the secret phase for committing')), |
1326 ('s', 'secret', None, _('use the secret phase for committing')), |
|
1327 ('e', 'edit', None, |
|
1328 _('further edit commit message already specified')), |
1327 ] + walkopts + commitopts + commitopts2 + subrepoopts, |
1329 ] + walkopts + commitopts + commitopts2 + subrepoopts, |
1328 _('[OPTION]... [FILE]...')) |
1330 _('[OPTION]... [FILE]...')) |
1329 def commit(ui, repo, *pats, **opts): |
1331 def commit(ui, repo, *pats, **opts): |
1330 """commit the specified files or all outstanding changes |
1332 """commit the specified files or all outstanding changes |
1331 |
1333 |
1360 |
1362 |
1361 See :hg:`help dates` for a list of formats valid for -d/--date. |
1363 See :hg:`help dates` for a list of formats valid for -d/--date. |
1362 |
1364 |
1363 Returns 0 on success, 1 if nothing changed. |
1365 Returns 0 on success, 1 if nothing changed. |
1364 """ |
1366 """ |
|
1367 forceeditor = opts.get('force_editor') or opts.get('edit') |
|
1368 |
1365 if opts.get('subrepos'): |
1369 if opts.get('subrepos'): |
1366 if opts.get('amend'): |
1370 if opts.get('amend'): |
1367 raise util.Abort(_('cannot amend with --subrepos')) |
1371 raise util.Abort(_('cannot amend with --subrepos')) |
1368 # Let --subrepos on the command line override config setting. |
1372 # Let --subrepos on the command line override config setting. |
1369 ui.setconfig('ui', 'commitsubrepos', True, 'commit') |
1373 ui.setconfig('ui', 'commitsubrepos', True, 'commit') |
1398 raise util.Abort(_('cannot amend while merging')) |
1402 raise util.Abort(_('cannot amend while merging')) |
1399 if (not obsolete._enabled) and old.children(): |
1403 if (not obsolete._enabled) and old.children(): |
1400 raise util.Abort(_('cannot amend changeset with children')) |
1404 raise util.Abort(_('cannot amend changeset with children')) |
1401 |
1405 |
1402 e = cmdutil.commiteditor |
1406 e = cmdutil.commiteditor |
1403 if opts.get('force_editor'): |
1407 if forceeditor: |
1404 e = cmdutil.commitforceeditor |
1408 e = cmdutil.commitforceeditor |
1405 |
1409 |
1406 # commitfunc is used only for temporary amend commit by cmdutil.amend |
1410 # commitfunc is used only for temporary amend commit by cmdutil.amend |
1407 def commitfunc(ui, repo, message, match, opts): |
1411 def commitfunc(ui, repo, message, match, opts): |
1408 editor = e |
1412 editor = e |
1433 if bm == current: |
1437 if bm == current: |
1434 bookmarks.setcurrent(repo, bm) |
1438 bookmarks.setcurrent(repo, bm) |
1435 newmarks.write() |
1439 newmarks.write() |
1436 else: |
1440 else: |
1437 e = cmdutil.commiteditor |
1441 e = cmdutil.commiteditor |
1438 if opts.get('force_editor'): |
1442 if forceeditor: |
1439 e = cmdutil.commitforceeditor |
1443 e = cmdutil.commitforceeditor |
1440 |
1444 |
1441 def commitfunc(ui, repo, message, match, opts): |
1445 def commitfunc(ui, repo, message, match, opts): |
1442 try: |
1446 try: |
1443 if opts.get('secret'): |
1447 if opts.get('secret'): |