Author: hwright
Date: Tue Jul 12 21:11:57 2011
New Revision: 1145771
URL: http://svn.apache.org/viewvc?rev=1145771&view=rev
Log:
release.py: Use the Version class instead of a separate helper function.
* tools/dist/release.py
(Version): loosen the regex, add a couple of helper functions.
(split_version): Remove.
(build_env, roll_tarballs, post_candidates, write_news, write_announcement):
Use the Version class.
(main): Automatically convern incoming version strings to Version objects.
Modified:
subversion/trunk/subversion/libsvn_client/prop_commands.c
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/tests/cmdline/svntest/verify.py
subversion/trunk/tools/dist/release.py
Modified: subversion/trunk/subversion/libsvn_client/prop_commands.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/prop_commands.c?rev=1145771&r1=1145770&r2=1145771&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/trunk/subversion/libsvn_client/prop_commands.c Tue Jul 12
21:11:57 2011
@@ -567,50 +567,6 @@ svn_client_revprop_set2(const char *prop
}
-/* Set *PROPS to the pristine (base) properties at LOCAL_ABSPATH, if PRISTINE
- * is true, or else the working value if PRISTINE is false.
- *
- * The keys of *PROPS will be 'const char *' property names, and the
- * values 'const svn_string_t *' property values. Allocate *PROPS
- * and its contents in RESULT_POOL. Use SCRATCH_POOL for temporary
- * allocations.
- */
-static svn_error_t *
-pristine_or_working_props(apr_hash_t **props,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- svn_boolean_t pristine,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- if (pristine)
- {
- return svn_error_trace(svn_wc_get_pristine_props(props,
- wc_ctx,
- local_abspath,
- result_pool,
- scratch_pool));
- }
-
- /* ### until svn_wc_prop_list2() returns a NULL value for locally-deleted
- ### nodes, then let's check manually. */
- {
- svn_boolean_t deleted;
-
- SVN_ERR(svn_wc__node_is_status_deleted(&deleted, wc_ctx, local_abspath,
- scratch_pool));
- if (deleted)
- {
- *props = NULL;
- return SVN_NO_ERROR;
- }
- }
-
- return svn_error_trace(svn_wc_prop_list2(props, wc_ctx, local_abspath,
- result_pool, scratch_pool));
-}
-
-
/* Helper for the remote case of svn_client_propget.
*
* Get the value of property PROPNAME in REVNUM, using RA_LIB and
@@ -1122,8 +1078,8 @@ svn_client_proplist3(const char *path_or
{
svn_boolean_t pristine;
svn_node_kind_t kind;
- apr_hash_t *changelist_hash = NULL;
const char *local_abspath;
+ struct recursive_proplist_receiver_baton rb;
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path_or_url, pool));
@@ -1143,48 +1099,28 @@ svn_client_proplist3(const char *path_or
pool));
}
- if (changelists && changelists->nelts)
- SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash,
- changelists, pool));
-
- /* Fetch, recursively or not. */
- if (kind == svn_node_dir)
- {
- struct recursive_proplist_receiver_baton rb;
-
- rb.wc_ctx = ctx->wc_ctx;
- rb.wrapped_receiver = receiver;
- rb.wrapped_receiver_baton = receiver_baton;
-
- if (strcmp(path_or_url, local_abspath) != 0)
- {
- rb.anchor = path_or_url;
- rb.anchor_abspath = local_abspath;
- }
- else
- {
- rb.anchor = NULL;
- rb.anchor_abspath = NULL;
- }
-
- SVN_ERR(svn_wc__prop_list_recursive(ctx->wc_ctx, local_abspath, NULL,
- depth,
- FALSE, pristine, changelists,
- recursive_proplist_receiver, &rb,
- ctx->cancel_func,
- ctx->cancel_baton, pool));
- }
- else if (svn_wc__changelist_match(ctx->wc_ctx, local_abspath,
- changelist_hash, pool))
- {
- apr_hash_t *hash;
-
- SVN_ERR(pristine_or_working_props(&hash, ctx->wc_ctx, local_abspath,
- pristine, pool, pool));
- SVN_ERR(call_receiver(path_or_url, hash,
- receiver, receiver_baton, pool));
- }
+ rb.wc_ctx = ctx->wc_ctx;
+ rb.wrapped_receiver = receiver;
+ rb.wrapped_receiver_baton = receiver_baton;
+
+ if (strcmp(path_or_url, local_abspath) != 0)
+ {
+ rb.anchor = path_or_url;
+ rb.anchor_abspath = local_abspath;
+ }
+ else
+ {
+ rb.anchor = NULL;
+ rb.anchor_abspath = NULL;
+ }
+
+ SVN_ERR(svn_wc__prop_list_recursive(ctx->wc_ctx, local_abspath, NULL,
+ depth,
+ FALSE, pristine, changelists,
+ recursive_proplist_receiver, &rb,
+ ctx->cancel_func,
+ ctx->cancel_baton, pool));
}
else /* remote target */
{
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1145771&r1=1145770&r2=1145771&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Jul 12 21:11:57
2011
@@ -221,6 +221,10 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
SELECT properties FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
+-- STMT_SELECT_CURRENT_PROPS
+SELECT properties FROM nodes_current
+WHERE wc_id = ?1 AND local_relpath = ?2
+
-- STMT_SELECT_NODE_PROPS
SELECT properties, presence FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1145771&r1=1145770&r2=1145771&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Jul 12 21:11:57 2011
@@ -7610,18 +7610,6 @@ db_read_pristine_props(apr_hash_t **prop
/* Examine the presence: */
presence = svn_sqlite__column_token(stmt, 1, presence_map);
- /* For "base-deleted", it is obvious the pristine props are located
- in the BASE table. Fall through to fetch them.
- ### BH: Is this really the behavior we want here? */
- if (presence == svn_wc__db_status_base_deleted)
- {
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
-
- SVN_ERR_ASSERT(have_row);
-
- presence = svn_sqlite__column_token(stmt, 1, presence_map);
- }
-
/* normal or copied: Fetch properties (during update we want
properties for incomplete as well) */
if (presence == svn_wc__db_status_normal
Modified: subversion/trunk/subversion/tests/cmdline/svntest/verify.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/verify.py?rev=1145771&r1=1145770&r2=1145771&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/verify.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/verify.py Tue Jul 12
21:11:57 2011
@@ -357,6 +357,8 @@ def compare_and_display_lines(message, l
actual = [line for line in actual if not line.startswith('DBG:')]
if not expected.matches(actual, except_re):
+ print expected
+ print actual
expected.display_differences(message, label, actual)
raise raisable
Modified: subversion/trunk/tools/dist/release.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/release.py?rev=1145771&r1=1145770&r2=1145771&view=diff
==============================================================================
--- subversion/trunk/tools/dist/release.py (original)
+++ subversion/trunk/tools/dist/release.py Tue Jul 12 21:11:57 2011
@@ -76,7 +76,7 @@ people_dist_dir = '/www/www.apache.org/d
# Utility functions
class Version(object):
- regex =
re.compile('subversion-(\d+).(\d+).(\d+)(?:-(?:(rc|alpha|beta)(\d+)))?')
+ regex = re.compile('(\d+).(\d+).(\d+)(?:-(?:(rc|alpha|beta)(\d+)))?')
def __init__(self, ver_str):
match = self.regex.search(ver_str)
@@ -95,6 +95,11 @@ class Version(object):
self.pre = None
self.pre_num = None
+ self.base = '%d.%d.%d' % (self.major, self.minor, self.patch)
+
+ def is_prerelease(self):
+ return self.pre != None
+
def __lt__(self, that):
if self.major < that.major: return True
if self.major > that.major: return False
@@ -116,13 +121,12 @@ class Version(object):
return self.pre_num < that.pre_num
def __str(self):
- base = '%d.%d.%d' % (self.major, self.minor, self.patch)
if self.pre:
extra = '-%s%d' % (self.pre, self.pre_num)
else:
extra = ''
- return base + extra
+ return self.base + extra
def __repr__(self):
@@ -171,13 +175,6 @@ def download_file(url, target):
target_file = open(target, 'w')
target_file.write(response.read())
-def split_version(version):
- parts = version.split('-')
- if len(parts) == 1:
- return (version, None)
-
- return parts[0], parts[1]
-
def assert_people():
if os.uname()[1] != people_host:
raise RuntimeError('Not running on expected host "%s"' % people_host)
@@ -334,12 +331,11 @@ def build_env(args):
def roll_tarballs(args):
'Create the release artifacts.'
extns = ['zip', 'tar.gz', 'tar.bz2']
- version_base, version_extra = split_version(args.version)
if args.branch:
branch = args.branch
else:
- branch = version_base[:-1] + 'x'
+ branch = args.version.base[:-1] + 'x'
logging.info('Rolling release %s from branch %s@%d' % (args.version,
branch,
args.revnum))
@@ -374,28 +370,21 @@ def roll_tarballs(args):
# For now, just delegate to dist.sh to create the actual artifacts
extra_args = ''
- if version_extra:
- if version_extra.startswith('alpha'):
- extra_args = '-alpha %s' % version_extra[5:]
- elif version_extra.startswith('beta'):
- extra_args = '-beta %s' % version_extra[4:]
- elif version_extra.startswith('rc'):
- extra_args = '-rc %s' % version_extra[2:]
- elif version_extra.startswith('nightly'):
- extra_args = '-nightly'
+ if args.version.is_prerelease():
+ extra_args = '-%s %d' % (args.version.pre, args.version.pre_num)
logging.info('Building UNIX tarballs')
run_script(args.verbose, '%s/dist.sh -v %s -pr %s -r %d %s'
- % (sys.path[0], version_base, branch, args.revnum,
+ % (sys.path[0], args.version.base, branch, args.revnum,
extra_args) )
logging.info('Buildling Windows tarballs')
run_script(args.verbose, '%s/dist.sh -v %s -pr %s -r %d -zip %s'
- % (sys.path[0], version_base, branch, args.revnum,
+ % (sys.path[0], args.version.base, branch, args.revnum,
extra_args) )
# Move the results to the deploy directory
logging.info('Moving artifacts and calculating checksums')
for e in extns:
- if version_extra and version_extra.startswith('nightly'):
+ if args.version.pre == 'nightly':
filename = 'subversion-trunk.%s' % e
else:
filename = 'subversion-%s.%s' % (args.version, e)
@@ -416,8 +405,6 @@ def roll_tarballs(args):
def post_candidates(args):
'Post the generated tarballs to web-accessible directory.'
- version_base, version_extra = split_version(args.version)
-
if args.target:
target = args.target
else:
@@ -438,8 +425,8 @@ def post_candidates(args):
}
# Choose the right template text
- if version_extra:
- if version_extra.startswith('nightly'):
+ if args.version.is_prerelease():
+ if args.version.pre == 'nightly':
template_filename = 'nightly-candidates.ezt'
else:
template_filename = 'rc-candidates.ezt'
@@ -492,17 +479,14 @@ def clean_dist(args):
def write_news(args):
'Write text for the Subversion website.'
- version_base, version_extra = split_version(args.version)
-
data = { 'date' : datetime.date.today().strftime('%Y%m%d'),
'date_pres' : datetime.date.today().strftime('%Y-%m-%d'),
- 'version' : args.version,
- 'version_base' : version_base[0:3],
+ 'version' : str(args.version),
+ 'version_base' : args.version.base,
}
- if version_extra:
- if version_extra.startswith('alpha'):
- template_filename = 'rc-news.ezt'
+ if args.version.is_prerelease():
+ template_filename = 'rc-news.ezt'
else:
template_filename = 'stable-news.ezt'
@@ -530,20 +514,17 @@ def get_sha1info(args):
def write_announcement(args):
'Write the release announcement.'
- version_base, version_extra = split_version(args.version)
-
sha1info = get_sha1info(args)
data = { 'version' : args.version,
'sha1info' : sha1info,
'siginfo' : open('getsigs-output', 'r').read(),
- 'major-minor' : version_base[:3],
- 'major-minor-patch' : version_base,
+ 'major-minor' : args.version.base[:3],
+ 'major-minor-patch' : args.version.base,
}
- if version_extra:
- if version_extra.startswith('alpha'):
- template_filename = 'rc-release-ann.ezt'
+ if args.version.is_prerelease():
+ template_filename = 'rc-release-ann.ezt'
else:
template_filename = 'stable-release-ann.ezt'
@@ -588,7 +569,7 @@ def main():
subparser = subparsers.add_parser('roll',
help='''Create the release artifacts.''')
subparser.set_defaults(func=roll_tarballs)
- subparser.add_argument('version',
+ subparser.add_argument('version', type=Version,
help='''The release label, such as '1.7.0-alpha1'.''')
subparser.add_argument('revnum', type=int,
help='''The revision number to base the release on.''')
@@ -601,7 +582,7 @@ def main():
The default location is somewhere in ~/public_html.
''')
subparser.set_defaults(func=post_candidates)
- subparser.add_argument('version',
+ subparser.add_argument('version', type=Version,
help='''The release label, such as '1.7.0-alpha1'.''')
subparser.add_argument('revnum', type=int,
help='''The revision number to base the release on.''')
@@ -626,14 +607,14 @@ def main():
help='''Output to stdout template text for use in the news
section of the Subversion website.''')
subparser.set_defaults(func=write_news)
- subparser.add_argument('version',
+ subparser.add_argument('version', type=Version,
help='''The release label, such as '1.7.0-alpha1'.''')
subparser = subparsers.add_parser('write-announcement',
help='''Output to stdout template text for the emailed
release announcement.''')
subparser.set_defaults(func=write_announcement)
- subparser.add_argument('version',
+ subparser.add_argument('version', type=Version,
help='''The release label, such as '1.7.0-alpha1'.''')
# A meta-target