Patchwork [1,of,5] journal: unify template name for "nodes" (BC)

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 15, 2018, 1:54 a.m.
Message ID <7fc475b38d3ab1412970.1536976445@mimosa>
Download mbox | patch
Permalink /patch/34662/
State New
Headers show

Comments

Yuya Nishihara - Sept. 15, 2018, 1:54 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1535928523 -32400
#      Mon Sep 03 07:48:43 2018 +0900
# Node ID 7fc475b38d3ab14129708dd72b7ffc37aacb7fa7
# Parent  3a3364720695f26ceee3cd0a056fda59251f4ca5
journal: unify template name for "nodes" (BC)

This is a part of the name unification.

https://www.mercurial-scm.org/wiki/GenericTemplatingPlan#Dictionary

.. bc::

   ``{oldhashes}`` and ``{newhashes}`` in journal template are renamed to
   ``{oldnodes}`` and ``{newnodes}`` respectively.

Patch

diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -497,8 +497,8 @@  def journal(ui, repo, *args, **opts):
                                      name='node', sep=',')
 
         fm.startitem()
-        fm.condwrite(ui.verbose, 'oldhashes', '%s -> ', oldhashesstr)
-        fm.write('newhashes', '%s', newhashesstr)
+        fm.condwrite(ui.verbose, 'oldnodes', '%s -> ', oldhashesstr)
+        fm.write('newnodes', '%s', newhashesstr)
         fm.condwrite(ui.verbose, 'user', ' %-8s', entry.user)
         fm.condwrite(
             opts.get('all') or name.startswith('re:'),
diff --git a/tests/test-journal.t b/tests/test-journal.t
--- a/tests/test-journal.t
+++ b/tests/test-journal.t
@@ -149,44 +149,44 @@  Test that verbose, JSON, template and co
     "command": "up",
     "date": [5, 0],
     "name": ".",
-    "newhashes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
-    "oldhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
+    "newnodes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
+    "oldnodes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
     "user": "foobar"
    },
    {
     "command": "up 0",
     "date": [2, 0],
     "name": ".",
-    "newhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
-    "oldhashes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
+    "newnodes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
+    "oldnodes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
     "user": "foobar"
    },
    {
     "command": "commit -Aqm b",
     "date": [1, 0],
     "name": ".",
-    "newhashes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
-    "oldhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
+    "newnodes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
+    "oldnodes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
     "user": "foobar"
    },
    {
     "command": "commit -Aqm a",
     "date": [0, 0],
     "name": ".",
-    "newhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
-    "oldhashes": ["0000000000000000000000000000000000000000"],
+    "newnodes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
+    "oldnodes": ["0000000000000000000000000000000000000000"],
     "user": "foobar"
    }
   ]
 
   $ cat <<EOF >> $HGRCPATH
   > [templates]
-  > j = "{oldhashes % '{node|upper}'} -> {newhashes % '{node|upper}'}
+  > j = "{oldnodes % '{node|upper}'} -> {newnodes % '{node|upper}'}
   >      - user: {user}
   >      - command: {command}
   >      - date: {date|rfc3339date}
-  >      - newhashes: {newhashes}
-  >      - oldhashes: {oldhashes}
+  >      - newnodes: {newnodes}
+  >      - oldnodes: {oldnodes}
   >      "
   > EOF
   $ hg journal -Tj -l1
@@ -195,8 +195,8 @@  Test that verbose, JSON, template and co
   - user: foobar
   - command: up
   - date: 1970-01-01T00:00:05+00:00
-  - newhashes: 1e6c11564562b4ed919baca798bc4338bd299d6a
-  - oldhashes: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+  - newnodes: 1e6c11564562b4ed919baca798bc4338bd299d6a
+  - oldnodes: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
 
   $ hg journal --commit
   previous locations of '.':