Menu

[r224]: / tools / tag_release_from_trunk.py  Maximize  Restore  History

Download this file

74 lines (52 with data), 1.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/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)