Mercurial > hg-stable
changeset 1771:e22bbca2e82b
hgmerge: add and use ask_if_merged function
This patch, unlike the earlier ones, doesn't use unportable select builtin.
author | Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> |
---|---|
date | Tue, 21 Feb 2006 15:48:12 -0600 |
parents | 4eea6a747c27 |
children | b1a7fd503a29 |
files | hgmerge |
diffstat | 1 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgmerge Tue Feb 21 15:48:09 2006 -0600 +++ b/hgmerge Tue Feb 21 15:48:12 2006 -0600 @@ -70,6 +70,18 @@ exit 1 } +# Ask if the merge was successful +ask_if_merged() { + while 1; do + echo "$LOCAL seems unchanged. Was the merge successful? [y/n]" + read answer + case answer in + y*|Y*) success;; + n*|N*) failure;; + esac + done +} + # Clean up when interrupted trap "failure" 1 2 3 6 15 # HUP INT QUIT ABRT TERM @@ -98,16 +110,7 @@ # filemerge prefers the right by default $FILEMERGE -left "$OTHER" -right "$LOCAL" -ancestor "$BASE" -merge "$LOCAL" [ $? -ne 0 ] && echo "FileMerge failed to launch" && failure - if test "$LOCAL" -nt "$CHGTEST" - then - success - else - echo "$LOCAL seems unchanged. Was the merge successful?" - select answer in yes no - do - test "$answer" == "yes" && success || failure - done - fi + test "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged failure fi