changeset 4983:6d40e0166522

obslog: make {node} the full node and leave shortening to template It should be up to the user to shorten the nodeid as much or as little as they like.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 04 Dec 2019 10:57:29 -0800
parents ba683c5fe932
children 2371d40f0878
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, 38 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py	Wed Dec 04 11:00:00 2019 +0100
+++ b/hgext3rd/evolve/obshistory.py	Wed Dec 04 10:57:29 2019 -0800
@@ -143,8 +143,8 @@
 
     return values
 
-TEMPLATE_MISSING_NODE = b"""{label("evolve.node evolve.missing_change_ctx", node)}"""
-TEMPLATE_PRESENT_NODE = b"""{label("evolve.node", node)} {label("evolve.rev", "({rev})")} {label("evolve.short_description", desc|firstline)}"""
+TEMPLATE_MISSING_NODE = b"""{label("evolve.node evolve.missing_change_ctx", node|short)}"""
+TEMPLATE_PRESENT_NODE = b"""{label("evolve.node", node|short)} {label("evolve.rev", "({rev})")} {label("evolve.short_description", desc|firstline)}"""
 TEMPLATE_FIRST_LINE = b"""{if(rev, "%(presentnode)s", "%(missingnode)s")}""" % {
     b"presentnode": TEMPLATE_PRESENT_NODE,
     b"missingnode": TEMPLATE_MISSING_NODE
@@ -516,8 +516,8 @@
 
     fm.startitem()
     fm.context(ctx=ctx)
-    fm.write(b'node', b'%s', bytes(ctx),
-             label=b"evolve.node")
+    fm.data(node=ctx.hex())
+    fm.plain(b'%s' % bytes(ctx), label=b"evolve.node")
     fm.plain(b' ')
 
     fm.plain(b'(%d)' % ctx.rev(), label=b"evolve.rev")
@@ -528,9 +528,9 @@
     fm.plain(b'\n')
 
 def _debugobshistorydisplaymissingctx(fm, nodewithoutctx):
-    hexnode = nodemod.short(nodewithoutctx)
     fm.startitem()
-    fm.write(b'node', b'%s', hexnode,
+    fm.data(node=nodemod.hex(nodewithoutctx))
+    fm.plain(nodemod.short(nodewithoutctx),
              label=b"evolve.node evolve.missing_change_ctx")
     fm.plain(b'\n')
 
--- a/tests/test-evolve-cycles.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-cycles.t	Wed Dec 04 10:57:29 2019 -0800
@@ -313,7 +313,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "868d2e0eb19c",
+          "node": "868d2e0eb19c2b55a2894d37e1c435c221384d48",
           "shortdescription": "D"
       },
       {
@@ -336,7 +336,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "d9f908fde1a1",
+          "node": "d9f908fde1a10ad198a462a3ec8b440bb397fc9c",
           "shortdescription": "F"
       },
       {
@@ -359,7 +359,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "0da815c333f6",
+          "node": "0da815c333f6364b46c86b0a897c00eb617397b6",
           "shortdescription": "E"
       },
       {
@@ -383,7 +383,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "a8df460dbbfe",
+          "node": "a8df460dbbfe9ef0c1e5ab4fff02e9514672e379",
           "shortdescription": "C"
       },
       {
@@ -406,7 +406,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "c473644ee0e9",
+          "node": "c473644ee0e988d7f537e31423831bbc409f12f7",
           "shortdescription": "B"
       },
       {
@@ -429,7 +429,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "2a34000d3544",
+          "node": "2a34000d35446022104f7a091c06fe21ff2b5912",
           "shortdescription": "A"
       }
   ]
--- a/tests/test-evolve-obshistory-amend-then-fold.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-obshistory-amend-then-fold.t	Wed Dec 04 10:57:29 2019 -0800
@@ -152,7 +152,7 @@
   [
       {
           "markers": [],
-          "node": "eb5a0daa2192",
+          "node": "eb5a0daa21923bbf8caeb2c42085b9e463861fd0",
           "shortdescription": "C0"
       },
       {
@@ -175,7 +175,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "b7ea6d14e664",
+          "node": "b7ea6d14e664bdc8922221f7992631b50da3fb07",
           "shortdescription": "B1"
       },
       {
@@ -196,7 +196,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "0dec01379d3b",
+          "node": "0dec01379d3be6318c470ead31b1fe7ae7cb53d5",
           "shortdescription": "B0"
       },
       {
@@ -218,7 +218,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "471f378eab4c",
+          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
           "shortdescription": "A0"
       }
   ]
--- a/tests/test-evolve-obshistory-amend.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-obshistory-amend.t	Wed Dec 04 10:57:29 2019 -0800
@@ -115,7 +115,7 @@
 
 Test that content diff works with templating
   $ hg obslog --color=debug --patch 4ae3a4151de9 \
-  > -T '{node} {desc|firstline}\n{markers % "patch:\n```{patch}```\n"}'
+  > -T '{node|short} {desc|firstline}\n{markers % "patch:\n```{patch}```\n"}'
   @  4ae3a4151de9 A1
   |
   x  471f378eab4c A0
