py3: call strftime() with native str type
authorYuya Nishihara <yuya@tcha.org>
Mon, 13 Mar 2017 09:19:07 -0700
changeset 31449 756175623f2e
parent 31448 6419cd243017
child 31450 b3b4c487707c
py3: call strftime() with native str type Since strftime() may contain non-ascii character if locale set, we use strfrom/tolocal(). Now "hg tip" works.
mercurial/util.py
--- a/mercurial/util.py	Mon Mar 13 09:12:56 2017 -0700
+++ b/mercurial/util.py	Mon Mar 13 09:19:07 2017 -0700
@@ -1792,7 +1792,7 @@
     # because they use the gmtime() system call which is buggy on Windows
     # for negative values.
     t = datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=d)
-    s = t.strftime(format)
+    s = encoding.strtolocal(t.strftime(encoding.strfromlocal(format)))
     return s
 
 def shortdate(date=None):