Hi!
ChangeLog:
- added --trunk, --tags and --branches command line options for
specifying relative repository paths
- changed the default behavior to import into an existing repository
- added a command line option --create for creating a new repository
- added infrastructure for handling branches
Regards,
Mark
--- ../../cvs2svn/cvs2svn/cvs2svn.py 2002-10-23 06:27:10.000000000 +0200
+++ ./cvs2svn.py 2002-10-24 20:21:41.000000000 +0200
@@ -140,6 +140,12 @@
self.revs.write('%08lx %s %s %s %s\n' % (timestamp, digest,
op, revision, self.fname))
+def branch_path(ctx, branch_name = None):
+ if branch_name == None:
+ return ctx.trunk_base + '/'
+ else:
+ return ctx.branches_base + '/' + branch_name + '/'
+
def relative_name(cvsroot, fname):
l = len(cvsroot)
if fname[:l] == cvsroot:
@@ -315,12 +321,12 @@
for f, r in self.changes:
# compute a repository path. ensure we have a leading "/" and drop
# the ,v from the file name
- repos_path = '/' + relative_name(ctx.cvsroot, f[:-2])
+ repos_path = branch_path(ctx) + relative_name(ctx.cvsroot, f[:-2])
print ' changing %s : %s' % (r, repos_path)
for f, r in self.deletes:
# compute a repository path. ensure we have a leading "/" and drop
# the ,v from the file name
- repos_path = '/' + relative_name(ctx.cvsroot, f[:-2])
+ repos_path = branch_path(ctx) + relative_name(ctx.cvsroot, f[:-2])
print ' deleting %s : %s' % (r, repos_path)
print ' (skipped; dry run enabled)'
return
@@ -340,7 +346,7 @@
for f, r in self.changes:
# compute a repository path. ensure we have a leading "/" and drop
# the ,v from the file name
- repos_path = '/' + relative_name(ctx.cvsroot, f[:-2])
+ repos_path = branch_path(ctx) + relative_name(ctx.cvsroot, f[:-2])
#print 'DEBUG:', repos_path
print ' changing %s : %s' % (r, repos_path)
@@ -415,7 +421,7 @@
for f, r in self.deletes:
# compute a repository path. ensure we have a leading "/" and drop
# the ,v from the file name
- repos_path = '/' + relative_name(ctx.cvsroot, f[:-2])
+ repos_path = branch_path(ctx) + relative_name(ctx.cvsroot, f[:-2])
print ' deleting %s : %s' % (r, repos_path)
@@ -549,7 +555,10 @@
def pass4(ctx):
# create the target repository
if not ctx.dry_run:
- t_repos = _repos.svn_repos_create(ctx.target, ctx.pool)
+ if ctx.create_repos:
+ t_repos = _repos.svn_repos_create(ctx.target, ctx.pool)
+ else:
+ t_repos = _repos.svn_repos_open(ctx.target, ctx.pool)
t_fs = _repos.svn_repos_fs(t_repos)
else:
t_fs = t_repos = None
@@ -631,15 +640,20 @@
def usage():
print 'USAGE: %s [-n] [-v] [-s svn-repos-path] [-p pass] cvs-repos-path' \
% os.path.basename(sys.argv[0])
- print ' -n dry run. parse CVS repos, but do not construct SVN repos.'
- print ' -v verbose.'
- print ' -s PATH path for new SVN repos.'
- print ' -p NUM start at pass NUM of %d.' % len(_passes)
+ print ' -n dry run. parse CVS repos, but do not construct SVN repos.'
+ print ' -v verbose.'
+ print ' -s PATH path for SVN repos.'
+ print ' -p NUM start at pass NUM of %d.' % len(_passes)
+ print ' --create create a new SVN repository'
+ print ' --trunk=PATH path for trunk (default: /trunk)'
+ print ' --branches=PATH path for branches (default: /tags)'
+ print ' --tags=PATH path for tags (default: /branches)'
sys.exit(1)
def main():
try:
- opts, args = getopt.getopt(sys.argv[1:], 'p:s:vn')
+ opts, args = getopt.getopt(sys.argv[1:], 'p:s:vn',
+ [ "create", "trunk", "branches", "tags" ])
except getopt.GetoptError:
usage()
if len(args) != 1:
@@ -652,6 +666,10 @@
ctx.log_fname_base = DATAFILE
ctx.verbose = 0
ctx.dry_run = 0
+ ctx.create_repos = 0
+ ctx.trunk_base = "/trunk"
+ ctx.tags_base = "/tags"
+ ctx.branches_base = "/branches"
start_pass = 1
@@ -668,6 +686,14 @@
ctx.dry_run = 1
elif opt == '-s':
ctx.target = value
+ elif opt == '--create':
+ ctx.create_repos = 1
+ elif opt == '--trunk':
+ ctx.trunk_base = value
+ elif opt == '--branches':
+ ctx.branches_base = value
+ elif opt == '--tags':
+ ctx.tags_base = value
util.run_app(convert, ctx, start_pass=start_pass)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 24 20:54:13 2002