1
# Copyright (C) 2006 by Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
"""builtin bzr commands relating to individual weave files
19
These should never normally need to be used by end users, but might be
20
of interest in debugging or data recovery.
25
from bzrlib.commands import Command
27
class cmd_weave_list(Command):
28
"""List the revision ids present in a weave, in alphabetical order"""
31
takes_args = ['weave_filename']
33
def run(self, weave_filename):
34
from bzrlib.weavefile import read_weave
35
weave = read_weave(file(weave_filename, 'rb'))
36
names = weave.versions()
38
print '\n'.join(names)
41
class cmd_weave_join(Command):
42
"""Join the contents of two weave files.
44
The resulting weave is sent to stdout.
46
This command is only intended for bzr developer use.
50
takes_args = ['weave1', 'weave2']
52
def run(self, weave1, weave2):
53
from bzrlib.weavefile import read_weave, write_weave
54
w1 = read_weave(file(weave1, 'rb'))
55
w2 = read_weave(file(weave2, 'rb'))
57
write_weave(w1, sys.stdout)