@@ -145,7 +145,7 @@
   [
       {
           "markers": [],
-          "node": "4ae3a4151de9",
+          "node": "4ae3a4151de9aa872113f0b196e28323308981e8",
           "shortdescription": "A1"
       },
       {
@@ -167,7 +167,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "471f378eab4c",
+          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
           "shortdescription": "A0"
       }
   ]
@@ -212,7 +212,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "471f378eab4c",
+          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
           "shortdescription": "A0"
       }
   ]
@@ -375,7 +375,7 @@
   
 Test that description diff works with templating
   $ hg obslog --color=debug --patch 92210308515b \
-  > -T '{node} {desc|firstline}\n{markers % "description diff:\n```{descdiff}```\n"}'
+  > -T '{node|short} {desc|firstline}\n{markers % "description diff:\n```{descdiff}```\n"}'
   @  92210308515b A3
   |
   x  4f1685185907 A2
--- a/tests/test-evolve-obshistory-content-divergent.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-obshistory-content-divergent.t	Wed Dec 04 10:57:29 2019 -0800
@@ -155,7 +155,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "471f378eab4c",
+          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
           "shortdescription": "A0"
       }
   ]
@@ -283,7 +283,7 @@
   [
       {
           "markers": [],
-          "node": "65b757b745b9",
+          "node": "65b757b745b935093c87a2bccd877521cccffcbd",
           "shortdescription": "A2"
       },
       {
@@ -319,12 +319,12 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "471f378eab4c",
+          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
           "shortdescription": "A0"
       },
       {
           "markers": [],
-          "node": "fdf9bde5129a",
+          "node": "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e",
           "shortdescription": "A1"
       }
   ]
--- a/tests/test-evolve-obshistory-fold.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-obshistory-fold.t	Wed Dec 04 10:57:29 2019 -0800
@@ -172,7 +172,7 @@
   [
       {
           "markers": [],
-          "node": "eb5a0daa2192",
+          "node": "eb5a0daa21923bbf8caeb2c42085b9e463861fd0",
           "shortdescription": "C0"
       },
       {
@@ -194,7 +194,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "471f378eab4c",
+          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
           "shortdescription": "A0"
       },
       {
@@ -217,7 +217,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "0dec01379d3b",
+          "node": "0dec01379d3be6318c470ead31b1fe7ae7cb53d5",
           "shortdescription": "B0"
       }
   ]
--- a/tests/test-evolve-obshistory-lots-of-splits.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-obshistory-lots-of-splits.t	Wed Dec 04 10:57:29 2019 -0800
@@ -216,7 +216,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "de7290d8b885",
+          "node": "de7290d8b885925115bb9e88887252dfc20ef2a8",
           "shortdescription": "A0"
       }
   ]
@@ -231,7 +231,7 @@
   [
       {
           "markers": [],
-          "node": "c7f044602e9b",
+          "node": "c7f044602e9bd5dec6528b33114df3d0221e6359",
           "shortdescription": "A0"
       },
       {
@@ -256,7 +256,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "de7290d8b885",
+          "node": "de7290d8b885925115bb9e88887252dfc20ef2a8",
           "shortdescription": "A0"
       }
   ]
--- a/tests/test-evolve-obshistory-phase-divergent.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-obshistory-phase-divergent.t	Wed Dec 04 10:57:29 2019 -0800
@@ -113,7 +113,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "471f378eab4c",
+          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
           "shortdescription": "A0"
       }
   ]
@@ -195,7 +195,7 @@
   [
       {
           "markers": [],
-          "node": "fdf9bde5129a",
+          "node": "fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e",
           "shortdescription": "A1"
       },
       {
@@ -216,7 +216,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "471f378eab4c",
+          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
           "shortdescription": "A0"
       }
   ]
--- a/tests/test-evolve-obshistory-prune.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-obshistory-prune.t	Wed Dec 04 10:57:29 2019 -0800
@@ -82,7 +82,7 @@
                   "verb": "pruned"
               }
           ],
-          "node": "0dec01379d3b",
+          "node": "0dec01379d3be6318c470ead31b1fe7ae7cb53d5",
           "shortdescription": "B0"
       }
   ]
@@ -93,7 +93,7 @@
   [
       {
           "markers": [],
-          "node": "471f378eab4c",
+          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
           "shortdescription": "A0"
       }
   ]
--- a/tests/test-evolve-obshistory-split.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-obshistory-split.t	Wed Dec 04 10:57:29 2019 -0800
@@ -133,7 +133,7 @@
                   "verb": "rewritten"
               }
           ],
-          "node": "471597cad322",
+          "node": "471597cad322d1f659bb169751be9133dad92ef3",
           "shortdescription": "A0"
       }
   ]
--- a/tests/test-evolve-obshistory.t	Wed Dec 04 11:00:00 2019 +0100
+++ b/tests/test-evolve-obshistory.t	Wed Dec 04 10:57:29 2019 -0800
@@ -170,7 +170,7 @@
   
 
   $ hg obslog 7a230b46bf61 --graph \
-  > -T '{node} {rev} {desc|firstline}\n{markers % "rewritten using {operation}"}\n'
+  > -T '{node|short} {rev} {desc|firstline}\n{markers % "rewritten using {operation}"}\n'
   o  7a230b46bf61 2 A2
   |
   x  fdf9bde5129a