update: show "use 'hg evolve' to..." hint iff evolve command enabled stable
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 24 Jan 2018 09:55:12 -0800
branchstable
changeset 3455 f7ecb11d71bb
parent 3452 8275ef099135
child 3456 b03d955e391e
child 3471 2a337fcedd5e
update: show "use 'hg evolve' to..." hint iff evolve command enabled Before this patch, one had to enable *all* commands (by including "allnewcommands" in the experimental.evolution config) for the hint to be shown.
hgext3rd/evolve/__init__.py
tests/test-evolve.t
--- a/hgext3rd/evolve/__init__.py	Mon Jan 22 14:10:59 2018 +0530
+++ b/hgext3rd/evolve/__init__.py	Wed Jan 24 09:55:12 2018 -0800
@@ -710,7 +710,8 @@
     ui.warn(msg % shortnode)
 
     # Check that evolve is activated for performance reasons
-    if ui.quiet or not obsolete.isenabled(repo, commandopt):
+    evolvecommandenabled = any('evolve' in e for e in cmdtable)
+    if ui.quiet or not evolvecommandenabled:
         return
 
     # Show a warning for helping the user to solve the issue
--- a/tests/test-evolve.t	Mon Jan 22 14:10:59 2018 +0530
+++ b/tests/test-evolve.t	Wed Jan 24 09:55:12 2018 -0800
@@ -1250,6 +1250,24 @@
   (use 'hg help' for the full list of commands or 'hg -v' for details)
   [255]
 
+Shows "use 'hg evolve' to..." hints iff the evolve command is enabled
+
+  $ hg --hidden up 14
+  updating to a hidden changeset 484fb3cfa7f2
+  (hidden revision '484fb3cfa7f2' was rewritten as: 98e171e2f272)
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory parent is obsolete! (484fb3cfa7f2)
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > evolutioncommands=evolve
+  > EOF
+  $ hg --hidden up 15
+  updating to a hidden changeset daa1ff1c7fbd
+  (hidden revision 'daa1ff1c7fbd' was rewritten as: 0c049e4e5422)
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory parent is obsolete! (daa1ff1c7fbd)
+  (use 'hg evolve' to update to its successor: 0c049e4e5422)
+
 Restore all of the evolution features
 
   $ cat >> $HGRCPATH <<EOF
@@ -1259,7 +1277,7 @@
 
 Check hg evolve --rev on singled out commit
   $ hg up 98e171e2f272 -C
-  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ mkcommit j1
   $ mkcommit j2
   $ mkcommit j3