# HG changeset patch # User Anton Shestakov # Date 1582020431 -28800 # Node ID 897b371cd0c5b400ef575324e614b6b5cb9b9d96 # Parent c7ca43bba6c5c3dd196081413d1452fef2b1bb6a obslog: make operation template property into operations diff -r c7ca43bba6c5 -r 897b371cd0c5 hgext3rd/evolve/obshistory.py --- 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]) diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-cycles.t --- 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" ], diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-obshistory-amend-then-fold.t --- 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" ], diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-obshistory-amend.t --- 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" ], diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-obshistory-content-divergent.t --- 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" ], diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-obshistory-fold.t --- 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" ], diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-obshistory-lots-of-splits.t --- 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", diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-obshistory-phase-divergent.t --- 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" ], diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-obshistory-prune.t --- 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" ], diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-obshistory-split.t --- 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" diff -r c7ca43bba6c5 -r 897b371cd0c5 tests/test-evolve-obshistory.t --- 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