예제 #1
0
  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')
예제 #2
0
    def process_io_options(self):
        """Process input/output options.

    Process options related to extracting data from the CVS repository
    and writing to a Bazaar-friendly fast-import file."""

        ctx = Ctx()
        options = self.options

        not_both(options.use_rcs, '--use-rcs', options.use_cvs, '--use-cvs')

        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.")

        ctx.revision_recorder = NullRevisionRecorder()
        ctx.revision_excluder = NullRevisionExcluder()
        ctx.revision_reader = None

        ctx.output_option = GitOutputOption(
            options.dumpfile,
            GitRevisionInlineWriter(revision_reader),
            max_merges=None,
            # Optional map from CVS author names to bzr author names:
            author_transforms={},  # FIXME
        )
예제 #3
0
    def process_extraction_options(self):
        """Process options related to extracting data from the CVS repository."""

        ctx = Ctx()
        options = self.options

        not_both(options.use_rcs, '--use-rcs', options.use_cvs, '--use-cvs')
예제 #4
0
  def process_output_options(self):
    """Process the options related to SVN output."""

    ctx = Ctx()
    options = self.options

    if options.dump_only and not options.dumpfile:
      raise FatalError("'--dump-only' requires '--dumpfile' to be specified.")

    if not options.svnrepos and not options.dumpfile and not ctx.dry_run:
      raise FatalError("must pass one of '-s' or '--dumpfile'.")

    not_both(options.svnrepos, '-s',
             options.dumpfile, '--dumpfile')

    not_both(options.dumpfile, '--dumpfile',
             options.existing_svnrepos, '--existing-svnrepos')

    not_both(options.bdb_txn_nosync, '--bdb-txn-nosync',
             options.existing_svnrepos, '--existing-svnrepos')

    not_both(options.dumpfile, '--dumpfile',
             options.bdb_txn_nosync, '--bdb-txn-nosync')

    not_both(options.fs_type, '--fs-type',
             options.existing_svnrepos, '--existing-svnrepos')

    if (
          options.fs_type
          and options.fs_type != 'bdb'
          and options.bdb_txn_nosync
          ):
      raise FatalError("cannot pass --bdb-txn-nosync with --fs-type=%s."
                       % options.fs_type)

    if options.svnrepos:
      if options.existing_svnrepos:
        ctx.output_option = ExistingRepositoryOutputOption(options.svnrepos)
      else:
        ctx.output_option = NewRepositoryOutputOption(
            options.svnrepos,
            fs_type=options.fs_type, bdb_txn_nosync=options.bdb_txn_nosync,
            create_options=options.create_options)
    else:
      ctx.output_option = DumpfileOutputOption(options.dumpfile)
예제 #5
0
    def process_output_options(self):
        """Process the options related to SVN output."""

        ctx = Ctx()
        options = self.options

        if options.dump_only and not options.dumpfile:
            raise FatalError(
                "'--dump-only' requires '--dumpfile' to be specified.")

        if not options.svnrepos and not options.dumpfile and not ctx.dry_run:
            raise FatalError("must pass one of '-s' or '--dumpfile'.")

        not_both(options.svnrepos, '-s', options.dumpfile, '--dumpfile')

        not_both(options.dumpfile, '--dumpfile', options.existing_svnrepos,
                 '--existing-svnrepos')

        not_both(options.bdb_txn_nosync, '--bdb-txn-nosync',
                 options.existing_svnrepos, '--existing-svnrepos')

        not_both(options.dumpfile, '--dumpfile', options.bdb_txn_nosync,
                 '--bdb-txn-nosync')

        not_both(options.fs_type, '--fs-type', options.existing_svnrepos,
                 '--existing-svnrepos')

        if (options.fs_type and options.fs_type != 'bdb'
                and options.bdb_txn_nosync):
            raise FatalError(
                "cannot pass --bdb-txn-nosync with --fs-type=%s." %
                options.fs_type)

        if options.svnrepos:
            if options.existing_svnrepos:
                ctx.output_option = ExistingRepositoryOutputOption(
                    options.svnrepos)
            else:
                ctx.output_option = NewRepositoryOutputOption(
                    options.svnrepos,
                    fs_type=options.fs_type,
                    bdb_txn_nosync=options.bdb_txn_nosync,
                    create_options=options.create_options)
        else:
            ctx.output_option = DumpfileOutputOption(options.dumpfile)
예제 #6
0
  def process_io_options(self):
    """Process input/output options.

    Process options related to extracting data from the CVS repository
    and writing to 'git fast-import'-formatted files."""

    ctx = Ctx()
    options = self.options

    not_both(options.use_rcs, '--use-rcs',
             options.use_cvs, '--use-cvs')

    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 ctx.dry_run:
      ctx.revision_recorder = NullRevisionRecorder()
    else:
      if not (options.blobfile and options.dumpfile):
        raise FatalError("must pass '--blobfile' and '--dumpfile' options.")
      ctx.revision_recorder = SimpleFulltextRevisionRecorderAdapter(
          revision_reader,
          GitRevisionRecorder(options.blobfile),
          )

    ctx.revision_excluder = NullRevisionExcluder()
    ctx.revision_reader = None

    ctx.output_option = GitOutputOption(
        options.dumpfile,
        GitRevisionMarkWriter(),
        max_merges=None,
        # Optional map from CVS author names to git author names:
        author_transforms={}, # FIXME
        )
