List Info

Thread: Proposal: Specifying cvs2svn options via options file




Proposal: Specifying cvs2svn options via options file
user name
2006-08-20 23:34:58
[I am CCing this email to the users mailing list because I
would
especially like to get user feedback on the idea.  Is the
configuration
file format usable?  Would you use it?  Please send
followups to the dev
mailing list.]

I'm thinking about adding a second way to set the options
for a run of
cvs2svn via an options file.  Simple conversions could still
be done via
the command line; complicated ones or conversions using
obscure options
might require the options file.  I'd like to get your
thoughts on this idea.

The cvs2svn command line is getting unwieldy, even though a
little bit
of configuration flexibility has already been sacrificed. 
It is also
problematic when a large number of options are required (for
example,
many symbols to --force-branch/--force-tag/--exclude or many
--symbol-transforms).

The situation will get even worse when multiproject
conversions are
added (which will hopefully be quite soon).  For example, I
can see no
reason not to allow the following options to be specified on
a
per-project basis:

  --trunk-only, --trunk, --branches, --tags
  --prune
  --force-branch, --force-tag, --exclude, --symbol-default
  --symbol-transform
  --username
  --cvs-revnums
  --mime-types
  --auto-props, --auto-props-ignore-case
  --eol-from-mime-type, --no-default-eol
  --keywords-off

Furthermore, the command-line doesn't provide a good way
for users to
customize behavior with their own Python code.  A
Python-based options
file would make it easy for power users to write their own
Python
classes to do arbitrary customizations of things like
property setters
and symbol strategies and hook them into the cvs2svn
conversion.

Concretely, I propose that we add a new command-line option
like

  cvs2svn --options=FILENAME

If the --options option is specified, then only a very
restricted subset
of other options would be allowed.  We would provide an
options file
template, probably showing the default values and with lots
of comments
telling how the file can be modified.  The user would edit
the file
prior to starting a conversion.

My preferred format for the options file would be Python
code.  See the
attachment for a rough idea of what the provided options
file template
could look like.

What do you think?

- Would an options file of a complexity similar to the one
shown be
usable by an expert user?  A typical user?

- Can you think of any strong reasons to prefer a file
format other than
Python code?

- Would it be too much work over time to maintain both
command-line
options and option file?

- Is it conceivable/desirable that such an options file
should *replace*
command-line options parsing?

Michael
# (Be in -*- python -*- mode.)

# To choose the level of logging output, uncomment one of
the
# following lines:
#Log().log_level = Log.WARN
#Log().log_level = Log.QUIET
Log().log_level = Log.NORMAL
#Log().log_level = Log.VERBOSE

# The name of the SVN repository that gets the output of the
conversion:
ctx.target = 'svnrepo'

# Uncomment the following line if the SVN repository in
ctx.target
# already exists:
#ctx.existing_svnrepos = True

#ctx.dump_only = True

# If you want the output to go into a dumpfile, specify the
filename here:
#ctx.dumpfile = 'cvs2svn-dump'

#ctx.dry_run = True

#ctx.use_cvs = True

ctx.svnadmin = 'svnadmin'

#ctx.trunk_only = True

#ctx.prune = False

ctx.encoding = ['ascii']

# The basic strategy for converting symbols:
ctx.symbol_strategy = RuleBasedSymbolStrategy()

# To force all symbols matching a regular expression to be
converted
# as branches, add rules like the following:
#ctx.symbol_strategy.add_rule(ForceBranchRegexpStrategyRule(
'branch.*'))

# To force all symbols matching a regular expression to be
converted
# as tags, add rules like the following:
#ctx.symbol_strategy.add_rule(ForceTagRegexpStrategyRule('t
ag.*'))

# To force all symbols matching a regular expression to be
excluded
# from the conversion, add rules like the following:
#ctx.symbol_strategy.add_rule(ExcludeRegexpStrategyRule('un
known-.*'))

# Usually you want this rule, to convert unambiguous symbols
the
# same way they were used in CVS:
ctx.symbol_strategy.add_rule(UnambiguousUsageRule())

