mtime can be -1 after a merge and cause tracebacks on win32.
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Tue, 30 Jan 2007 00:26:19 +0100
changeset 4053 994fec0ee900
parent 4052 a8a8ecf909db
child 4054 e6d54283c090
mtime can be -1 after a merge and cause tracebacks on win32. Output "unset" instead.
mercurial/commands.py
--- a/mercurial/commands.py	Thu Jan 25 17:57:51 2007 +0100
+++ b/mercurial/commands.py	Tue Jan 30 00:26:19 2007 +0100
@@ -775,10 +775,16 @@
     keys = dc.keys()
     keys.sort()
     for file_ in keys:
+        if dc[file_][3] == -1:
+            # Pad or slice to locale representation
+            locale_len = len(time.strftime("%x %X", time.localtime(0)))
+            timestr = 'unset'
+            timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr))
+        else:
+            timestr = time.strftime("%x %X", time.localtime(dc[file_][3]))
         ui.write("%c %3o %10d %s %s\n"
                  % (dc[file_][0], dc[file_][1] & 0777, dc[file_][2],
-                    time.strftime("%x %X",
-                                  time.localtime(dc[file_][3])), file_))
+                    timestr, file_))
     for f in repo.dirstate.copies():
         ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))