changeset 35151:b45a9d121b53

py3: make sure the first argument of time.strftime() is str time.strftime() does not accepts bytes as its first argument on py3. Differential Revision: https://phab.mercurial-scm.org/D1559
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 29 Nov 2017 08:44:06 +0530
parents 08b8b56bd2e8
children c1b94f34a11a
files hgext/bugzilla.py mercurial/debugcommands.py mercurial/mail.py
diffstat 3 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bugzilla.py	Wed Nov 29 08:46:37 2017 +0530
+++ b/hgext/bugzilla.py	Wed Nov 29 08:44:06 2017 +0530
@@ -580,7 +580,7 @@
             self.ui.warn(_("Bugzilla/MySQL cannot update bug state\n"))
 
         (user, userid) = self.get_bugzilla_user(committer)
-        now = time.strftime('%Y-%m-%d %H:%M:%S')
+        now = time.strftime(r'%Y-%m-%d %H:%M:%S')
         self.run('''insert into longdescs
                     (bug_id, who, bug_when, thetext)
                     values (%s, %s, %s, %s)''',
--- a/mercurial/debugcommands.py	Wed Nov 29 08:46:37 2017 +0530
+++ b/mercurial/debugcommands.py	Wed Nov 29 08:44:06 2017 +0530
@@ -719,7 +719,7 @@
         elif nodates:
             timestr = 'set                 '
         else:
-            timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
+            timestr = time.strftime(r"%Y-%m-%d %H:%M:%S ",
                                     time.localtime(ent[3]))
         if ent[1] & 0o20000:
             mode = 'lnk'
--- a/mercurial/mail.py	Wed Nov 29 08:46:37 2017 +0530
+++ b/mercurial/mail.py	Wed Nov 29 08:44:06 2017 +0530
@@ -152,7 +152,7 @@
     fp = open(mbox, 'ab+')
     # Should be time.asctime(), but Windows prints 2-characters day
     # of month instead of one. Make them print the same thing.
-    date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime())
+    date = time.strftime(r'%a %b %d %H:%M:%S %Y', time.localtime())
     fp.write('From %s %s\n' % (sender, date))
     fp.write(msg)
     fp.write('\n\n')