428 Commit changes to the given files into the repository. |
428 Commit changes to the given files into the repository. |
429 |
429 |
430 If a list of files is omitted, all changes reported by "hg status" |
430 If a list of files is omitted, all changes reported by "hg status" |
431 will be committed. |
431 will be committed. |
432 |
432 |
433 If no commit message is specified, the editor configured in your hgrc |
433 If no commit message is specified, the configured editor is started to |
434 or in the EDITOR environment variable is started to enter a message. |
434 enter a message. |
435 """ |
435 """ |
436 def commitfunc(ui, repo, files, message, match, opts): |
436 def commitfunc(ui, repo, files, message, match, opts): |
437 return repo.commit(files, message, opts['user'], opts['date'], match, |
437 return repo.commit(files, message, opts['user'], opts['date'], match, |
438 force_editor=opts.get('force_editor')) |
438 force_editor=opts.get('force_editor')) |
439 cmdutil.commit(ui, repo, commitfunc, pats, opts) |
439 cmdutil.commit(ui, repo, commitfunc, pats, opts) |
746 os.unlink(fl) |
746 os.unlink(fl) |
747 os.unlink(fr) |
747 os.unlink(fr) |
748 |
748 |
749 # editor |
749 # editor |
750 ui.status(_("Checking commit editor...\n")) |
750 ui.status(_("Checking commit editor...\n")) |
751 editor = (os.environ.get("HGEDITOR") or |
751 editor = ui.geteditor() |
752 ui.config("ui", "editor") or |
|
753 os.environ.get("EDITOR", "vi")) |
|
754 cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0]) |
752 cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0]) |
755 if not cmdpath: |
753 if not cmdpath: |
756 if editor == 'vi': |
754 if editor == 'vi': |
757 ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
755 ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
758 ui.write(_(" (specify a commit editor in your .hgrc file)\n")) |
756 ui.write(_(" (specify a commit editor in your .hgrc file)\n")) |