On Mon, 2004-08-09 at 16:04, Eric S. Raymond wrote:
> Thanks for the copy of the Subversion book. As you might have anticipated,
> it has renewed my interest in this software, and I am experimentally
> converting some of my projects from RCS.
Excellent. The book is fulfilling its role as a subversive tool.
> The following patch implements a feature for cvs2svn that supports massaging
> illegal symbolic names into something useful rather than throwing them away.
> The use case for this feature is the way many solo developers use
> plain old RCS with per-project local repositories for version control.
> Emacs VC mode, which I originally wrote, encourages this; furthermore,
> I designed its Ctl-x v s command to allow developers to use the RCS
> tagging feature as a klugey form of release labeling. Ctl-x v s
> accepts a tag name and applies it to the latest revision of all
> RCS-controlled files beneath the current directory.
> Because dot is illegal in RCS symbol names, the natural way to label
> such snapshots is with symbol names like 1-0, 1-1, 2-1, etc.
> Unfortunately these are illegal to cvs2svn, so the user's most
> important version-control data is summarily discarded.
> This patch allows cvs2svn users to give any number of --transform-tag options.
> Each option should be a string in two parts sepatated by a ":". The first part
> is a pattern, the second should be a substitution (both in Python regexp
> syntax). Whenever cvs2svn is about to store a symbolic name, each tag
> transform is applied in the order it was specified. Each transform
> application generates a warning. The result of all transforms is what is
> registered (or discarded if it's still illegal).
Sounds good to me. Comments inline below.
> Here is a representative application:
> cvs2svn --tag-transform='([0-9])-(.*):release-\1.\2' -q -s SVN RCS
> This transforms a local CVS repository into a local SVN repository, performing
> the following mappings of RCS symbolic names to SVN tags:
> 1-0 => release-1.0
> 1-1 => release-1.1
> 2-0 => release-2.0
> etc. Ideally there should be another option arranging for all the
> commits associated with each release to be merged and their log
> message accumulated, but that's a more difficult problem. Perhaps for
> my next patch...
Can you write a log message to go with your patch? See
http://svn.collab.net/repos/cvs2svn/trunk/HACKING for log message
> --- cvs2svn 2004/08/08 18:43:00 1.1
> +++ cvs2svn 2004/08/08 20:04:00
> @@ -291,6 +291,9 @@
> CRLF = "\x0d\x0a"
> LF = "\x0a"
> +# This should probably be local to some class
> +tag_transforms = 
Please toss it into the Ctx class along with the rest of the application
> def temp(basename):
> """Return a path to BASENAME in Ctx().tmpdir.
> This is a convenience function to save horizontal space in source."""
> @@ -1110,6 +1113,12 @@
> header, for example: '1.7', '22.214.171.124', or '1.1.1' or '126.96.36.199'.
> This function will determine what kind of symbolic name it is by
> inspection, and record it in the right places."""
> + for (pattern, replacement) in tag_transforms:
> + newname = re.sub(pattern, replacement, name)
> + sys.stderr.write("%s: in '%s':\n"
> + " tag '%s' transformed to '%s'\n"
> + % (warning_prefix, self.fname, name, newname))
Hmm... since this transform is an expected behavior, I'd prefer to see
the warning printed to STDOUT via the cvs2svn log facility... something
Log().write(LOG_WARN, str % (warning_prefix, self.rel_name,
> + name = newname
> if not symbolic_name_re.match(name):
> sys.stderr.write("%s: in '%s':\n"
> " '%s' is not a valid tag or branch name, ignoring\n"
> @@ -4202,6 +4211,7 @@
> def main():
> # Convenience var, so we don't have to keep instantiating this Borg.
> + global tag_transforms
> ctx = Ctx()
> profiling = None
> @@ -4219,7 +4229,8 @@
> "trunk-only", "no-prune", "dry-run",
> "dump-only", "dumpfile=", "tmpdir=",
> "svnadmin=", "skip-cleanup", "cvs-revnums",
> - "bdb-txn-nosync", "version", "profile", "keywords-off"])
> + "bdb-txn-nosync", "version", "profile",
> + "keywords-off", "tag-transform="])
> except getopt.GetoptError, e:
> sys.stderr.write(error_prefix + ': ' + str(e) + '\n\n')
> @@ -4319,6 +4330,8 @@
> 'default,\nand passing the option is deprecated.\n')
> elif opt == '--profile':
> profiling = 1
> + elif opt == '--tag-transform':
> + tag_transforms.append(value.split(":"))
> if ctx.print_help:
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com
Received on Mon Aug 9 23:44:43 2004