You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/05/23 06:15:37 UTC
svn commit: r1485563 - /subversion/trunk/tools/dist/release.py
Author: danielsh
Date: Thu May 23 04:15:37 2013
New Revision: 1485563
URL: http://svn.apache.org/r1485563
Log:
Factor out common code. No functional change.
* tools/dist/release.py
(create_tag): Introduce a new local helper, use it to simplify two similar
blocks of code and reduce the number of local variables.
Modified:
subversion/trunk/tools/dist/release.py
Modified: subversion/trunk/tools/dist/release.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1485563&r1=1485562&r2=1485563&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ subversion/trunk/tools/dist/release.py Thu May 23 04:15:37 2013
@@ -553,21 +553,20 @@ def create_tag(args):
new_version = Version('%d.%d.%d' %
(args.version.major, args.version.minor,
args.version.patch + 1))
- svn_version_h = tempfile.NamedTemporaryFile()
- svn_version_h_url = '%s/subversion/include/svn_version.h' % branch
- subprocess.check_call(['svn', 'cat',
- '%s@%d' % (svn_version_h_url, args.revnum),
- ],
- stdout=svn_version_h)
+
+ def file_object_for(relpath):
+ fd = tempfile.NamedTemporaryFile()
+ url = branch + '/' + relpath
+ fd.url = url
+ subprocess.check_call(['svn', 'cat', '%s@%d' % (url, args.revnum)],
+ stdout=fd)
+ return fd
+
+ svn_version_h = file_object_for('subversion/include/svn_version.h')
replace_in_place(svn_version_h, '#define SVN_VER_PATCH ',
str(args.version.patch), str(new_version.patch))
- STATUS = tempfile.NamedTemporaryFile()
- STATUS_url = '%s/STATUS' % branch
- subprocess.check_call(['svn', 'cat',
- '%s@%d' % (STATUS_url, args.revnum),
- ],
- stdout=STATUS)
+ STATUS = file_object_for('STATUS')
replace_in_place(STATUS, 'Status of ',
str(args.version), str(new_version))
@@ -577,8 +576,8 @@ def create_tag(args):
'-m', 'Post-release housekeeping: '
'bump the %s branch to %s.'
% (branch.split('/')[-1], str(new_version)),
- 'put', svn_version_h.name, svn_version_h_url,
- 'put', STATUS.name, STATUS_url,
+ 'put', svn_version_h.name, svn_version_h.url,
+ 'put', STATUS.name, STATUS.url,
])
del svn_version_h
del STATUS