changeset 5169:897b371cd0c5

obslog: make operation template property into operations
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 18 Feb 2020 18:07:11 +0800
parents c7ca43bba6c5
children f8488bdc9e4b
files hgext3rd/evolve/obshistory.py tests/test-evolve-cycles.t tests/test-evolve-obshistory-amend-then-fold.t tests/test-evolve-obshistory-amend.t tests/test-evolve-obshistory-content-divergent.t tests/test-evolve-obshistory-fold.t tests/test-evolve-obshistory-lots-of-splits.t tests/test-evolve-obshistory-phase-divergent.t tests/test-evolve-obshistory-prune.t tests/test-evolve-obshistory-split.t tests/test-evolve-obshistory.t
diffstat 11 files changed, 77 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py	Tue Feb 18 17:58:22 2020 +0800
+++ b/hgext3rd/evolve/obshistory.py	Tue Feb 18 18:07:11 2020 +0800
@@ -115,17 +115,17 @@
     b"verb": TEMPLATE_VERB,
     b"succnodes": TEMPLATE_SUCCNODES
 }
-TEMPLATE_OPERATION = b"""{if(operation, "using {label("evolve.operation", operation)}")}"""
+TEMPLATE_OPERATIONS = b"""{if(operations, "using {label("evolve.operation", join(operations, ", "))}")}"""
 TEMPLATE_USERS = b"""by {label("evolve.user", join(users, ", "))}"""
 TEMPLATE_DATE = b"""{label("evolve.date", "({date(date, "%a %b %d %H:%M:%S %Y %1%2")})")}"""
 TEMPLATE_NOTE = b"""{if(note, "\n    note: {label("evolve.note", note)}")}"""
 TEMPLATE_PATCH = b"""{if(patch, "{patch}")}{if(nopatchreason, "\n(No patch available, {nopatchreason})")}"""
 DEFAULT_TEMPLATE = (b"""%(firstline)s
-{markers %% "  {separate(" ", "%(rewrite)s", "%(operation)s", "%(users)s", "%(date)s")}%(note)s{indent(descdiff, "    ")}{indent("%(patch)s", "    ")}\n"}
+{markers %% "  {separate(" ", "%(rewrite)s", "%(operations)s", "%(users)s", "%(date)s")}%(note)s{indent(descdiff, "    ")}{indent("%(patch)s", "    ")}\n"}
 """) % {
     b"firstline": TEMPLATE_FIRST_LINE,
     b"rewrite": TEMPLATE_REWRITE,
-    b"operation": TEMPLATE_OPERATION,
+    b"operations": TEMPLATE_OPERATIONS,
     b"users": TEMPLATE_USERS,
     b"date": TEMPLATE_DATE,
     b"note": TEMPLATE_NOTE,
@@ -517,9 +517,10 @@
         nodes = fm.formatlist(hexnodes, b'succnode')
         fm.data(succnodes=nodes)
 
-    operation = metadata.get(b'operation')
-    if operation:
-        fm.data(operation=operation)
+    # Operations
+    operations = obsutil.markersoperations([marker])
+    if operations:
+        fm.data(operations=fm.formatlist(operations, name=b'operation', sep=b', '))
 
     # Users
     users = obsutil.markersusers([marker])
--- a/tests/test-evolve-cycles.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-cycles.t	Tue Feb 18 18:07:11 2020 +0800
@@ -305,7 +305,9 @@
                       "parent",
                       "content"
                   ],
-                  "operation": "prune",
+                  "operations": [
+                      "prune"
+                  ],
                   "succnodes": [
                       "0da815c333f6364b46c86b0a897c00eb617397b6"
                   ],
@@ -330,7 +332,9 @@
                       "parent",
                       "content"
                   ],
-                  "operation": "prune",
+                  "operations": [
+                      "prune"
+                  ],
                   "succnodes": [
                       "868d2e0eb19c2b55a2894d37e1c435c221384d48"
                   ],
