Пример #1
0
  def process_property_setter_options(self):
    RunOptions.process_property_setter_options(self)

    # Property setters for internal use:
    Ctx().file_property_setters.append(
        KeywordHandlingPropertySetter('collapsed')
        )
Пример #2
0
    def process_property_setter_options(self):
        RunOptions.process_property_setter_options(self)

        property_mode = self.options.force_keyword_mode
        if property_mode == 'no':
            # default
            property_mode = 'collapsed'

        # Property setters for internal use:
        Ctx().file_property_setters.append(
            KeywordHandlingPropertySetter(property_mode))
Пример #3
0
    def _get_extraction_options_group(self):
        group = RunOptions._get_extraction_options_group(self)

        self.parser.set_default('use_cvs', False)
        group.add_option(
            IncompatibleOption(
                '--use-cvs',
                action='store_true',
                help=('use CVS to extract revision contents (slower than '
                      '--use-rcs but more reliable) (default)'),
                man_help=
                ('Use CVS to extract revision contents.  This option is slower '
                 'than \\fB--use-rcs\\fR but more reliable.'),
            ))
        self.parser.set_default('use_rcs', False)
        group.add_option(
            IncompatibleOption(
                '--use-rcs',
                action='store_true',
                help=('use RCS to extract revision contents (faster than '
                      '--use-cvs but fails in some cases)'),
                man_help=
                ('Use RCS \'co\' to extract revision contents.  This option is '
                 'faster than \\fB--use-cvs\\fR but fails in some cases.'),
            ))

        return group
Пример #4
0
  def _get_extraction_options_group(self):
    group = RunOptions._get_extraction_options_group(self)

    self.parser.set_default('use_cvs', False)
    group.add_option(IncompatibleOption(
        '--use-cvs',
        action='store_true',
        help=(
            'use CVS to extract revision contents (slower than '
            '--use-rcs but more reliable) (default)'
            ),
        man_help=(
            'Use CVS to extract revision contents.  This option is slower '
            'than \\fB--use-rcs\\fR but more reliable.'
            ),
        ))
    self.parser.set_default('use_rcs', False)
    group.add_option(IncompatibleOption(
        '--use-rcs',
        action='store_true',
        help=(
            'use RCS to extract revision contents (faster than '
            '--use-cvs but fails in some cases)'
            ),
        man_help=(
            'Use RCS \'co\' to extract revision contents.  This option is '
            'faster than \\fB--use-cvs\\fR but fails in some cases.'
            ),
        ))

    return group
