5e54f8f1c22e

Add Python 2.4 compatibility.
[view raw] [browse files]
author Vincent Driessen <vincent@datafox.nl>
date Tue, 19 Oct 2010 09:37:54 +0200
parents 40049e1b235d
children 559c8e719675
branches/tags (none)
files plugin/gundo.vim

Changes

--- a/plugin/gundo.vim	Mon Oct 18 16:21:51 2010 -0400
+++ b/plugin/gundo.vim	Tue Oct 19 09:37:54 2010 +0200
@@ -463,9 +463,15 @@
     seen, state = [], [0, 0]
     buf = Buffer()
     for node, parents in list(dag):
-        age_label = age(int(node.time)) if node.time else 'Original'
+        if node.time:
+            age_label = age(int(node.time))
+        else:
+            age_label = 'Original'
         line = '[%s] %s' % (node.n, age_label)
-        char = '@' if node.n == current else 'o'
+        if node.n == current:
+            char = '@'
+        else:
+            char = 'o'
         ascii(buf, state, 'C', char, [line], edgefn(seen, node, parents))
     return buf.b
 ENDPYTHON
@@ -567,7 +573,7 @@
     p = parent
 
     for alt in alts:
-        curhead = True if 'curhead' in alt else False
+        curhead = 'curhead' in alt
         node = Node(n=alt['seq'], parent=p, time=alt['time'], curhead=curhead)
         nodes.append(node)
         if alt.get('alt'):
@@ -607,7 +613,10 @@
 
     def walk_nodes(nodes):
         for node in nodes:
-            yield(node, [node.parent] if node.parent else [])
+            if node.parent:
+                yield (node, [node.parent])
+            else:
+                yield (node, [])
 
     dag = sorted(nodes, key=lambda n: int(n.n), reverse=True)
     current = changenr(nodes)
@@ -753,8 +762,10 @@
         rev = origin.n < dest.n
 
         nodes = []
-        current = origin if origin.n > dest.n else dest
-        final = dest if origin.n > dest.n else origin
+        if origin.n > dest.n:
+            current, final = origin, dest
+        else:
+            current, final = dest, origin
 
         while current.n >= final.n:
             if current.n == final.n: