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

login
register
mail settings
Submitter phabricator
Date Jan. 3, 2019, 10:54 p.m.
Message ID <22e38f6c0031936393a8948210a0b496@localhost.localdomain>
Download mbox | patch
Permalink /patch/37446/
State Not Applicable
Headers show

Comments

phabricator - Jan. 3, 2019, 10:54 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG86f0ed7ac688: histedit: add warning message on editing tagged commits (issue4017) (authored by navaneeth.suresh, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5489?vs=12999&id=13000#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5489?vs=12999&id=13000

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -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()