1395 |
1395 |
1396 e = cmdutil.commiteditor |
1396 e = cmdutil.commiteditor |
1397 if opts.get('force_editor'): |
1397 if opts.get('force_editor'): |
1398 e = cmdutil.commitforceeditor |
1398 e = cmdutil.commitforceeditor |
1399 |
1399 |
|
1400 # commitfunc is used only for temporary amend commit by cmdutil.amend |
1400 def commitfunc(ui, repo, message, match, opts): |
1401 def commitfunc(ui, repo, message, match, opts): |
1401 editor = e |
1402 editor = e |
1402 # message contains text from -m or -l, if it's empty, |
1403 # message contains text from -m or -l, if it's empty, |
1403 # open the editor with the old message |
1404 # open the editor with the old message |
1404 if not message: |
1405 if not message: |
1405 message = old.description() |
1406 message = old.description() |
1406 editor = cmdutil.commitforceeditor |
1407 editor = cmdutil.commitforceeditor |
1407 try: |
1408 return repo.commit(message, |
1408 if opts.get('secret'): |
1409 opts.get('user') or old.user(), |
1409 ui.setconfig('phases', 'new-commit', 'secret') |
1410 opts.get('date') or old.date(), |
1410 |
1411 match, |
1411 return repo.commit(message, |
1412 editor=editor, |
1412 opts.get('user') or old.user(), |
1413 extra=extra) |
1413 opts.get('date') or old.date(), |
|
1414 match, |
|
1415 editor=editor, |
|
1416 extra=extra) |
|
1417 finally: |
|
1418 ui.setconfig('phases', 'new-commit', oldcommitphase) |
|
1419 |
1414 |
1420 current = repo._bookmarkcurrent |
1415 current = repo._bookmarkcurrent |
1421 marks = old.bookmarks() |
1416 marks = old.bookmarks() |
1422 node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) |
1417 node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) |
1423 if node == old.node(): |
1418 if node == old.node(): |