changeset 41103:86f0ed7ac688

histedit: add warning message on editing tagged commits (issue4017) Differential Revision: https://phab.mercurial-scm.org/D5489
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Fri, 04 Jan 2019 00:00:44 +0530
parents c9a2c4d0e80f
children 247f51cfc668
files hgext/histedit.py
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Wed Jan 02 05:12:07 2019 +0100
+++ b/hgext/histedit.py	Fri Jan 04 00:00:44 2019 +0530
@@ -194,6 +194,7 @@
 import functools
 import os
 import struct
+import time
 
 from mercurial.i18n import _
 from mercurial import (
@@ -1692,6 +1693,18 @@
 
     _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()