cmpilato@tigris.org writes:
> Rename tags for 3-tuple consistency. This change brought to you by
> a custom one-off script written in Python to the Subversion bindings.
> Kids, do not try this at home.
In case anyone was wondering:
#!/usr/bin/env python2
import sys
from svn import core, repos, fs
log_msg = \
"""Rename tags for 3-tuple consistency. This change brought to you by
a custom one-off script written in Python to the Subversion bindings.
Kids, do not try this at home. """
core.apr_initialize()
pool = core.svn_pool_create(None)
repo = repos.svn_repos_open(sys.argv[1], pool)
fsptr = repos.svn_repos_fs(repo)
youngest = fs.youngest_rev(fsptr, pool)
rev_root = fs.revision_root(fsptr, youngest, pool)
fn = repos.svn_repos_fs_begin_txn_for_commit
txnp = fn (repo, youngest, 'cmpilato', log_msg, pool)
txn_root = fs.txn_root(txnp, pool)
entries = fs.dir_entries(txn_root, '/tags', pool).keys()
sub = core.svn_pool_create(pool)
for entry in entries:
core.svn_pool_clear(sub)
pieces = entry.split('.')
if len(pieces) == 2:
try:
int(pieces[0])
int(pieces[1])
new_entry = entry + '.0'
fs.copy(rev_root, '/tags/' + entry, txn_root,
'/tags/' + new_entry, sub)
print 'Renaming tag: %s -> %s' % (entry, new_entry)
fs.delete(txn_root, '/tags/' + entry, sub)
except ValueError:
pass
fs.commit_txn(txnp, pool)
core.svn_pool_destroy(sub)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Mar 18 19:25:15 2004