[PATCH 3 of 6 evolve-ext-V2] evolve: add option to import basic commands

Laurent Charignon lcharignon at fb.com
Thu Jun 4 18:09:18 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1433456657 25200
#      Thu Jun 04 15:24:17 2015 -0700
# Node ID bbe6b4b57f1bb6d7ca29a3a6ffc5618c41c3a6fe
# Parent  b5fbf51f70fe4ecd57579b9b08ed912533a48565
evolve: add option to import basic commands

Before this patch, experimental.evolutioncommands was used to import selectively
some commands or all the commands at once. This patch introduces a groups of
commands called 'basic' encompassing 'prev' and 'next'. This group will be growing
and will contain the commands that are polished enough.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -370,7 +370,18 @@
         return
     else:
         whitelist = set()
-        for cmd in evolvecommands:
+
+        # Group of commands
+        # basic are the commands that are sufficiently polished
+        cmdgrps = {
+            'basic': ['prev','next']
+        }
+        # Expand command groups
+        expandedevolvecommands = []
+        for c in evolvecommands:
+            expandedevolvecommands.extend(cmdgrps[c] if c in cmdgrps else [c])
+
+        for cmd in expandedevolvecommands:
             matchingevolvecommands = [e for e in cmdtable.keys() if cmd in e]
             if not matchingevolvecommands:
                 raise error.Abort(_('Unknown command'))
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -1144,7 +1144,21 @@
   $ hg up db3d894869b0
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-Restore all of the evolution features
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > evolution=createmarkers
+  > evolutioncommands=basic, fold
+  > EOF
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [18] a3
+  $ hg up db3d894869b0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg fold
+  abort: no revisions specified
+  [255]
+
+restore all of the evolution features
 
   $ cat >> $HGRCPATH <<EOF
   > [experimental]


More information about the Mercurial-devel mailing list