changeset 4053:994fec0ee900

mtime can be -1 after a merge and cause tracebacks on win32. Output "unset" instead.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 30 Jan 2007 00:26:19 +0100
parents a8a8ecf909db
children e6d54283c090
files mercurial/commands.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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))