Exemplo n.º 1
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,
            )
Exemplo n.º 2
0
  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
          )
Exemplo n.º 3
0
    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
            )
Exemplo n.º 4
0
    def process_all_extraction_options(self):
        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_collector = NullRevisionCollector()
            ctx.revision_reader = RCSRevisionReader(options.co_executable)
        elif options.use_cvs:
            ctx.revision_collector = NullRevisionCollector()
            ctx.revision_reader = CVSRevisionReader(options.cvs_executable)
        else:
            # --use-internal-co is the default:
            ctx.revision_collector = InternalRevisionCollector(compress=True)
            ctx.revision_reader = InternalRevisionReader(compress=True)
Exemplo n.º 5
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,
          )
Exemplo n.º 6
0
    def process_all_extraction_options(self):
        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_collector = NullRevisionCollector()
            ctx.revision_reader = RCSRevisionReader(options.co_executable)
        elif options.use_cvs:
            ctx.revision_collector = NullRevisionCollector()
            ctx.revision_reader = CVSRevisionReader(options.cvs_executable)
        else:
            # --use-internal-co is the default:
            ctx.revision_collector = InternalRevisionCollector(compress=True)
            ctx.revision_reader = InternalRevisionReader(compress=True)