From a217cebb3adc55139616ccb4d894ec22169bad5d Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Tue, 19 Oct 2010 09:37:54 +0200 Subject: [PATCH 1/2] Add Python 2.4 compatibility. --- plugin/gundo.vim | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/plugin/gundo.vim b/plugin/gundo.vim index c6a7c37..5c1582e 100644 --- a/plugin/gundo.vim +++ b/plugin/gundo.vim @@ -463,9 +463,15 @@ def generate(dag, edgefn, current): 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 @@ def _make_nodes(alts, nodes, parent=None): 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 GundoRender(): 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 @@ def GundoPlayTo(): 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: From 36981241a5b2f641b2d1469fb557cc54d7b8abf6 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Tue, 19 Oct 2010 09:39:18 +0200 Subject: [PATCH 2/2] Update the README. --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index a27c8f1..97cb35e 100644 --- a/README.markdown +++ b/README.markdown @@ -22,7 +22,7 @@ Requirements * Vim 7.3+ * Python support for Vim. -* Python 2.5+. +* Python 2.4+. Installation ------------