changeset 41151:7b7e081f8954

histedit: add user input to warning message on editing tagged commits This is a follow-up patch to D5489. Now, the user will be able to input yes/no(default) on the warning message. Initially, it was the sleep of 1s and histedit window opens. Changes were made as suggested by @mharbison72 and @yuja. Differential Revision: https://phab.mercurial-scm.org/D5494
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Sun, 06 Jan 2019 09:34:41 +0530
parents b05eb98a6b67
children 191fac9ff9d3
files hgext/histedit.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Mon Dec 24 16:04:52 2018 +0300
+++ b/hgext/histedit.py	Sun Jan 06 09:34:41 2019 +0530
@@ -194,7 +194,6 @@
 import functools
 import os
 import struct
-import time
 
 from mercurial.i18n import _
 from mercurial import (
@@ -1702,9 +1701,10 @@
             if not hastags:
                 hastags = len(tags)
     if hastags:
-        ui.warn(_('warning: tags associated with the given changeset '
-        'will be lost after histedit \n'))
-        time.sleep(1)
+        if ui.promptchoice(_('warning: tags associated with the given'
+            ' changeset will be lost after histedit. \n'
+            'do you want to continue (yN)? $$ &Yes $$ &No'), default=1):
+            raise error.Abort(_('histedit cancelled\n'))
     # rebuild state
     if goal == goalcontinue:
         state.read()