예제 #7
0
    def process_extraction_options(self):
        """Process options related to extracting data from the CVS repository."""

        ctx = Ctx()
        options = self.options

        not_both(options.use_rcs, '--use-rcs', options.use_cvs, '--use-cvs')
        not_both(options.use_external_blob_generator,
                 '--use-external-blob-generator', options.use_cvs, '--use-cvs')
        not_both(options.use_external_blob_generator,
                 '--use-external-blob-generator', options.use_rcs, '--use-rcs')

        # cvs2git never needs a revision reader:
        ctx.revision_reader = None

        if ctx.dry_run:
            ctx.revision_collector = NullRevisionCollector()
            return

        if options.use_external_blob_generator:
            ctx.revision_collector = ExternalBlobGenerator(
                blob_filename=options.blobfile, )
        else:
            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)
            ctx.revision_collector = GitRevisionCollector(
                revision_reader,
                blob_filename=options.blobfile,
            )
예제 #8
0
    def process_io_options(self):
        """Process input/output options.

    Process options related to extracting data from the CVS repository
    and writing to 'git fast-import'-formatted files."""

        ctx = Ctx()
        options = self.options

        not_both(options.use_rcs, '--use-rcs', options.use_cvs, '--use-cvs')

        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 ctx.dry_run:
            ctx.revision_recorder = NullRevisionRecorder()
        else:
            if not (options.blobfile and options.dumpfile):
                raise FatalError(
                    "must pass '--blobfile' and '--dumpfile' options.")
            ctx.revision_recorder = SimpleFulltextRevisionRecorderAdapter(
                revision_reader,
                GitRevisionRecorder(options.blobfile),
            )

        ctx.revision_excluder = NullRevisionExcluder()
        ctx.revision_reader = None

        ctx.output_option = GitOutputOption(
            options.dumpfile,
            GitRevisionMarkWriter(),
            max_merges=None,
            # Optional map from CVS author names to git author names:
            author_transforms={},  # FIXME
        )
예제 #9
0
  def process_extraction_options(self):
    """Process options related to extracting data from the CVS repository."""

    ctx = Ctx()
    options = self.options

    not_both(options.use_rcs, '--use-rcs',
             options.use_cvs, '--use-cvs')

    not_both(options.use_rcs, '--use-rcs',
             options.use_internal_co, '--use-internal-co')

    not_both(options.use_cvs, '--use-cvs',
             options.use_internal_co, '--use-internal-co')

    if options.use_rcs:
      ctx.revision_recorder = NullRevisionRecorder()
      ctx.revision_excluder = NullRevisionExcluder()
      ctx.revision_reader = RCSRevisionReader(options.co_executable)
    elif options.use_cvs:
      ctx.revision_recorder = NullRevisionRecorder()
      ctx.revision_excluder = NullRevisionExcluder()
      ctx.revision_reader = CVSRevisionReader(options.cvs_executable)
    else:
      # --use-internal-co is the default:
      ctx.revision_recorder = InternalRevisionRecorder(compress=True)
      ctx.revision_excluder = InternalRevisionExcluder()
      ctx.revision_reader = InternalRevisionReader(compress=True)
예제 #10
0
    def process_extraction_options(self):
        """Process options related to extracting data from the CVS repository."""

        ctx = Ctx()
        options = self.options

        not_both(options.use_rcs, '--use-rcs', options.use_cvs, '--use-cvs')

        not_both(options.use_rcs, '--use-rcs', options.use_internal_co,
                 '--use-internal-co')

        not_both(options.use_cvs, '--use-cvs', options.use_internal_co,
                 '--use-internal-co')

        if options.use_rcs:
            ctx.revision_recorder = NullRevisionRecorder()
            ctx.revision_excluder = NullRevisionExcluder()
            ctx.revision_reader = RCSRevisionReader(options.co_executable)
        elif options.use_cvs:
            ctx.revision_recorder = NullRevisionRecorder()
            ctx.revision_excluder = NullRevisionExcluder()
            ctx.revision_reader = CVSRevisionReader(options.cvs_executable)
        else:
            # --use-internal-co is the default:
            ctx.revision_recorder = InternalRevisionRecorder(compress=True)
            ctx.revision_excluder = InternalRevisionExcluder()
            ctx.revision_reader = InternalRevisionReader(compress=True)
예제 #11
0
  def process_io_options(self):
    """Process input/output options.

    Process options related to extracting data from the CVS repository
    and writing to a Bazaar-friendly fast-import file."""

    ctx = Ctx()
    options = self.options

    not_both(options.use_rcs, '--use-rcs',
             options.use_cvs, '--use-cvs')

    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.")

    ctx.revision_recorder = NullRevisionRecorder()
    ctx.revision_excluder = NullRevisionExcluder()
    ctx.revision_reader = None

    ctx.output_option = GitOutputOption(
        options.dumpfile,
        GitRevisionInlineWriter(revision_reader),
        max_merges=None,
        # Optional map from CVS author names to bzr author names:
        author_transforms={}, # FIXME
        )
예제 #12
0
  def process_extraction_options(self):
    """Process options related to extracting data from the CVS repository."""

    ctx = Ctx()
    options = self.options

    not_both(options.use_rcs, '--use-rcs',
             options.use_cvs, '--use-cvs')
    not_both(options.use_external_blob_generator,
                 '--use-external-blob-generator',
             options.use_cvs, '--use-cvs')
    not_both(options.use_external_blob_generator,
                 '--use-external-blob-generator',
             options.use_rcs, '--use-rcs')

    # cvs2git never needs a revision reader:
    ctx.revision_reader = None

    if ctx.dry_run:
      ctx.revision_collector = NullRevisionCollector()
      return

    if not (options.blobfile and options.dumpfile):
      raise FatalError("must pass '--blobfile' and '--dumpfile' options.")

    if options.use_external_blob_generator:
      ctx.revision_collector = ExternalBlobGenerator(options.blobfile)
    else:
      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
            )
      ctx.revision_collector = GitRevisionCollector(
          options.blobfile, revision_reader,
          )