1
# Copyright (C) 2004 Aaron Bentley
2
# <aaron.bentley@utoronto.ca>
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
sys.path=[os.path.realpath(os.path.dirname(__file__)+"/..")]+sys.path
23
from pylon import errors
28
__docformat__ = "restructuredtext"
29
__doc__ = "fill-library command"
31
class FillLibrary(commands.BaseCommand):
32
"""Copy all library revisions to a single library"""
34
self.description = self.__doc__
36
def get_completer(self, arg, index):
37
return cmdutil.iter_dir_completions(arg)
39
def do_command(self, cmdargs):
40
parser=self.get_parser()
41
(options, args) = parser.parse_args(cmdargs)
44
if not pylon.is_library_dir(args[0]):
45
raise errors.CommandFailedWrapper(errors.NotLibrary(args[0]))
46
for revision in arch_compound.iter_all_library_revisions():
47
if revision.archive.is_registered():
48
cmdutil.chatter("Adding %s" % revision)
49
for line in pylon.iter_library_add(revision, args[0]):
50
cmdutil.colorize(line)
52
cmdutil.chatter("Skipping %s" % revision)
56
parser = cmdutil.CmdOptionParser("fill-library DIR")
59
def help(self, parser=None):
61
Prints a help message.
63
:param parser: If supplied, the parser to use for generating help. If \
64
not supplied, it is retrieved.
65
:type parser: cmdutil.CmdOptionParser
68
parser=self.get_parser()
71
This command can be used to copy all library revisions to a particular library,
72
presumably on a different filesystem.
74
This process ensures correct inode signatures. Unfortunately, most of the
75
copied revisions will not be hard-linked efficiently.
77
Limitations in some versions of tla library-add mean that revisions for
78
unregistered libraries will be skipped.
82
def add_command(commands):
83
commands["fill-library"] = FillLibrary
87
# arch-tag: 6591f6cc-3d18-4505-8061-ad42d3b28132