[PATCH] ui.prompt: Show prompt and selection in non-interactive mode

Mads Kiilerich mads at kiilerich.com
Sat May 2 05:48:47 CDT 2009


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1241261315 -7200
# Node ID 41ba1dd055d26a4a75ff6e353caf82bb6754acba
# Parent  fe25c839422e33716f71241485bb0c1f33724622
ui.prompt: Show prompt and selection in non-interactive mode

ui.prompt was completely silent in non-interactive mode, unless in verbose
mode. It was fair enough that it chooses the default automatically, but it is
confusing that the message and prompt shown interactively can't be found in
scripted tests.

The prompt and selection is now .write'ed instead of .note'ed.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -276,7 +276,7 @@
         insensitive. If ui is not interactive, the default is returned.
         """
         if not self.interactive():
-            self.note(msg, ' ', default, "\n")
+            self.write(msg, ' ', default, "\n")
             return default
         while True:
             try:
diff --git a/tests/test-merge-prompt.out b/tests/test-merge-prompt.out
--- a/tests/test-merge-prompt.out
+++ b/tests/test-merge-prompt.out
@@ -4,6 +4,10 @@
 created new head
 
 # non-interactive merge
+ local changed file1 which remote deleted
+use (c)hanged version or (d)elete? c
+remote changed file2 which local deleted
+use (c)hanged version or leave (d)eleted? c
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 status:
diff --git a/tests/test-merge-tools.out b/tests/test-merge-tools.out
--- a/tests/test-merge-tools.out
+++ b/tests/test-merge-tools.out
@@ -467,6 +467,8 @@
 revision 2
 space
 merging f
+ output file f appears unchanged
+was merge successful (yn)? n
 merging f failed!
 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
 use 'hg resolve' to retry unresolved file merges or 'hg up --clean' to abandon


More information about the Mercurial-devel mailing list