diff mercurial/filemerge.py @ 26898:33eb8a56d0c9

filemerge: treat EOF at prompt as fail, not abort Previously we'd abort the merge entirely if there was an EOF at the prompt. This is unnecessary -- it's much better to simply fail and treat the file as unresolved instead.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 10 Nov 2015 17:13:16 -0800
parents 19c4b93cb7d6
children 454deda24315
line wrap: on
line diff
--- a/mercurial/filemerge.py	Tue Nov 10 17:10:47 2015 -0800
+++ b/mercurial/filemerge.py	Tue Nov 10 17:13:16 2015 -0800
@@ -175,15 +175,19 @@
     ui = repo.ui
     fd = fcd.path()
 
-    index = ui.promptchoice(_(" no tool found to merge %s\n"
-                              "keep (l)ocal or take (o)ther?"
-                              "$$ &Local $$ &Other") % fd, 0)
-    choice = ['local', 'other'][index]
+    try:
+        index = ui.promptchoice(_(" no tool found to merge %s\n"
+                                  "keep (l)ocal or take (o)ther?"
+                                  "$$ &Local $$ &Other") % fd, 0)
+        choice = ['local', 'other'][index]
 
-    if choice == 'other':
-        return _iother(repo, mynode, orig, fcd, fco, fca, toolconf)
-    else:
-        return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf)
+        if choice == 'other':
+            return _iother(repo, mynode, orig, fcd, fco, fca, toolconf)
+        else:
+            return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf)
+    except error.ResponseExpected:
+        ui.write("\n")
+        return 1
 
 @internaltool('local', nomerge)
 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf):