#!/usr/bin/python
#
# Copyright Glyn Matthews 2008.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
"""
This script is used to copy everything from trunk to a new tagged
version.
$shell> tag_release_from_trunk.py --major=0 --minor=1
"""
__author__ = 'Glyn Matthews'
import os
import pysvn
# constants
root_url = "https://cpp-netlib.svn.sourceforge.net/svnroot/cpp-netlib"
def tag_release_from_trunk(client, log_message, version):
"""
Copys the tree from trunk to a new location, and it's tagged as a
version release.
"""
def get_log_message():
return True, log_message
client.callback_get_log_message = get_log_message
trunk_url = "%s/trunk" % root_url
tag_url = "%s/tags/release/%s" % (root_url, version)
client.copy(src_url_or_path=trunk_url,
dest_url_or_path=tag_url)
def usage():
""" """
print "Usage: python tag_release_from_trunk.py --major=<major> --minor<minor>"
if __name__ == "__main__":
import sys
import getopt
try:
opts, args = getopt.getopt(sys.argv[1:], "", ["major=", "minor="])
for name, value in opts:
if name == '--major':
major = int(value)
elif name == '--minor':
minor = int(value)
if major is None or minor is None:
usage()
sys.exit(-1)
version = "%d.%d" % (major, minor)
log_message = "Tagging release %s." % version
client = pysvn.Client()
tag_release_from_trunk(client, log_message, version)
except Exception, err:
print err
sys.exit(-1)