changeset 28592:cdbd9c0c0775

histedit: add a hint about enabled dropmissing to histedit edit comment Adds a hint to histedit comment reminding user about enabled dropmissing. This will make the enabled dropmissing more visible. The example comment: # Edit history between b592564a803c and b54649a8a63f # # Commits are listed from least to most recent # # You can reorder changesets by reordering the lines # # Commands: # # e, edit = use commit, but stop for amending # m, mess = edit commit message without changing commit content # p, pick = use commit # b, base = checkout changeset and apply further changesets from there # d, drop = remove commit from history # f, fold = use commit, but combine it with the one above # r, roll = like fold, but discard this commit's description # # Deleting a changeset from the list will DISCARD it from the edited history!
author Mateusz Kwapich <mitrandir@fb.com>
date Sat, 19 Mar 2016 11:39:13 -0700
parents f29cab5c519c
children e60c492a0d9b
files hgext/histedit.py
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Sat Mar 19 13:51:00 2016 -0700
+++ b/hgext/histedit.py	Sat Mar 19 11:39:13 2016 -0700
@@ -220,13 +220,14 @@
 tertiaryactions = set()
 internalactions = set()
 
-def geteditcomment(first, last):
+def geteditcomment(ui, first, last):
     """ construct the editor comment
     The comment includes::
      - an intro
      - sorted primary commands
      - sorted short commands
      - sorted long commands
+     - additional hints
 
     Commands are only included once.
     """
@@ -255,8 +256,14 @@
         addverb(v)
     actions.append('')
 
-    return ''.join(['# %s\n' % l if l else '#\n'
-                    for l in ((intro % (first, last)).split('\n')) + actions])
+    hints = []
+    if ui.configbool('histedit', 'dropmissing'):
+        hints.append("Deleting a changeset from the list "
+                     "will DISCARD it from the edited history!")
+
+    lines = (intro % (first, last)).split('\n') + actions + hints
+
+    return ''.join(['# %s\n' % l if l else '#\n' for l in lines])
 
 class histeditstate(object):
     def __init__(self, repo, parentctxnode=None, actions=None, keep=None,
@@ -1193,7 +1200,8 @@
 def _edithisteditplan(ui, repo, state, rules):
     state.read()
     if not rules:
-        comment = geteditcomment(node.short(state.parentctxnode),
+        comment = geteditcomment(ui,
+                                 node.short(state.parentctxnode),
                                  node.short(state.topmost))
         rules = ruleeditor(repo, ui, state.actions, comment)
     else:
@@ -1234,7 +1242,7 @@
 
     ctxs = [repo[r] for r in revs]
     if not rules:
-        comment = geteditcomment(node.short(root), node.short(topmost))
+        comment = geteditcomment(ui, node.short(root), node.short(topmost))
         actions = [pick(state, r) for r in revs]
         rules = ruleeditor(repo, ui, actions, comment)
     else: