Mercurial > hg
comparison hgext/histedit.py @ 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 | 86f0ed7ac688 |
children | a3a24ad10efb |
comparison
equal
deleted
inserted
replaced
41150:b05eb98a6b67 | 41151:7b7e081f8954 |
---|---|
192 termios = None | 192 termios = None |
193 | 193 |
194 import functools | 194 import functools |
195 import os | 195 import os |
196 import struct | 196 import struct |
197 import time | |
198 | 197 |
199 from mercurial.i18n import _ | 198 from mercurial.i18n import _ |
200 from mercurial import ( | 199 from mercurial import ( |
201 bundle2, | 200 bundle2, |
202 cmdutil, | 201 cmdutil, |
1700 for ctx in ctxs: | 1699 for ctx in ctxs: |
1701 tags = [tag for tag in ctx.tags() if tag != 'tip'] | 1700 tags = [tag for tag in ctx.tags() if tag != 'tip'] |
1702 if not hastags: | 1701 if not hastags: |
1703 hastags = len(tags) | 1702 hastags = len(tags) |
1704 if hastags: | 1703 if hastags: |
1705 ui.warn(_('warning: tags associated with the given changeset ' | 1704 if ui.promptchoice(_('warning: tags associated with the given' |
1706 'will be lost after histedit \n')) | 1705 ' changeset will be lost after histedit. \n' |
1707 time.sleep(1) | 1706 'do you want to continue (yN)? $$ &Yes $$ &No'), default=1): |
1707 raise error.Abort(_('histedit cancelled\n')) | |
1708 # rebuild state | 1708 # rebuild state |
1709 if goal == goalcontinue: | 1709 if goal == goalcontinue: |
1710 state.read() | 1710 state.read() |
1711 state = bootstrapcontinue(ui, state, opts) | 1711 state = bootstrapcontinue(ui, state, opts) |
1712 elif goal == goaleditplan: | 1712 elif goal == goaleditplan: |