@@ -355,7 +359,9 @@
                       "parent",
                       "content"
                   ],
-                  "operation": "prune",
+                  "operations": [
+                      "prune"
+                  ],
                   "succnodes": [
                       "d9f908fde1a10ad198a462a3ec8b440bb397fc9c"
                   ],
@@ -380,7 +386,9 @@
                       "parent",
                       "content"
                   ],
-                  "operation": "prune",
+                  "operations": [
+                      "prune"
+                  ],
                   "succnodes": [
                       "2a34000d35446022104f7a091c06fe21ff2b5912",
                       "868d2e0eb19c2b55a2894d37e1c435c221384d48"
@@ -406,7 +414,9 @@
                       "parent",
                       "content"
                   ],
-                  "operation": "prune",
+                  "operations": [
+                      "prune"
+                  ],
                   "succnodes": [
                       "a8df460dbbfe9ef0c1e5ab4fff02e9514672e379"
                   ],
@@ -431,7 +441,9 @@
                       "parent",
                       "content"
                   ],
-                  "operation": "prune",
+                  "operations": [
+                      "prune"
+                  ],
                   "succnodes": [
                       "c473644ee0e988d7f537e31423831bbc409f12f7"
                   ],
--- a/tests/test-evolve-obshistory-amend-then-fold.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-obshistory-amend-then-fold.t	Tue Feb 18 18:07:11 2020 +0800
@@ -167,7 +167,9 @@
                       *, (glob)
                       "content"
                   ],
-                  "operation": "fold",
+                  "operations": [
+                      "fold"
+                  ],
                   "succnodes": [
                       "eb5a0daa21923bbf8caeb2c42085b9e463861fd0"
                   ],
@@ -190,7 +192,9 @@
                   "effects": [
                       "description"
                   ],
-                  "operation": "amend",
+                  "operations": [
+                      "amend"
+                  ],
                   "succnodes": [
                       "b7ea6d14e664bdc8922221f7992631b50da3fb07"
                   ],
@@ -214,7 +218,9 @@
                       "description",
                       "content"
                   ],
-                  "operation": "fold",
+                  "operations": [
+                      "fold"
+                  ],
                   "succnodes": [
                       "eb5a0daa21923bbf8caeb2c42085b9e463861fd0"
                   ],
--- a/tests/test-evolve-obshistory-amend.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-obshistory-amend.t	Tue Feb 18 18:07:11 2020 +0800
@@ -159,7 +159,9 @@
                       "description",
                       "content"
                   ],
-                  "operation": "amend",
+                  "operations": [
+                      "amend"
+                  ],
                   "succnodes": [
                       "4ae3a4151de9aa872113f0b196e28323308981e8"
                   ],
@@ -206,7 +208,9 @@
                       *, (glob)
                       "content"
                   ],
-                  "operation": "amend",
+                  "operations": [
+                      "amend"
+                  ],
                   "succnodes": [
                       "4ae3a4151de9aa872113f0b196e28323308981e8"
                   ],
--- a/tests/test-evolve-obshistory-content-divergent.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-obshistory-content-divergent.t	Tue Feb 18 18:07:11 2020 +0800
@@ -136,7 +136,9 @@
                   "effects": [
                       "description"
                   ],
-                  "operation": "amend",
+                  "operations": [
+                      "amend"
+                  ],
                   "succnodes": [
                       "65b757b745b935093c87a2bccd877521cccffcbd"
                   ],
@@ -153,7 +155,9 @@
                   "effects": [
                       "description"
                   ],
-                  "operation": "amend",
+                  "operations": [
+                      "amend"
+                  ],
                   "succnodes": [
                       "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"
                   ],
@@ -304,7 +308,9 @@
                   "effects": [
                       "description"
                   ],
-                  "operation": "amend",
+                  "operations": [
+                      "amend"
+                  ],
                   "succnodes": [
                       "65b757b745b935093c87a2bccd877521cccffcbd"
                   ],
@@ -321,7 +327,9 @@
                   "effects": [
                       "description"
                   ],
-                  "operation": "amend",
+                  "operations": [
+                      "amend"
+                  ],
                   "succnodes": [
                       "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"
                   ],
--- a/tests/test-evolve-obshistory-fold.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-obshistory-fold.t	Tue Feb 18 18:07:11 2020 +0800
@@ -186,7 +186,9 @@
                       "description",
                       "content"
                   ],
-                  "operation": "fold",
+                  "operations": [
+                      "fold"
+                  ],
                   "succnodes": [
                       "eb5a0daa21923bbf8caeb2c42085b9e463861fd0"
                   ],
@@ -211,7 +213,9 @@
                       "parent",
                       "content"
                   ],
-                  "operation": "fold",
+                  "operations": [
+                      "fold"
+                  ],
                   "succnodes": [
                       "eb5a0daa21923bbf8caeb2c42085b9e463861fd0"
                   ],
--- a/tests/test-evolve-obshistory-lots-of-splits.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-obshistory-lots-of-splits.t	Tue Feb 18 18:07:11 2020 +0800
@@ -205,7 +205,9 @@
                       "parent",
                       "content"
                   ],
-                  "operation": "split",
+                  "operations": [
+                      "split"
+                  ],
                   "succnodes": [
                       "1ae8bc733a14e374f11767d2ad128d4c891dc43f",
                       "337fec4d2edcf0e7a467e35f818234bc620068b5",
@@ -247,7 +249,9 @@
                       "parent",
                       "content"
                   ],
-                  "operation": "split",
+                  "operations": [
+                      "split"
+                  ],
                   "succnodes": [
                       "1ae8bc733a14e374f11767d2ad128d4c891dc43f",
                       "337fec4d2edcf0e7a467e35f818234bc620068b5",
--- a/tests/test-evolve-obshistory-phase-divergent.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-obshistory-phase-divergent.t	Tue Feb 18 18:07:11 2020 +0800
@@ -105,7 +105,9 @@
                   "effects": [
                       "description"
                   ],
-                  "operation": "amend",
+                  "operations": [
+                      "amend"
+                  ],
                   "succnodes": [
                       "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"
                   ],
@@ -210,7 +212,9 @@
                   "effects": [
                       "description"
                   ],
-                  "operation": "amend",
+                  "operations": [
+                      "amend"
+                  ],
                   "succnodes": [
                       "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"
                   ],
--- a/tests/test-evolve-obshistory-prune.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-obshistory-prune.t	Tue Feb 18 18:07:11 2020 +0800
@@ -77,7 +77,9 @@
                       *, (glob)
                       0
                   ],
-                  "operation": "prune",
+                  "operations": [
+                      "prune"
+                  ],
                   "users": [
                       "test"
                   ],
--- a/tests/test-evolve-obshistory-split.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-obshistory-split.t	Tue Feb 18 18:07:11 2020 +0800
@@ -124,7 +124,9 @@
                       "content"
                   ],
                   "note": "testing split",
-                  "operation": "split",
+                  "operations": [
+                      "split"
+                  ],
                   "succnodes": [
                       "337fec4d2edcf0e7a467e35f818234bc620068b5",
                       "f257fde29c7a847c9b607f6e958656d0df0fb15c"
--- a/tests/test-evolve-obshistory.t	Tue Feb 18 17:58:22 2020 +0800
+++ b/tests/test-evolve-obshistory.t	Tue Feb 18 18:07:11 2020 +0800
@@ -170,7 +170,7 @@
   
 
   $ hg obslog 7a230b46bf61 --graph \
-  > -T '{node|short} {rev} {desc|firstline}\n{markers % "rewritten using {operation}"}\n'
+  > -T '{node|short} {rev} {desc|firstline}\n{markers % "rewritten using {operations}"}\n'
   o  7a230b46bf61 2 A2
   |
   x  fdf9bde5129a