/usr/lib/python2.7/dist-packages/cvs2svn_lib/bzr_run_options.py is in cvs2svn 2.4.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | # (Be in -*- python -*- mode.)
#
# ====================================================================
# Copyright (c) 2000-2009 CollabNet. All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://subversion.tigris.org/license-1.html.
# If newer versions of this license are posted there, you may use a
# newer version instead, at your option.
#
# This software consists of voluntary contributions made by many
# individuals. For exact contribution history, see the revision
# history and logs, available at http://cvs2svn.tigris.org/.
# ====================================================================
"""This module manages cvs2bzr run options."""
from cvs2svn_lib.common import FatalError
from cvs2svn_lib.context import Ctx
from cvs2svn_lib.dvcs_common import DVCSRunOptions
from cvs2svn_lib.run_options import ContextOption
from cvs2svn_lib.run_options import IncompatibleOption
from cvs2svn_lib.run_options import not_both
from cvs2svn_lib.revision_manager import NullRevisionCollector
from cvs2svn_lib.rcs_revision_manager import RCSRevisionReader
from cvs2svn_lib.cvs_revision_manager import CVSRevisionReader
from cvs2svn_lib.output_option import NullOutputOption
from cvs2svn_lib.git_output_option import GitRevisionInlineWriter
from cvs2svn_lib.bzr_output_option import BzrOutputOption
class BzrRunOptions(DVCSRunOptions):
short_desc = 'convert a cvs repository into a Bazaar repository'
synopsis = """\
.B cvs2bzr
[\\fIOPTION\\fR]... \\fIOUTPUT-OPTIONS CVS-REPOS-PATH\\fR
.br
.B cvs2bzr
[\\fIOPTION\\fR]... \\fI--options=PATH\\fR
"""
long_desc = """\
Create a new Bazaar repository based on the version history stored in a
CVS repository. Each CVS commit will be mirrored in the Bazaar
repository, including such information as date of commit and id of the
committer.
.P
The output of this program is a "fast-import dumpfile", which
can be loaded into a Bazaar repository using the Bazaar FastImport
Plugin, available from https://launchpad.net/bzr-fastimport.
.P
\\fICVS-REPOS-PATH\\fR is the filesystem path of the part of the CVS
repository that you want to convert. This path doesn't have to be the
top level directory of a CVS repository; it can point at a project
within a repository, in which case only that project will be
converted. This path or one of its parent directories has to contain
a subdirectory called CVSROOT (though the CVSROOT directory can be
empty).
.P
It is not possible directly to convert a CVS repository to which you
only have remote access, but the FAQ describes tools that may be used
to create a local copy of a remote CVS repository.
"""
files = """\
A directory called \\fIcvs2svn-tmp\\fR (or the directory specified by
\\fB--tmpdir\\fR) is used as scratch space for temporary data files.
"""
see_also = [
('cvs', '1'),
('bzr', '1'),
]
def _get_output_options_group(self):
group = super(BzrRunOptions, self)._get_output_options_group()
group.add_option(IncompatibleOption(
'--dumpfile', type='string',
action='store',
help='path to which the data should be written',
man_help=(
'Write the blobs and revision data to \\fIpath\\fR.'
),
metavar='PATH',
))
group.add_option(ContextOption(
'--dry-run',
action='store_true',
help=(
'do not create any output; just print what would happen.'
),
man_help=(
'Do not create any output; just print what would happen.'
),
))
return group
def _get_extraction_options_group(self):
group = super(BzrRunOptions, self)._get_extraction_options_group()
self._add_use_cvs_option(group)
self._add_use_rcs_option(group)
return group
def process_extraction_options(self):
"""Process options related to extracting data from the CVS repository."""
options = self.options
not_both(options.use_rcs, '--use-rcs',
options.use_cvs, '--use-cvs')
# cvs2bzr defers acting on extraction options to process_output_options
def process_output_options(self):
"""Process options related to fastimport output."""
ctx = Ctx()
options = self.options
if options.use_rcs:
revision_reader = RCSRevisionReader(
co_executable=options.co_executable
)
else:
# --use-cvs is the default:
revision_reader = CVSRevisionReader(
cvs_executable=options.cvs_executable
)
if not ctx.dry_run and not options.dumpfile:
raise FatalError("must pass '--dry-run' or '--dumpfile' option.")
# See cvs2bzr-example.options for explanations of these
ctx.revision_collector = NullRevisionCollector()
ctx.revision_reader = None
if ctx.dry_run:
ctx.output_option = NullOutputOption()
else:
ctx.output_option = BzrOutputOption(
options.dumpfile,
GitRevisionInlineWriter(revision_reader),
# Optional map from CVS author names to bzr author names:
author_transforms={}, # FIXME
)
|