Merge.
This commit is contained in:
commit
ca682f6f9e
@ -22,7 +22,7 @@ Requirements
|
|||||||
|
|
||||||
* Vim 7.3+
|
* Vim 7.3+
|
||||||
* Python support for Vim.
|
* Python support for Vim.
|
||||||
* Python 2.5+.
|
* Python 2.4+.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
@ -16,10 +16,12 @@
|
|||||||
|
|
||||||
"let loaded_gundo = 1
|
"let loaded_gundo = 1
|
||||||
|
|
||||||
let s:warning_string = "Gundo requires that vim be compiled with Python 2.5+"
|
let s:warning_string = "Gundo requires that Vim be compiled with Python 2.4+"
|
||||||
|
|
||||||
" Check for Python support and required version
|
" Check for Python support and required version
|
||||||
if has('python')
|
if has('python')
|
||||||
let s:has_supported_python = 1
|
let s:has_supported_python = 1
|
||||||
|
|
||||||
python << ENDPYTHON
|
python << ENDPYTHON
|
||||||
import sys
|
import sys
|
||||||
import vim
|
import vim
|
||||||
@ -485,9 +487,15 @@ def generate(dag, edgefn, current):
|
|||||||
seen, state = [], [0, 0]
|
seen, state = [], [0, 0]
|
||||||
buf = Buffer()
|
buf = Buffer()
|
||||||
for node, parents in list(dag):
|
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)
|
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))
|
ascii(buf, state, 'C', char, [line], edgefn(seen, node, parents))
|
||||||
return buf.b
|
return buf.b
|
||||||
ENDPYTHON
|
ENDPYTHON
|
||||||
@ -589,7 +597,7 @@ def _make_nodes(alts, nodes, parent=None):
|
|||||||
p = parent
|
p = parent
|
||||||
|
|
||||||
for alt in alts:
|
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)
|
node = Node(n=alt['seq'], parent=p, time=alt['time'], curhead=curhead)
|
||||||
nodes.append(node)
|
nodes.append(node)
|
||||||
if alt.get('alt'):
|
if alt.get('alt'):
|
||||||
@ -629,7 +637,10 @@ def GundoRender():
|
|||||||
|
|
||||||
def walk_nodes(nodes):
|
def walk_nodes(nodes):
|
||||||
for node in 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)
|
dag = sorted(nodes, key=lambda n: int(n.n), reverse=True)
|
||||||
current = changenr(nodes)
|
current = changenr(nodes)
|
||||||
@ -775,8 +786,10 @@ def GundoPlayTo():
|
|||||||
rev = origin.n < dest.n
|
rev = origin.n < dest.n
|
||||||
|
|
||||||
nodes = []
|
nodes = []
|
||||||
current = origin if origin.n > dest.n else dest
|
if origin.n > dest.n:
|
||||||
final = dest if origin.n > dest.n else origin
|
current, final = origin, dest
|
||||||
|
else:
|
||||||
|
current, final = dest, origin
|
||||||
|
|
||||||
while current.n >= final.n:
|
while current.n >= final.n:
|
||||||
if current.n == final.n:
|
if current.n == final.n:
|
||||||
|
Loading…
Reference in New Issue
Block a user