25
25
from bzrlib.commands import Command
26
from bzrlib.trace import mutter, warning
27
28
class cmd_weave_list(Command):
28
29
"""List the revision ids present in a weave, in alphabetical order"""
55
56
w2 = read_weave(file(weave2, 'rb'))
57
58
write_weave(w1, sys.stdout)
61
class cmd_weave_plan_merge(Command):
62
"""Show the plan for merging two versions within a weave"""
64
takes_args = ['weave_file', 'revision_a', 'revision_b']
66
def run(self, weave_file, revision_a, revision_b):
67
from bzrlib.weavefile import read_weave, write_weave
68
w = read_weave(file(weave_file, 'rb'))
69
for state, line in w.plan_merge(revision_a, revision_b):
70
# make sure to print every line with a newline, even if it doesn't
78
warning("line in weave contains embedded newline: %r" % line)
79
print '%15s | %s' % (state, line),
81
class cmd_weave_merge_text(Command):
82
"""Debugging command to merge two texts of a weave"""
84
takes_args = ['weave_file', 'revision_a', 'revision_b']
86
def run(self, weave_file, revision_a, revision_b):
87
from bzrlib.weavefile import read_weave, write_weave
88
w = read_weave(file(weave_file, 'rb'))
89
p = w.plan_merge(revision_a, revision_b)
90
sys.stdout.writelines(w.weave_merge(p))