Пример #5
0
  def _get_output_options_group(self):
    group = RunOptions._get_output_options_group(self)

    group.add_option(IncompatibleOption(
        '--blobfile', type='string',
        action='store',
        help='path to which the "blob" data should be written',
        man_help=(
            'Write the "blob" data (containing revision contents) to '
            '\\fIpath\\fR.'
            ),
        metavar='PATH',
        ))
    group.add_option(IncompatibleOption(
        '--dumpfile', type='string',
        action='store',
        help='path to which the revision data should be written',
        man_help=(
            'Write the revision data (branches and commits) 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
Пример #6
0
def main(progname, cmd_args):
    # Disable garbage collection, as we try not to create any circular
    # data structures:
    gc.disable()

    # Convenience var, so we don't have to keep instantiating this Borg.
    ctx = Ctx()

    pass_manager = PassManager(passes)

    run_options = RunOptions(progname, cmd_args, pass_manager)

    # Make sure the tmp directory exists.  Note that we don't check if
    # it's empty -- we want to be able to use, for example, "." to hold
    # tempfiles.  But if we *did* want check if it were empty, we'd do
    # something like os.stat(ctx.tmpdir)[stat.ST_NLINK], of course :-).
    if not os.path.exists(ctx.tmpdir):
        erase_tmpdir = True
        os.mkdir(ctx.tmpdir)
    elif not os.path.isdir(ctx.tmpdir):
        raise FatalError(
            "cvs2svn tried to use '%s' for temporary files, but that path\n"
            "  exists and is not a directory.  Please make it be a directory,\n"
            "  or specify some other directory for temporary files." %
            (ctx.tmpdir, ))
    else:
        erase_tmpdir = False

    # But do lock the tmpdir, to avoid process clash.
    try:
        os.mkdir(os.path.join(ctx.tmpdir, 'cvs2svn.lock'))
    except OSError, e:
        if e.errno == errno.EACCES:
            raise FatalError("Permission denied:" +
                             " No write access to directory '%s'." %
                             ctx.tmpdir)
        if e.errno == errno.EEXIST:
            raise FatalError(
                "cvs2svn is using directory '%s' for temporary files, but\n"
                "  subdirectory '%s/cvs2svn.lock' exists, indicating that another\n"
                "  cvs2svn process is currently using '%s' as its temporary\n"
                "  workspace.  If you are certain that is not the case,\n"
                "  then remove the '%s/cvs2svn.lock' subdirectory." % (
                    ctx.tmpdir,
                    ctx.tmpdir,
                    ctx.tmpdir,
                    ctx.tmpdir,
                ))
        raise
Пример #7
0
  def _get_extraction_options_group(self):
    group = RunOptions._get_extraction_options_group(self)

    self.parser.set_default('use_internal_co', False)
    group.add_option(IncompatibleOption(
        '--use-internal-co',
        action='store_true',
        help=(
            'use internal code to extract revision contents '
            '(fastest but disk space intensive) (default)'
            ),
        man_help=(
            'Use internal code to extract revision contents.  This '
            'is up to 50% faster than using \\fB--use-rcs\\fR, but needs '
            'a lot of disk space: roughly the size of your CVS repository '
            'plus the peak size of a complete checkout of the repository '
            'with all branches that existed and still had commits pending '
            'at a given time.  This option is the default.'
            ),
        ))
    self.parser.set_default('use_cvs', False)
    group.add_option(IncompatibleOption(
        '--use-cvs',
        action='store_true',
        help=(
            'use CVS to extract revision contents (slower than '
            '--use-internal-co or --use-rcs)'
            ),
        man_help=(
            'Use CVS to extract revision contents.  This option is slower '
            'than \\fB--use-internal-co\\fR or \\fB--use-rcs\\fR.'
            ),
        ))
    self.parser.set_default('use_rcs', False)
    group.add_option(IncompatibleOption(
        '--use-rcs',
        action='store_true',
        help=(
            'use RCS to extract revision contents (faster than '
            '--use-cvs but fails in some cases)'
            ),
        man_help=(
            'Use RCS \'co\' to extract revision contents.  This option is '
            'faster than \\fB--use-cvs\\fR but fails in some cases.'
            ),
        ))

    return group
Пример #8
0
  def _get_environment_options_group(self):
    group = RunOptions._get_environment_options_group(self)

    group.add_option(ContextOption(
        '--svnadmin', type='string',
        action='store', dest='svnadmin_executable',
        help='path to the "svnadmin" program',
        man_help=(
            'Path to the \\fIsvnadmin\\fR program.  (\\fIsvnadmin\\fR is '
            'needed when the \\fB-s\\fR/\\fB--svnrepos\\fR output option is '
            'used.)'
            ),
        metavar='PATH',
        ))

    return group
Пример #9
0
    def _get_environment_options_group(self):
        group = RunOptions._get_environment_options_group(self)

        group.add_option(
            ContextOption(
                '--svnadmin',
                type='string',
                action='store',
                dest='svnadmin_executable',
                help='path to the "svnadmin" program',
                man_help=
                ('Path to the \\fIsvnadmin\\fR program.  (\\fIsvnadmin\\fR is '
                 'needed when the \\fB-s\\fR/\\fB--svnrepos\\fR output option is '
                 'used.)'),
                metavar='PATH',
            ))

        return group
Пример #10
0
    def _get_extraction_options_group(self):
        group = RunOptions._get_extraction_options_group(self)

        self.parser.set_default('use_internal_co', False)
        group.add_option(
            IncompatibleOption(
                '--use-internal-co',
                action='store_true',
                help=('use internal code to extract revision contents '
                      '(fastest but disk space intensive) (default)'),
                man_help=
                ('Use internal code to extract revision contents.  This '
                 'is up to 50% faster than using \\fB--use-rcs\\fR, but needs '
                 'a lot of disk space: roughly the size of your CVS repository '
                 'plus the peak size of a complete checkout of the repository '
                 'with all branches that existed and still had commits pending '
                 'at a given time.  This option is the default.'),
            ))
        self.parser.set_default('use_cvs', False)
        group.add_option(
            IncompatibleOption(
                '--use-cvs',
                action='store_true',
                help=('use CVS to extract revision contents (slower than '
                      '--use-internal-co or --use-rcs)'),
                man_help=
                ('Use CVS to extract revision contents.  This option is slower '
                 'than \\fB--use-internal-co\\fR or \\fB--use-rcs\\fR.'),
            ))
        self.parser.set_default('use_rcs', False)
        group.add_option(
            IncompatibleOption(
                '--use-rcs',
                action='store_true',
                help=('use RCS to extract revision contents (faster than '
                      '--use-cvs but fails in some cases)'),
                man_help=
                ('Use RCS \'co\' to extract revision contents.  This option is '
                 'faster than \\fB--use-cvs\\fR but fails in some cases.'),
            ))

        return group
Пример #11
0
    def _get_output_options_group(self):
        group = RunOptions._get_output_options_group(self)

        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
Пример #12
0
 def _get_extraction_options_group(self):
   group = RunOptions._get_extraction_options_group(self)
   self._add_use_internal_co_option(group)
   self._add_use_cvs_option(group)
   self._add_use_rcs_option(group)
   return group
Пример #13
0
  def process_property_setter_options(self):
    RunOptions.process_property_setter_options(self)

    # Property setters for internal use:
    Ctx().file_property_setters.append(SVNEOLFixPropertySetter())
    Ctx().file_property_setters.append(SVNKeywordHandlingPropertySetter())
Пример #14
0
    def process_property_setter_options(self):
        RunOptions.process_property_setter_options(self)

        # Property setters for internal use:
        Ctx().file_property_setters.append(
            KeywordHandlingPropertySetter('collapsed'))
Пример #15
0
 def __init__(self, progname, cmd_args, pass_manager):
     Ctx().cross_project_commits = False
     Ctx().cross_branch_commits = False
     if Ctx().username is None:
         Ctx().username = self.DEFAULT_USERNAME
     RunOptions.__init__(self, progname, cmd_args, pass_manager)
Пример #16
0
 def __init__(self, progname, cmd_args, pass_manager):
     Ctx().cross_project_commits = False
     Ctx().cross_branch_commits = False
     RunOptions.__init__(self, progname, cmd_args, pass_manager)
Пример #17
0
    def _get_conversion_options_group(self):
        group = RunOptions._get_conversion_options_group(self)

        self.parser.set_default('trunk_base', config.DEFAULT_TRUNK_BASE)
        group.add_option(
            IncompatibleOption(
                '--trunk',
                type='string',
                action='store',
                dest='trunk_base',
                help=('path for trunk (default: %s)' %
                      (config.DEFAULT_TRUNK_BASE, )),
                man_help=(
                    'Set the top-level path to use for trunk in the Subversion '
                    'repository. The default is \\fI%s\\fR.' %
                    (config.DEFAULT_TRUNK_BASE, )),
                metavar='PATH',
            ))
        self.parser.set_default('branches_base', config.DEFAULT_BRANCHES_BASE)
        group.add_option(
            IncompatibleOption(
                '--branches',
                type='string',
                action='store',
                dest='branches_base',
                help=('path for branches (default: %s)' %
                      (config.DEFAULT_BRANCHES_BASE, )),
                man_help=
                ('Set the top-level path to use for branches in the Subversion '
                 'repository.  The default is \\fI%s\\fR.' %
                 (config.DEFAULT_BRANCHES_BASE, )),
                metavar='PATH',
            ))
        self.parser.set_default('tags_base', config.DEFAULT_TAGS_BASE)
        group.add_option(
            IncompatibleOption(
                '--tags',
                type='string',
                action='store',
                dest='tags_base',
                help=('path for tags (default: %s)' %
                      (config.DEFAULT_TAGS_BASE, )),
                man_help=(
                    'Set the top-level path to use for tags in the Subversion '
                    'repository. The default is \\fI%s\\fR.' %
                    (config.DEFAULT_TAGS_BASE, )),
                metavar='PATH',
            ))
        group.add_option(
            ContextOption(
                '--no-prune',
                action='store_false',
                dest='prune',
                help='don\'t prune empty directories',
                man_help=
                ('When all files are deleted from a directory in the Subversion '
                 'repository, don\'t delete the empty directory (the default is '
                 'to delete any empty directories).'),
            ))
        group.add_option(
            ContextOption(
                '--no-cross-branch-commits',
                action='store_false',
                dest='cross_branch_commits',
                help='prevent the creation of cross-branch commits',
                man_help=
                ('Prevent the creation of commits that affect files on multiple '
                 'branches at once.'),
            ))

        return group
Пример #18
0
    def process_property_setter_options(self):
        RunOptions.process_property_setter_options(self)

        # Property setters for internal use:
        Ctx().file_property_setters.append(SVNEOLFixPropertySetter())
        Ctx().file_property_setters.append(SVNKeywordHandlingPropertySetter())
Пример #19
0
  def _get_conversion_options_group(self):
    group = RunOptions._get_conversion_options_group(self)

    self.parser.set_default('trunk_base', config.DEFAULT_TRUNK_BASE)
    group.add_option(IncompatibleOption(
        '--trunk', type='string',
        action='store', dest='trunk_base',
        help=(
            'path for trunk (default: %s)'
            % (config.DEFAULT_TRUNK_BASE,)
            ),
        man_help=(
            'Set the top-level path to use for trunk in the Subversion '
            'repository. The default is \\fI%s\\fR.'
            % (config.DEFAULT_TRUNK_BASE,)
            ),
        metavar='PATH',
        ))
    self.parser.set_default('branches_base', config.DEFAULT_BRANCHES_BASE)
    group.add_option(IncompatibleOption(
        '--branches', type='string',
        action='store', dest='branches_base',
        help=(
            'path for branches (default: %s)'
            % (config.DEFAULT_BRANCHES_BASE,)
            ),
        man_help=(
            'Set the top-level path to use for branches in the Subversion '
            'repository.  The default is \\fI%s\\fR.'
            % (config.DEFAULT_BRANCHES_BASE,)
            ),
        metavar='PATH',
        ))
    self.parser.set_default('tags_base', config.DEFAULT_TAGS_BASE)
    group.add_option(IncompatibleOption(
        '--tags', type='string',
        action='store', dest='tags_base',
        help=(
            'path for tags (default: %s)'
            % (config.DEFAULT_TAGS_BASE,)
            ),
        man_help=(
            'Set the top-level path to use for tags in the Subversion '
            'repository. The default is \\fI%s\\fR.'
            % (config.DEFAULT_TAGS_BASE,)
            ),
        metavar='PATH',
        ))
    group.add_option(ContextOption(
        '--no-prune',
        action='store_false', dest='prune',
        help='don\'t prune empty directories',
        man_help=(
            'When all files are deleted from a directory in the Subversion '
            'repository, don\'t delete the empty directory (the default is '
            'to delete any empty directories).'
            ),
        ))
    group.add_option(ContextOption(
        '--no-cross-branch-commits',
        action='store_false', dest='cross_branch_commits',
        help='prevent the creation of cross-branch commits',
        man_help=(
            'Prevent the creation of commits that affect files on multiple '
            'branches at once.'
            ),
        ))

    return group
Пример #20
0
    def _get_output_options_group(self):
        group = RunOptions._get_output_options_group(self)

        group.add_option(
            IncompatibleOption(
                '--svnrepos',
                '-s',
                type='string',
                action='store',
                help='path where SVN repos should be created',
                man_help=
                ('Write the output of the conversion into a Subversion repository '
                 'located at \\fIpath\\fR.  This option causes a new Subversion '
                 'repository to be created at \\fIpath\\fR unless the '
                 '\\fB--existing-svnrepos\\fR option is also used.'),
                metavar='PATH',
            ))
        self.parser.set_default('existing_svnrepos', False)
        group.add_option(
            IncompatibleOption(
                '--existing-svnrepos',
                action='store_true',
                help=
                'load into existing SVN repository (for use with --svnrepos)',
                man_help=
                ('Load the converted CVS repository into an existing Subversion '
                 'repository, instead of creating a new repository.  (This option '
                 'should be used in combination with '
                 '\\fB-s\\fR/\\fB--svnrepos\\fR.)  The repository must either be '
                 'empty or contain no paths that overlap with those that will '
                 'result from the conversion.  Please note that you need write '
                 'permission for the repository files.'),
            ))
        group.add_option(
            IncompatibleOption(
                '--fs-type',
                type='string',
                action='store',
                help=('pass --fs-type=TYPE to "svnadmin create" (for use with '
                      '--svnrepos)'),
                man_help=
                ('Pass \\fI--fs-type\\fR=\\fItype\\fR to "svnadmin create" when '
                 'creating a new repository.'),
                metavar='TYPE',
            ))
        self.parser.set_default('bdb_txn_nosync', False)
        group.add_option(
            IncompatibleOption(
                '--bdb-txn-nosync',
                action='store_true',
                help=(
                    'pass --bdb-txn-nosync to "svnadmin create" (for use with '
                    '--svnrepos)'),
                man_help=(
                    'Pass \\fI--bdb-txn-nosync\\fR to "svnadmin create" when '
                    'creating a new BDB-style Subversion repository.'),
            ))
        self.parser.set_default('create_options', [])
        group.add_option(
            IncompatibleOption(
                '--create-option',
                type='string',
                action='append',
                dest='create_options',
                help='pass OPT to "svnadmin create" (for use with --svnrepos)',
                man_help=
                ('Pass \\fIopt\\fR to "svnadmin create" when creating a new '
                 'Subversion repository (can be specified multiple times to '
                 'pass multiple options).'),
                metavar='OPT',
            ))
        group.add_option(
            IncompatibleOption(
                '--dumpfile',
                type='string',
                action='store',
                help='just produce a dumpfile; don\'t commit to a repos',
                man_help=
                ('Just produce a dumpfile; don\'t commit to an SVN repository. '
                 'Write the dumpfile to \\fIpath\\fR.'),
                metavar='PATH',
            ))

        group.add_option(
            ContextOption(
                '--dry-run',
                action='store_true',
                help=(
                    'do not create a repository or a dumpfile; just print what '
                    'would happen.'),
                man_help=
                ('Do not create a repository or a dumpfile; just print the '
                 'details of what cvs2svn would do if it were really converting '
                 'your repository.'),
            ))

        # Deprecated options:
        self.parser.set_default('dump_only', False)
        group.add_option(
            IncompatibleOption(
                '--dump-only',
                action='callback',
                callback=self.callback_dump_only,
                help=optparse.SUPPRESS_HELP,
                man_help=optparse.SUPPRESS_HELP,
            ))
        group.add_option(
            IncompatibleOption(
                '--create',
                action='callback',
                callback=self.callback_create,
                help=optparse.SUPPRESS_HELP,
                man_help=optparse.SUPPRESS_HELP,
            ))

        return group
Пример #21
0
 def __init__(self, progname, cmd_args, pass_manager):
   Ctx().cross_project_commits = False
   Ctx().cross_branch_commits = False
   RunOptions.__init__(self, progname, cmd_args, pass_manager)
Пример #22
0
  def _get_output_options_group(self):
    group = RunOptions._get_output_options_group(self)

    group.add_option(IncompatibleOption(
        '--svnrepos', '-s', type='string',
        action='store',
        help='path where SVN repos should be created',
        man_help=(
            'Write the output of the conversion into a Subversion repository '
            'located at \\fIpath\\fR.  This option causes a new Subversion '
            'repository to be created at \\fIpath\\fR unless the '
            '\\fB--existing-svnrepos\\fR option is also used.'
            ),
        metavar='PATH',
        ))
    self.parser.set_default('existing_svnrepos', False)
    group.add_option(IncompatibleOption(
        '--existing-svnrepos',
        action='store_true',
        help='load into existing SVN repository (for use with --svnrepos)',
        man_help=(
            'Load the converted CVS repository into an existing Subversion '
            'repository, instead of creating a new repository.  (This option '
            'should be used in combination with '
            '\\fB-s\\fR/\\fB--svnrepos\\fR.)  The repository must either be '
            'empty or contain no paths that overlap with those that will '
            'result from the conversion.  Please note that you need write '
            'permission for the repository files.'
            ),
        ))
    group.add_option(IncompatibleOption(
        '--fs-type', type='string',
        action='store',
        help=(
            'pass --fs-type=TYPE to "svnadmin create" (for use with '
            '--svnrepos)'
            ),
        man_help=(
            'Pass \\fI--fs-type\\fR=\\fItype\\fR to "svnadmin create" when '
            'creating a new repository.'
            ),
        metavar='TYPE',
        ))
    self.parser.set_default('bdb_txn_nosync', False)
    group.add_option(IncompatibleOption(
        '--bdb-txn-nosync',
        action='store_true',
        help=(
            'pass --bdb-txn-nosync to "svnadmin create" (for use with '
            '--svnrepos)'
            ),
        man_help=(
            'Pass \\fI--bdb-txn-nosync\\fR to "svnadmin create" when '
            'creating a new BDB-style Subversion repository.'
            ),
        ))
    self.parser.set_default('create_options', [])
    group.add_option(IncompatibleOption(
        '--create-option', type='string',
        action='append', dest='create_options',
        help='pass OPT to "svnadmin create" (for use with --svnrepos)',
        man_help=(
            'Pass \\fIopt\\fR to "svnadmin create" when creating a new '
            'Subversion repository (can be specified multiple times to '
            'pass multiple options).'
            ),
        metavar='OPT',
        ))
    group.add_option(IncompatibleOption(
        '--dumpfile', type='string',
        action='store',
        help='just produce a dumpfile; don\'t commit to a repos',
        man_help=(
            'Just produce a dumpfile; don\'t commit to an SVN repository. '
            'Write the dumpfile to \\fIpath\\fR.'
            ),
        metavar='PATH',
        ))

    group.add_option(ContextOption(
        '--dry-run',
        action='store_true',
        help=(
            'do not create a repository or a dumpfile; just print what '
            'would happen.'
            ),
        man_help=(
            'Do not create a repository or a dumpfile; just print the '
            'details of what cvs2svn would do if it were really converting '
            'your repository.'
            ),
        ))

    # Deprecated options:
    self.parser.set_default('dump_only', False)
    group.add_option(IncompatibleOption(
        '--dump-only',
        action='callback', callback=self.callback_dump_only,
        help=optparse.SUPPRESS_HELP,
        man_help=optparse.SUPPRESS_HELP,
        ))
    group.add_option(IncompatibleOption(
        '--create',
        action='callback', callback=self.callback_create,
        help=optparse.SUPPRESS_HELP,
        man_help=optparse.SUPPRESS_HELP,
        ))

    return group
Пример #23
0
 def __init__(self, progname, cmd_args, pass_manager):
   Ctx().cross_project_commits = False
   Ctx().cross_branch_commits = False
   if Ctx().username is None:
     Ctx().username = self.DEFAULT_USERNAME
   RunOptions.__init__(self, progname, cmd_args, pass_manager)
Пример #24
0
 def _get_extraction_options_group(self):
     group = RunOptions._get_extraction_options_group(self)
     self._add_use_internal_co_option(group)
     self._add_use_cvs_option(group)
     self._add_use_rcs_option(group)
     return group