[PATCH 5 of 5] journal: use fm.formatdate() to pass date tuple in appropriate type (BC)

Yuya Nishihara yuya at tcha.org
Wed Aug 3 09:04:28 EDT 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1469952708 -32400
#      Sun Jul 31 17:11:48 2016 +0900
# Node ID 1d44d617da9fc6d520341771daaabcb2537bf255
# Parent  2e03c852e430516e4bc881cb0b70a6ec922cf5bf
journal: use fm.formatdate() to pass date tuple in appropriate type (BC)

diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -488,7 +488,7 @@ def journal(ui, repo, *args, **opts):
             opts.get('all') or name.startswith('re:'),
             'name', '  %-8s', entry.name)
 
-        timestring = util.datestr(entry.timestamp, '%Y-%m-%d %H:%M %1%2')
+        timestring = fm.formatdate(entry.timestamp, '%Y-%m-%d %H:%M %1%2')
         fm.condwrite(ui.verbose, 'date', ' %s', timestring)
         fm.write('command', '  %s\n', entry.command)
 
diff --git a/tests/test-journal.t b/tests/test-journal.t
--- a/tests/test-journal.t
+++ b/tests/test-journal.t
@@ -146,7 +146,7 @@ Test that verbose, JSON, template and co
   [
    {
     "command": "up",
-    "date": "1970-01-01 00:00 +0000",
+    "date": [5.0, 0],
     "name": ".",
     "newhashes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
     "oldhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
@@ -154,7 +154,7 @@ Test that verbose, JSON, template and co
    },
    {
     "command": "up 0",
-    "date": "1970-01-01 00:00 +0000",
+    "date": [2.0, 0],
     "name": ".",
     "newhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
     "oldhashes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
@@ -162,7 +162,7 @@ Test that verbose, JSON, template and co
    },
    {
     "command": "commit -Aqm b",
-    "date": "1970-01-01 00:00 +0000",
+    "date": [1.0, 0],
     "name": ".",
     "newhashes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
     "oldhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
@@ -170,7 +170,7 @@ Test that verbose, JSON, template and co
    },
    {
     "command": "commit -Aqm a",
-    "date": "1970-01-01 00:00 +0000",
+    "date": [0.0, 0],
     "name": ".",
     "newhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
     "oldhashes": ["0000000000000000000000000000000000000000"],
@@ -183,6 +183,7 @@ Test that verbose, JSON, template and co
   > j = "{oldhashes % '{node|upper}'} -> {newhashes % '{node|upper}'}
   >      - user: {user}
   >      - command: {command}
+  >      - date: {date|rfc3339date}
   >      - newhashes: {newhashes}
   >      - oldhashes: {oldhashes}
   >      "
@@ -192,6 +193,7 @@ Test that verbose, JSON, template and co
   CB9A9F314B8B07BA71012FCDBC544B5A4D82FF5B -> 1E6C11564562B4ED919BACA798BC4338BD299D6A
   - user: foobar
   - command: up
+  - date: 1970-01-01T00:00:05+00:00
   - newhashes: 1e6c11564562b4ed919baca798bc4338bd299d6a
   - oldhashes: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
 


More information about the Mercurial-devel mailing list