Show the commit dialog. Args: files: files for pre-populating the dialog. repo: the repository. Returns: The commit msg.
(files, repo)
| 26 | |
| 27 | |
| 28 | def show(files, repo): |
| 29 | """Show the commit dialog. |
| 30 | |
| 31 | Args: |
| 32 | files: files for pre-populating the dialog. |
| 33 | repo: the repository. |
| 34 | |
| 35 | Returns: |
| 36 | The commit msg. |
| 37 | """ |
| 38 | if IS_PY2: |
| 39 | # wb because we use pprint to write |
| 40 | cf = io.open(_commit_file(repo), mode='wb') |
| 41 | else: |
| 42 | cf = io.open(_commit_file(repo), mode='w', encoding=ENCODING) |
| 43 | |
| 44 | curr_b = repo.current_branch |
| 45 | if curr_b.merge_in_progress or curr_b.fuse_in_progress: |
| 46 | merge_msg = io.open( |
| 47 | _merge_msg_file(repo), mode='r', encoding=ENCODING).read() |
| 48 | cf.write(merge_msg) |
| 49 | cf.write('\n') |
| 50 | pprint.sep(stream=cf.write) |
| 51 | pprint.msg( |
| 52 | 'Please enter the commit message for your changes above, an empty ' |
| 53 | 'message aborts', stream=cf.write) |
| 54 | pprint.msg('the commit.', stream=cf.write) |
| 55 | pprint.blank(stream=cf.write) |
| 56 | pprint.msg( |
| 57 | 'These are the files whose changes will be committed:', stream=cf.write) |
| 58 | for f in files: |
| 59 | pprint.item(f, stream=cf.write) |
| 60 | pprint.sep(stream=cf.write) |
| 61 | cf.close() |
| 62 | _launch_editor(cf.name, repo) |
| 63 | return _extract_msg(repo) |
| 64 | |
| 65 | |
| 66 | def _launch_editor(fp, repo): |
nothing calls this directly
no test coverage detected