This file is indexed.

/usr/lib/python2.7/dist-packages/cvs2svn_lib/hg_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
# (Be in -*- python -*- mode.)
#
# ====================================================================
# Copyright (c) 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/.
# ====================================================================

from cvs2svn_lib.context import Ctx
from cvs2svn_lib.run_options import IncompatibleOption
from cvs2svn_lib.dvcs_common import DVCSRunOptions
from cvs2svn_lib.hg_output_option import HgOutputOption


class HgRunOptions(DVCSRunOptions):

  short_desc = 'convert a cvs repository into a Mercurial repository'

  synopsis = """\
.B cvs2hg
[\\fIOPTION\\fR]... \\fIOUTPUT-OPTION CVS-REPOS-PATH\\fR
.br
.B cvs2hg
[\\fIOPTION\\fR]... \\fI--options=PATH\\fR
"""

  # XXX paragraph 2 copied straight from svn_run_options.py
  long_desc = """\
Create a new Mercurial repository based on the version history stored in
a CVS repository. Each CVS commit will be mirrored in the Mercurial
repository, including commit time and author (with optional remapping to
Mercurial-style long usernames).
.P
\\fICVS-REPOS-PATH\\fR is the filesystem path of the part of the CVS
repository that you want to convert.  It is not possible to convert a
CVS repository to which you only have remote access; see the FAQ for
more information.  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
Unlike CVS or Subversion, Mercurial expects each repository to hold
one independent project.  If your CVS repository contains multiple
independent projects, you should probably convert them to multiple
independent Mercurial repositories with multiple runs of
.B cvs2hg.
"""

  # XXX copied from svn_run_options.py
  files = """\
A directory called \\fIcvs2svn-tmp\\fR (or the directory specified by
\\fB--tmpdir\\fR) is used as scratch space for temporary data files.
"""

  # XXX the cvs2{svn,git,bzr,hg} man pages should probably reference
  # each other
  see_also = [
  ('cvs', '1'),
  ('hg', '1'),
  ]

  def __init__(self, *args, **kwargs):
    # Override some default values
    ctx = Ctx()
    ctx.username = "cvs2hg"
    ctx.symbol_commit_message = (
      "artificial changeset to create "
      "%(symbol_type)s '%(symbol_name)s'")
    ctx.post_commit_message = (
      "artificial changeset: compensate for changes in %(revnum)s "
      "(on non-trunk default branch in CVS)")

    super(HgRunOptions, self).__init__(*args, **kwargs)

  # This is a straight copy of SVNRunOptions._get_extraction_options_group();
  # would be nice to refactor, but it's a bit awkward because GitRunOptions
  # doesn't support --use-internal-co option.
  def _get_extraction_options_group(self):
    group = DVCSRunOptions._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

  def _get_output_options_group(self):
    group = super(HgRunOptions, self)._get_output_options_group()

    # XXX what if the hg repo already exists? die, clobber, or append?
    # (currently we die at the start of OutputPass)
    group.add_option(IncompatibleOption(
      '--hgrepos', type='string',
      action='store',
      help='create Mercurial repository in PATH',
      man_help=(
          'Convert to a Mercurial repository in \\fIpath\\fR.  This creates '
          'a new Mercurial repository at \\fIpath\\fR.  \\fIpath\\fR must '
          'not already exist.'
          ),
      metavar='PATH',
      ))

    # XXX --dry-run?

    return group

  def process_extraction_options(self):
    """Process options related to extracting data from the CVS repository."""
    self.process_all_extraction_options()

  def process_output_options(self):
    Ctx().output_option = HgOutputOption(
      self.options.hgrepos,
      author_transforms={},
      )