# HG changeset patch # User Navaneeth Suresh # Date 2019-01-03 18:30:44 # Node ID 86f0ed7ac6886f978eee3835d2efe4b7fb2f0d8a # Parent c9a2c4d0e80f681a56935cddb6520b117ef5fcaa histedit: add warning message on editing tagged commits (issue4017) Differential Revision: https://phab.mercurial-scm.org/D5489 diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -194,6 +194,7 @@ except ImportError: import functools import os import struct +import time from mercurial.i18n import _ from mercurial import ( @@ -1692,6 +1693,18 @@ def _histedit(ui, repo, state, *freeargs _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs) + hastags = False + if revs: + revs = scmutil.revrange(repo, revs) + ctxs = [repo[rev] for rev in revs] + for ctx in ctxs: + tags = [tag for tag in ctx.tags() if tag != 'tip'] + 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) # rebuild state if goal == goalcontinue: state.read()