Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/filemerge.py @ 34796:ed91846c29cf
filemerge: introduce functions to halt merge flow
Depends on D931.
This patch introduces functions and a config option that will allow a user
to halt the merge if there are failures during a file merge. These functions
will be used in the next patch.
Differential Revision: https://phab.mercurial-scm.org/D932
author | Ryan McElroy <rmcelroy@fb.com> |
---|---|
date | Fri, 06 Oct 2017 06:48:43 -0700 |
parents | 1af4561b6bfe |
children | 284fa44f7f39 |
comparison
equal
deleted
inserted
replaced
34795:530b7361e3a9 | 34796:ed91846c29cf |
---|---|
743 return True, r, deleted | 743 return True, r, deleted |
744 finally: | 744 finally: |
745 if not r and back is not None: | 745 if not r and back is not None: |
746 back.remove() | 746 back.remove() |
747 | 747 |
748 def _haltmerge(): | |
749 msg = _('merge halted after failed merge (see hg resolve)') | |
750 raise error.InterventionRequired(msg) | |
751 | |
752 def _onfilemergefailure(ui): | |
753 action = ui.config('merge', 'on-failure') | |
754 if action == 'prompt': | |
755 msg = _('continue merge operation (yn)?' '$$ &Yes $$ &No') | |
756 if ui.promptchoice(msg, 0) == 1: | |
757 _haltmerge() | |
758 if action == 'halt': | |
759 _haltmerge() | |
760 # default action is 'continue', in which case we neither prompt nor halt | |
761 | |
748 def _check(repo, r, ui, tool, fcd, files): | 762 def _check(repo, r, ui, tool, fcd, files): |
749 fd = fcd.path() | 763 fd = fcd.path() |
750 unused, unused, unused, back = files | 764 unused, unused, unused, back = files |
751 | 765 |
752 if not r and (_toolbool(ui, tool, "checkconflicts") or | 766 if not r and (_toolbool(ui, tool, "checkconflicts") or |