D5489: histedit: add warning message on editing tagged commits (issue4017)

navaneeth.suresh (Navaneeth Suresh) phabricator at mercurial-scm.org
Thu Jan 3 18:33:16 UTC 2019


navaneeth.suresh created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5489

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -184,6 +184,7 @@
 from __future__ import absolute_import
 
 import os
+import time
 
 from mercurial.i18n import _
 from mercurial import (
@@ -1117,6 +1118,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()



To: navaneeth.suresh, durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list