# If there was ever a commit on a symbol, then it cannot be
# converted as a tag.  Uncomment the following line to
convert such
# symbols automatically as branches:
#ctx.symbol_strategy.add_rule(BranchIfCommitsRule())

# Next can be a rule that is used for ambiguous symbols. 
Include at
# most one of these lines.  If no lines are included, then
the
# presence of any ambiguous symbols (that haven't been
disambiguated
# above) is an error:

# Convert all ambiguous symbols as branches:
#ctx.symbol_strategy.add_rule(AllBranchRule())
# Convert all ambiguous symbols as tags:
#ctx.symbol_strategy.add_rule(AllTagRule())
# Convert ambiguous symbols based on whether they were used
more
# often as branches or tags:
#ctx.symbol_strategy.add_rule(HeuristicStrategyRule())

# Add lines to the following list to specify that symbols
matching a
# regular expression should be renamed:
ctx.symbol_transforms = [
  #(re.compile(r'release-(\d+)_(\d+)'),
'release-\1.\2'),
  #(re.compile(r'release-(\d+)_(\d+)_(\d+)'),
'release-\1.\2.\3'),
  ]

# Use the following option to specify a username to be used
for
# commits generated by cvs2svn (default is to use no
username for
# such commits):
#ctx.username = 'cvs2svn'

# Uncomment the following line to pass a --fs-type option to
# "svnadmin create":
#ctx.fs_type = 'fsfs'

# Uncomment the following option to pass --bdb-txn-nosync to
# "svnadmin create":
#ctx.bdb_txn_nosync = True

ctx.svn_property_setters = [
  # Uncomment the following line to include the original CVS
revision
  # numbers as file properties in the SVN archive:
  #property_setters.CVSRevisionNumberSetter(),

  # Set the svn:executable flag on any files that are marked
in CVS
  # as being executable:
  property_setters.ExecutablePropertySetter(),

  # Omit the svn:eol-style property from any files that are
listed
  # as binary in CVS:
  property_setters.BinaryFileEOLStyleSetter(),

  # To read mime types from a file, uncomment the following
line and
  # specify a filename:
  #property_setters.MimeMapper('/etc/mime.types'),

  # To read auto-props rules from a file, uncomment the
following
  # line and specify a filename.  The boolean argument
specifies
  # whether case should be ignored in filenames in the
auto-props
  # file:
  #property_setters.AutoPropsPropertySetter(
  #    '/home/username/.subversion/config',
  #    False,
  #    ),

  # If the file is binary and its svn:mime-type property is
not yet
  # set, set svn:mime-type to 'application/octet-stream'.
  property_setters.BinaryFileDefaultMimeTypeSetter(),

  # To try to determine the eol-style from the mime type,
uncomment
  # the following line:
  #property_setters.EOLStyleFromMimeTypeSetter(),

  # Choose one of the following lines to set the default
  # svn:eol-style if none of the above rules applied. 
('None' means
  # that no svn:eol-style is set.)
  #property_setters.DefaultEOLStyleSetter(None)
  property_setters.DefaultEOLStyleSetter('native'),

  # If svn:keywords has not been set yet, set it based on
the file's
  # CVS mode:
 
property_setters.KeywordsPropertySetter(config.SVN_KEYWORDS_
VALUE),
  ]

# The directory to use for temporary files:
ctx.tmpdir = '.'

# To skip the cleanup of temporary files, uncomment the
following
# option:
#ctx.skip_cleanup = True

# Now use stanzas like the following to define projects to
convert:

# Create the default project (using ctx.trunk, ctx.branches,
and ctx.tags):
#ctx.add_project(
#    Project(
#        0,
#        'my/cvsrepo/mainproj',
#        'trunk',
#        'branches',
#        'tags',
#        )
#    )

# Add a second project, to be stored to projA/trunk,
projA/branches,
# and projA/tags:
#ctx.add_project(
#    Project(
#        1,
#        'my/cvsrepo/projA',
#        'projA/trunk',
#        'projA/branches',
#        'projA/tags',
#        )
#    )

# Choose whether to turn on profiling:
profiling = False
#profiling = True



------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribecvs2svn.tigris.org
For additional commands, e-mail: dev-helpcvs2svn.tigris.org
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )