[PATCH 0 of 3] convert: Built-in cvsps for hg cvs import (5).

Frank Kingswood frank at kingswood-consulting.co.uk
Thu Apr 24 13:48:59 CDT 2008


convert: Built-in cvsps for hg cvs import.

This patch adds a built-in cvsps replacement.
To use this, set these options in .hgrc.

        [convert]
        cvsps = builtin
        cvsps.fuzz = cvs changeset datestamp fuzz
        cvsps.mergeto = some regular expression
        cvsps.mergefrom = some regular expression

The built-in cvsps uses cvs rlog on the repository (it does not do
direct cvs server calls, it runs the cvs executable), sorts the commit
log messages, and merges commits with identical messages, author and
branch name and a date within the 60-seconds fuzz window.

A log cache file is written to ~/.hg.cvsps/, which is used to avoid
re-reading all of the CVS log when the conversion is run again.

This builtin cvsps code has been found to work succesfully in cases
where the traditional external cvsps program generates incorrect
changesets.

The builtin cvsps code can merge CVS branches based on magic tags in
the CVS log message. When a log message matches the cvsps.mergefrom
regular expression, then cvsps will set a second parent for a changeset
to indicate a merge from the named branch.
When a log message matches the cvsps.mergeto regular expression then
cvsps will insert a dummy changeset (with no members, so no changes)
merging the branch into the named branch (which must exist).
The cvsps.mergefrom pattern defaults to {{mergefrombranch ([-\w]+)}},
and the cvsps.mergeto pattern defaults to {{mergetobranch ([-\w]+)}}.

For convenience, the cvsps.py script can also be run as a standalone
replacement for cvsps, as long as the mercurial modules are in the
PYTHONPATH. When run standalone, cvsps.py accepts these cvsps options
-b -p -r --root -u -v -x and -z.

This fifth version changes the naming of the log cache file to avoid
collisions; fixes a bug that was triggered when the cache could not
be read; makes cvsps a separate file to allow sharing of log caches
between it and hg convert; fixes a bug in determining ancestors and
adds an option to cvsps to show the ancestors of changesets.


More information about the Mercurial-devel mailing list