Patchwork [1,of,5] journal: use fm.hexfunc() to get full hash in JSON/template output (BC)

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 3, 2016, 1:04 p.m.
Message ID <fc0ddb2c7e8fe36be80e.1470229464@mimosa>
Download mbox | patch
Permalink /patch/16051/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 3, 2016, 1:04 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1469950696 -32400
#      Sun Jul 31 16:38:16 2016 +0900
# Node ID fc0ddb2c7e8fe36be80e5634702956eb7aebf0f8
# Parent  bdc81970853df8bdf0f470095af334d5b51b2ba6
journal: use fm.hexfunc() to get full hash in JSON/template output (BC)

We generally do that.

Patch

diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -475,8 +475,8 @@  def journal(ui, repo, *args, **opts):
     for count, entry in enumerate(repo.journal.filtered(name=name)):
         if count == limit:
             break
-        newhashesstr = ','.join([node.short(hash) for hash in entry.newhashes])
-        oldhashesstr = ','.join([node.short(hash) for hash in entry.oldhashes])
+        newhashesstr = ','.join([fm.hexfunc(hash) for hash in entry.newhashes])
+        oldhashesstr = ','.join([fm.hexfunc(hash) for hash in entry.oldhashes])
 
         fm.startitem()
         fm.condwrite(ui.verbose, 'oldhashes', '%s -> ', oldhashesstr)
diff --git a/tests/test-journal.t b/tests/test-journal.t
--- a/tests/test-journal.t
+++ b/tests/test-journal.t
@@ -148,32 +148,32 @@  Test that verbose, JSON and commit outpu
     "command": "up",
     "date": "1970-01-01 00:00 +0000",
     "name": ".",
-    "newhashes": "1e6c11564562",
-    "oldhashes": "cb9a9f314b8b",
+    "newhashes": "1e6c11564562b4ed919baca798bc4338bd299d6a",
+    "oldhashes": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
     "user": "foobar"
    },
    {
     "command": "up 0",
     "date": "1970-01-01 00:00 +0000",
     "name": ".",
-    "newhashes": "cb9a9f314b8b",
-    "oldhashes": "1e6c11564562",
+    "newhashes": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
+    "oldhashes": "1e6c11564562b4ed919baca798bc4338bd299d6a",
     "user": "foobar"
    },
    {
     "command": "commit -Aqm b",
     "date": "1970-01-01 00:00 +0000",
     "name": ".",
-    "newhashes": "1e6c11564562",
-    "oldhashes": "cb9a9f314b8b",
+    "newhashes": "1e6c11564562b4ed919baca798bc4338bd299d6a",
+    "oldhashes": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
     "user": "foobar"
    },
    {
     "command": "commit -Aqm a",
     "date": "1970-01-01 00:00 +0000",
     "name": ".",
-    "newhashes": "cb9a9f314b8b",
-    "oldhashes": "000000000000",
+    "newhashes": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
+    "oldhashes": "0000000000000000000000000000000000000000",
     "user": "foobar"
    }
   ]