6506376b04a1

Add timestamps to the diff previews.
[view raw] [browse files]
author Steve Losh <steve@dwaiter.com>
date Tue, 12 Oct 2010 22:23:38 -0400
parents ef0fbc6e5e62
children 3bf27b8bd6c2
branches/tags (none)
files plugin/gundo.vim

Changes

--- a/plugin/gundo.vim	Tue Oct 12 20:20:37 2010 -0400
+++ b/plugin/gundo.vim	Tue Oct 12 22:23:38 2010 -0400
@@ -653,8 +653,12 @@
     _goto_window_for_buffer_name('__Gundo_Preview__')
     vim.command('setlocal modifiable')
 
-    # TODO: Make some nice dates from Node.time to give to difflib.
-    diff = list(difflib.unified_diff(before, after, node_before.n, node_after.n))
+    def _fmt_time(t):
+        return time.strftime('%Y-%m-%d %I:%M:%S %p', time.localtime(float(t)))
+
+    diff = list(difflib.unified_diff(before, after, node_before.n, node_after.n,
+                                     _fmt_time(node_before.time) if node_before.n else 'n/a',
+                                     _fmt_time(node_after.time)))
     vim.current.buffer[:] = diff
 
     vim.command('setlocal nomodifiable')