changeset 5168:c7ca43bba6c5

obslog: make user template property into users
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 18 Feb 2020 17:58:22 +0800
parents 471b7a4acf9b
children 897b371cd0c5
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
diffstat 10 files changed, 75 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py	Tue Feb 18 17:31:41 2020 +0800
+++ b/hgext3rd/evolve/obshistory.py	Tue Feb 18 17:58:22 2020 +0800
@@ -116,17 +116,17 @@
     b"succnodes": TEMPLATE_SUCCNODES
 }
 TEMPLATE_OPERATION = b"""{if(operation, "using {label("evolve.operation", operation)}")}"""
-TEMPLATE_USER = b"""by {label("evolve.user", user)}"""
+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", "%(user)s", "%(date)s")}%(note)s{indent(descdiff, "    ")}{indent("%(patch)s", "    ")}\n"}
+{markers %% "  {separate(" ", "%(rewrite)s", "%(operation)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"user": TEMPLATE_USER,
+    b"users": TEMPLATE_USERS,
     b"date": TEMPLATE_DATE,
     b"note": TEMPLATE_NOTE,
     b"patch": TEMPLATE_PATCH,
@@ -521,7 +521,9 @@
     if operation:
         fm.data(operation=operation)
 
-    fm.data(user=metadata[b'user'])
+    # Users
+    users = obsutil.markersusers([marker])
+    fm.data(users=fm.formatlist(users, name=b'user', sep=b', '))
 
     fm.data(date=date)
 
--- a/tests/test-evolve-cycles.t	Tue Feb 18 17:31:41 2020 +0800
+++ b/tests/test-evolve-cycles.t	Tue Feb 18 17:58:22 2020 +0800
@@ -309,7 +309,9 @@
                   "succnodes": [
                       "0da815c333f6364b46c86b0a897c00eb617397b6"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "rewritten"
               }
           ],
@@ -332,7 +334,9 @@
                   "succnodes": [
                       "868d2e0eb19c2b55a2894d37e1c435c221384d48"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "rewritten"
               }
           ],
@@ -355,7 +359,9 @@
                   "succnodes": [
                       "d9f908fde1a10ad198a462a3ec8b440bb397fc9c"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "rewritten"
               }
           ],
@@ -379,7 +385,9 @@
                       "2a34000d35446022104f7a091c06fe21ff2b5912",
                       "868d2e0eb19c2b55a2894d37e1c435c221384d48"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "split"
               }
           ],
@@ -402,7 +410,9 @@
                   "succnodes": [
                       "a8df460dbbfe9ef0c1e5ab4fff02e9514672e379"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "rewritten"
               }
           ],
@@ -425,7 +435,9 @@
                   "succnodes": [
                       "c473644ee0e988d7f537e31423831bbc409f12f7"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "rewritten"
               }
           ],
--- a/tests/test-evolve-obshistory-amend-then-fold.t	Tue Feb 18 17:31:41 2020 +0800
+++ b/tests/test-evolve-obshistory-amend-then-fold.t	Tue Feb 18 17:58:22 2020 +0800
@@ -171,7 +171,9 @@
                   "succnodes": [
                       "eb5a0daa21923bbf8caeb2c42085b9e463861fd0"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "folded"
               }
           ],
@@ -192,7 +194,9 @@
                   "succnodes": [
                       "b7ea6d14e664bdc8922221f7992631b50da3fb07"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "reworded"
               }
           ],
@@ -214,7 +218,9 @@
                   "succnodes": [
                       "eb5a0daa21923bbf8caeb2c42085b9e463861fd0"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "folded"
               }
           ],
--- a/tests/test-evolve-obshistory-amend.t	Tue Feb 18 17:31:41 2020 +0800
+++ b/tests/test-evolve-obshistory-amend.t	Tue Feb 18 17:58:22 2020 +0800
@@ -163,7 +163,9 @@
                   "succnodes": [
                       "4ae3a4151de9aa872113f0b196e28323308981e8"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "rewritten"
               }
           ],
@@ -208,7 +210,9 @@
                   "succnodes": [
                       "4ae3a4151de9aa872113f0b196e28323308981e8"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "rewritten"
               }
           ],
--- a/tests/test-evolve-obshistory-content-divergent.t	Tue Feb 18 17:31:41 2020 +0800
+++ b/tests/test-evolve-obshistory-content-divergent.t	Tue Feb 18 17:58:22 2020 +0800
@@ -140,7 +140,9 @@
                   "succnodes": [
                       "65b757b745b935093c87a2bccd877521cccffcbd"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "reworded"
               },
               {
@@ -155,7 +157,9 @@
                   "succnodes": [
                       "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "reworded"
               }
           ],
@@ -304,7 +308,9 @@
                   "succnodes": [
                       "65b757b745b935093c87a2bccd877521cccffcbd"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "reworded"
               },
               {
@@ -319,7 +325,9 @@
                   "succnodes": [
                       "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "reworded"
               }
           ],
--- a/tests/test-evolve-obshistory-fold.t	Tue Feb 18 17:31:41 2020 +0800
+++ b/tests/test-evolve-obshistory-fold.t	Tue Feb 18 17:58:22 2020 +0800
@@ -190,7 +190,9 @@
                   "succnodes": [
                       "eb5a0daa21923bbf8caeb2c42085b9e463861fd0"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "folded"
               }
           ],
@@ -213,7 +215,9 @@
                   "succnodes": [
                       "eb5a0daa21923bbf8caeb2c42085b9e463861fd0"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "folded"
               }
           ],
--- a/tests/test-evolve-obshistory-lots-of-splits.t	Tue Feb 18 17:31:41 2020 +0800
+++ b/tests/test-evolve-obshistory-lots-of-splits.t	Tue Feb 18 17:58:22 2020 +0800
@@ -212,7 +212,9 @@
                       "c7f044602e9bd5dec6528b33114df3d0221e6359",
                       "f257fde29c7a847c9b607f6e958656d0df0fb15c"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "split"
               }
           ],
@@ -252,7 +254,9 @@
                       "c7f044602e9bd5dec6528b33114df3d0221e6359",
                       "f257fde29c7a847c9b607f6e958656d0df0fb15c"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "split"
               }
           ],
--- a/tests/test-evolve-obshistory-phase-divergent.t	Tue Feb 18 17:31:41 2020 +0800
+++ b/tests/test-evolve-obshistory-phase-divergent.t	Tue Feb 18 17:58:22 2020 +0800
@@ -109,7 +109,9 @@
                   "succnodes": [
                       "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "reworded"
               }
           ],
@@ -212,7 +214,9 @@
                   "succnodes": [
                       "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "reworded"
               }
           ],
--- a/tests/test-evolve-obshistory-prune.t	Tue Feb 18 17:31:41 2020 +0800
+++ b/tests/test-evolve-obshistory-prune.t	Tue Feb 18 17:58:22 2020 +0800
@@ -78,7 +78,9 @@
                       0
                   ],
                   "operation": "prune",
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "pruned"
               }
           ],
--- a/tests/test-evolve-obshistory-split.t	Tue Feb 18 17:31:41 2020 +0800
+++ b/tests/test-evolve-obshistory-split.t	Tue Feb 18 17:58:22 2020 +0800
@@ -129,7 +129,9 @@
                       "337fec4d2edcf0e7a467e35f818234bc620068b5",
                       "f257fde29c7a847c9b607f6e958656d0df0fb15c"
                   ],
-                  "user": "test",
+                  "users": [
+                      "test"
+                  ],
                   "verb": "split"
               }
           ],